e 5.10.1;
use Mouse;
use Config::Model::Exception;
use Log::Log4perl qw(get_logger :levels);
use JSON;
use Path::Tiny;
use YAML::Tiny;
use feature qw/postderef signatures/;
no warnings qw/experiment
e,
},
fallback => {
':.rm' => \&_remove_by_id,
':.json' => \&_load_json_vector_data,
}
);
my %equiv = (
'hash_*' => { qw/:@ :.sort :.mo
return 'ok';
}
sub __load_json_file ($file) {
# utf8 decode is done by JSON module, so slurp_raw must be used
return decode_json($file->slurp_raw);
}
sub _load_json_vector_data {
my ( $s
le => './stripe-settings.json',
livemode => 0,
ignore_unknown_parameters => 1,
expand => 'all',
}) || die( Net::API::Stripe->error );
A Stripe json settings file looks lik
<Net::API::Stripe::Connect::Account::Company> object.
=head2 conf_file( [ file path ] )
Given a json configuration file, it will read the data, set the property I<conf_data> to the decoded hash and
eference, this will issue a C<DELETE> http query and return a hash reference corresponding to the json data returned by Stripe, or, in case of error, it will return undef and set the error which can b
reate those objects. For example:
my $stripe = Net::API::Stripe->new( conf_file => 'settings.json' ) | die( Net::API::Stripe->error );
my $stripe_card = $stripe->cards( create =>
{
ac
e HTTP::Promise::Headers;
use HTTP::Promise::Message;
use HTTP::Promise::Request;
use JSON;
use MIME::QuotedPrint ();
use MIME::Base64 ();
use Module::Generic::File qw( sys_tmp
sub encode_with_json;
sub expand;
sub fields;
sub file_api_uri;
sub generate_uuid;
sub get;
sub http_client;
sub http_request;
sub http_response;
sub ignore_unknown_parameters;
sub json;
sub key;
sub
} = $BROWSER unless( length( $self->{browser} ) );
$self->{encode_with_json} = 0 unless( length( $self->{encode_with_json} ) );
$self->{api_uri} = URI->new( API_BASE ) unless( length( $self->{
k for the client to approve
B<Parameters>
$params
Hash of parameters
B<Return value>
JSON response as a string
=cut
sub request_approval {
my $self = shift;
my %params = @_;
meters>
$submission_id
Submission ID
$params
Hash of parameters
B<Return value>
JSON response as a string
=cut
sub approve {
my $self = shift;
my $submission_id = shift;
meters>
$submission_id
Submission ID
$params
Hash of parameters
B<Return value>
JSON response as a string
=cut
sub reject {
my $self = shift;
my $submission_id = shift;
Fields -- create the fields part of a create table script
#
# SYNOPSIS
# ========
# my $json = from_json( qq (
# {
# "fields": {
# "userid": "varchar",
#
plates'
# );
#
# my $fields = GenerateSQL::Sql::Table::Fields->new(
# json => $json,
# template => $template,
# );
#
# $fields->create_fields();
#
fields->sql;
#
# METHODS
# =======
# create_fields() Create the SQL for field creation from JSON
# get_defaults($datatype) Get defaults part for the sql datatype
#
#
#
class Daje::Generat
key} = "";
$templates->{template_ind} = "";
try {
my $fields = $self->json->{fields};
foreach my $key (sort keys %{$fields}) {
if (index($key,'_
ters>
$team_reference
Team reference
$params
Hash of parameters
B<Return value>
JSON response as a string
=cut
sub submit_bonus {
my $self = shift;
my $team_reference = shi
ss, $api, ENTRY_POINT);
}
=item get_categories_v2
Get categories (V2)
B<Return value>
JSON response as a string
=cut
sub get_categories_v2 {
my $self = shift;
die "The legacy AP
L call - see example in this library.";
}
=item get_skills
Get skills
B<Return value>
JSON response as a string
=cut
sub get_skills {
my $self = shift;
die "The legacy API was d
- see example in this library.";
}
=item get_skills_v2
Get skills V2
B<Return value>
JSON response as a string
=cut
sub get_skills_v2 {
my $self = shift;
die "The legacy API wa
contract
B<Parameters>
$contract
Contract number
$ts
Timestamp
B<Return value>
JSON response as a string
=cut
sub get_by_contract {
my $self = shift;
my $contract = shift;
t
Contract number
$ts
Timestamp
$params
Hash of parameters
B<Return value>
JSON response as a string
=cut
sub update_by_contract {
my $self = shift;
my $contract = shi
contract
B<Parameters>
$contract
Contract number
$ts
Timestamp
B<Return value>
JSON response as a string
=cut
sub delete_by_contract {
my $self = shift;
my $contract = shi
outer($class, $api, ENTRY_POINT);
}
=item get_user_info
Get user info
B<Return value>
JSON response as a string
=cut
sub get_user_info {
my $self = shift;
my %params = @_;
d
Start date
$till_date
End date
$params
Hash of parameters
B<Return value>
JSON response as a string
=cut
sub get_by_company {
my $self = shift;
my $company = shift;
Start date
$till_date
End date
$params
Hash of parameters
B<Return value>
JSON response as a string
=cut
sub get_by_contract {
my $self = shift;
my $contract = shift;
D
$username
User ID
$date
Date
$params
Hash of parameters
B<Return value>
JSON response as a string
=cut
sub get {
my $self = shift;
my $company = shift;
my $date
contract
Contract ID
$date
Date
$params
Hash of parameters
B<Return value>
JSON response as a string
=cut
sub get_by_contract {
my $self = shift;
my $contract = shift;
lass, $api, ENTRY_POINT);
}
=item get_rooms
Retrive rooms information
B<Return value>
JSON response as a string
=cut
sub get_rooms {
my $self = shift;
my $company = shift;
my
s library.";
}
=item get_room_details
Get a specific room information
B<Return value>
JSON response as a string
=cut
sub get_room_details {
my $self = shift;
my $company = shift;
ibrary.";
}
=item get_room_messages
Get messages from a specific room
B<Return value>
JSON response as a string
=cut
sub get_room_messages {
my $self = shift;
my $company = shift
:API::Routers::Graphql;
use strict;
use warnings;
use parent "Net::Upwork::API";
use JSON::MaybeXS qw/encode_json/;
use constant ENTRY_POINT => Net::Upwork::API::Client::ENTRY_POINT_GQL;
=pod
=hea
alue>
JSON response as a string
=cut
sub execute {
my $self = shift;
my %params = @_;
my $json = encode_json \%params;
return $self->client()->graphql_request($json, $self->{t
it_router($class, $api, ENTRY_POINT);
}
=item get_list
Get Teams Info
B<Return value>
JSON response as a string
=cut
sub get_list {
my $self = shift;
die "The legacy API was dep
n_team
Get Users in Team
B<Parameters>
$team_ref
Team reference
B<Return value>
JSON response as a string
=cut
sub get_users_in_team {
my $self = shift;
my $team_ref = shif
TABLE users;
DROP TABLE company_type;
DROP TABLE companies;
DROP TABLE companies_users;
@@ users.json
{
"tables": [
{
"table": {
"name": "users",
my $json_arr = $self->json;
my $length = scalar @{$json_arr};
for (my $i = 0; $i < $length; $i++) {
my $json = @{$json_arr}[$i];
if (exists($json->{versio
n})) {
if(exists($json->{version}->{tables})) {
my $tables = $json->{version}->{tables};
my $len = scalar @{$tables};
for(my
}
}
$sections .= $self->create_section($sql, $json->{version}->{number});
}
}
$self->set_sql($self->create_file($sectio
= "";
method create_index {
my $sql = "";
my $json = $self->json->{index};
my $length = scalar @{$json};
for (my $i = 0; $i < $length; $i++) {
my $tem
pe>>/@{$json}[$i]->{type}/ig;
$template =~ s/<<fields>>/@{$json}[$i]->{fields}/ig;
@{$json}[$i]->{fields} =~ s/,/_/ig;
$template =~ s/<<field_names>>/@{$json}[$i]->
outer($class, $api, ENTRY_POINT);
}
=item get_list
Get Companies Info
B<Return value>
JSON response as a string
=cut
sub get_list {
my $self = shift;
die "The legacy API was dep
Get Specific Company
B<Parameters>
$company_ref
Company reference
B<Return value>
JSON response as a string
=cut
sub get_specific {
my $self = shift;
my $company_ref = shift;
Get Teams in Company
B<Parameters>
$company_ref
Company reference
B<Return value>
JSON response as a string
=cut
sub get_teams {
my $self = shift;
my $company_ref = shift;