view release on metacpan or search on metacpan
lib/AMPR/Rip44.pm view on Meta::CPAN
=head1 SUBROUTINES/METHODS
=head2 fill_local_ifs
Figure out local interface IP addresses so that routes to them can be ignored
=cut
sub fill_local_ifs() {
}
=head2 mask2prefix
Convert a netmask (in integer form) to the corresponding prefix length,
and validate it too. This is a bit ugly, optimizations are welcome.
=cut
sub mask2prefix ($) {
lib/AMPR/Rip44.pm view on Meta::CPAN
=head1 BUGS
Please report any bugs or feature requests to C<bug-ampr-rip44 at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=AMPR-Rip44>. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
=head1 SUPPORT
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AMQP.pm view on Meta::CPAN
=head1 METHODS
B<server($url)>
Configures all of the connection settings based on an AMQP url. The format of which is:
amqp://username:password@host:port/vhost
All of the elements of the url are required if you are not using the defaults. The default settings are:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ANSI/Heatmap.pm view on Meta::CPAN
my $yscale = $mm{height} / ($mm{max_y} - $mm{min_y} + 1);
my $get = sub { $self->{map}[ $_[1] ][ $_[0] ] || 0 };
my $sample;
if (!$self->interpolate
|| $xscale == int($xscale) && $yscale == int($yscale)) {
$sample = $get; # nearest neighbour/direct lookup
}
else {
$sample = _binterp($get);
}
lib/ANSI/Heatmap.pm view on Meta::CPAN
=item interpolate ( BOOL )
If width/height is not a nice multiple of the input data and
this flag is set, perform bilinear interpolation (instead of
nearest neighbour). This is a trade off; interpolated data is
blurrier, but retains a linear relationship with the original
data. Off by default.
=back
lib/ANSI/Heatmap.pm view on Meta::CPAN
=head2 data
Returns the heatmap data, cropped, scaled and normalised with
intensity values between 0 and 1.
Expressed as an arrayref of arrayrefs indexed by Y and then
X co-ordinate.
=head2 render ( DATA )
Manually render heatmap data as returned by C<data>. Useful
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ANSI/Palette.pm view on Meta::CPAN
use warnings;
our $VERSION = '0.05';
use base 'Import::Export';
our %EX = (
reset => [qw/all/],
palette_8 => [qw/all/],
palette_16 => [qw/all/],
palette_256 => [qw/all/],
text_8 => [qw/all text ansi_8/],
text_16 => [qw/all text ansi_16/],
lib/ANSI/Palette.pm view on Meta::CPAN
sub palette_8 {
print "ANSI palette -> \\e[Nm\n";
for (30..37) {
print "\e[" . $_ . "m " . $_;
}
reset;
}
sub palette_16 {
print "ANSI palette -> \\e[Nm\n";
for (30..37) {
lib/ANSI/Palette.pm view on Meta::CPAN
}
print "\nANSI palette -> \\e[N;1m\n";
for (30..37) {
print "\e[" . $_ . ";1m " . $_;
}
reset;
}
sub palette_256 {
print "ANSI palette -> \\e[38;5;Nm\n";
for my $i (0..15) {
lib/ANSI/Palette.pm view on Meta::CPAN
my $code = $i * 16 + $j;
print "\e[38;5;" . $code . "m " . $code;
}
print "\n";
}
reset;
}
sub text_8 {
print "\e[" . $_[0] . "m" . $_[1];
reset();
}
sub text_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : "") . "m" . $_[2];
reset();
}
sub text_256 {
print "\e[38;5;" . $_[0] . "m" . $_[1];
reset();
}
sub bold_8 {
print "\e[" . $_[0] . ";1m" . $_[1];
reset();
}
sub bold_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ";1m" . $_[2];
reset();
}
sub bold_256 {
print "\e[38;5;" . $_[0] . ";1m" . $_[1];
reset();
}
sub underline_8 {
print "\e[" . $_[0] . ";4m" . $_[1];
reset();
}
sub underline_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : "") . ";4m" . $_[2];
reset();
}
sub underline_256 {
print "\e[38;5;" . $_[0] . ";4m" . $_[1];
reset();
}
sub italic_8 {
print "\e[" . $_[0] . ";3m" . $_[1];
reset();
}
sub italic_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : "") . ";3m" . $_[2];
reset();
}
sub italic_256 {
print "\e[38;5;" . $_[0] . ";3m" . $_[1];
reset();
}
sub background_text_8 {
print "\e[" . $_[0] . ";" . $_[1] . "m" . $_[2];
reset();
}
sub background_text_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ";" . $_[2] . "m" . $_[3];
reset();
}
sub background_text_256 {
print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . "m" . $_[2];
reset();
}
sub background_bold_8 {
print "\e[" . $_[0] . ";" . $_[1] . ";1m" . $_[2];
reset();
}
sub background_bold_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ";" . $_[2] . ";1m" . $_[3];
reset();
}
sub background_bold_256 {
print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . ";1m" . $_[2];
reset();
}
sub background_underline_8 {
print "\e[" . $_[0] . ";" . $_[1] . ";4m" . $_[2];
reset();
}
sub background_underline_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ';' . $_[2] . ";4m" . $_[3];
reset();
}
sub background_underline_256 {
print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . ";4m" . $_[2];
reset();
}
sub background_italic_8 {
print "\e[" . $_[0] . ";" . $_[1] . ";3m" . $_[2];
reset();
}
sub background_italic_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ";" . $_[2] . ";3m" . $_[3];
reset();
}
sub background_italic_256 {
print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . ";3m" . $_[2];
reset();
}
sub reset { print "\e[0m"; }
__END__
1;
lib/ANSI/Palette.pm view on Meta::CPAN
=head1 EXPORT
A list of functions that can be exported. You can delete this section
if you don't export anything, such as for a purely object-oriented module.
=head2 reset
=cut
=head2 palette_8
lib/ANSI/Palette.pm view on Meta::CPAN
=head1 BUGS
Please report any bugs or feature requests to C<bug-ansi-palette at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=ANSI-Palette>. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
view all matches for this distribution
view release on metacpan or search on metacpan
$screenname, $password);
$toc->connect();
=head1 DESCRIPTION
This module implements SFLAP, which I presume to be AOL's authenticiation
protocol, and TOC, which is the actual "meat" of the AIM protocol.
=head1 INTERFACE
=head2 connect
xjharding@newbedford.k12.ma.us cleaned it up and added DOC
james@foo.org was the original author
=head1 SEE ALSO
Net::AIM, a new module, but it doesn't have the features of this one
=cut
sub roast_password {
my ($password, $key) = @_;
($beautified_nick) = ($args =~ /^(.*)$/);
$toc->callback("NICK", $beautified_nick);
}
if ($cmd eq "IM_IN") {
($nickname, $autoresponse, $message) = ($args =~ /^(.*)\:(.*)\:(.*)$/);
$toc->callback("IM_IN", $nickname, $autoresponse, $message);
}
if ($cmd eq "UPDATE_BUDDY") {
($nickname, $online, $evil, $signon_time, $idle_time, $class) = ($args =~ /^(.*)\:(.*)\:(.*)\:(.*)\:(.*)\:(.*)$/);
$toc->callback("UPDATE_BUDDY", $nickname, $online, $evil, $signon_time, $idle_Time, $class);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AOLserver/CtrlPort.pm view on Meta::CPAN
To configure AOLserver's control port, use settings similar to the following
ones:
ns_section "ns/server/${servername}/module/nscp"
ns_param address myhostname
ns_param port 3334
ns_param echopassword 1
ns_param cpcmdlogging 1
ns_section "ns/server/${servername}/module/nscp/users"
lib/AOLserver/CtrlPort.pm view on Meta::CPAN
The port AOLserver is listening to for control port commands.
=item Host
The control port C<address> as defined in the configuration.
=item Timeout
Number of seconds after which the client will time out if the
server doesn't send a response.
=item User
User name for control port login defaults to the empty string
for non-protected control ports.
lib/AOLserver/CtrlPort.pm view on Meta::CPAN
}
=item $conn->send_cmds("$cmd1\ncmd2\n...")
Send one or more commands, separated by newlines, AOLserver's
control port. The method will return the server's response as a string.
Typically, this will look like
$out = $conn->send_cmds(<<EOT);
info tclversion
info commands
EOT
and return the newline-separated response as a single string.
=cut
############################################################
sub send_cmds {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Assembla.pm view on Meta::CPAN
sub get_space {
my ($self, $id) = @_;
my $req = $self->make_req('/spaces/'.$id);
my $resp = $self->_client->request($req);
# print STDERR $resp->decoded_content;
my $xp = XML::XPath->new(xml => $resp->decoded_content);
my $space = $xp->find('/space')->pop;
my $name = $space->findvalue('name')."";
return API::Assembla::Space->new(
lib/API/Assembla.pm view on Meta::CPAN
sub get_spaces {
my ($self) = @_;
my $req = $self->make_req('/spaces/my_spaces');
my $resp = $self->_client->request($req);
# print STDERR $resp->decoded_content;
my $xp = XML::XPath->new(xml => $resp->decoded_content);
my $spaces = $xp->find('/spaces/space');
my %objects = ();
foreach my $space ($spaces->get_nodelist) {
lib/API/Assembla.pm view on Meta::CPAN
sub get_ticket {
my ($self, $id, $number) = @_;
my $req = $self->make_req('/spaces/'.$id.'/tickets/'.$number);
my $resp = $self->_client->request($req);
# print STDERR $resp->decoded_content;
my $xp = XML::XPath->new(xml => $resp->decoded_content);
my $ticket = $xp->find('/ticket')->pop;
return API::Assembla::Ticket->new(
id => $ticket->findvalue('id').'',
lib/API/Assembla.pm view on Meta::CPAN
sub get_tickets {
my ($self, $id) = @_;
my $req = $self->make_req('/spaces/'.$id.'/tickets');
my $resp = $self->_client->request($req);
# print STDERR $resp->decoded_content;
my $xp = XML::XPath->new(xml => $resp->decoded_content);
my $tickets = $xp->find('/tickets/ticket');
my %objects = ();
foreach my $ticket ($tickets->get_nodelist) {
lib/API/Assembla.pm view on Meta::CPAN
version 0.03
=head1 UNDER CONSTRUCTION
API::Assembla is not feature-complete. It's a starting point. The Assembla
API has LOTS of stuff that this module does not yet contain. These features
will be added as needed by the author or as gifted by thoughtful folks who
write patches! ;)
=head1 SYNOPSIS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Basecamp.pm view on Meta::CPAN
# ABSTRACT: Basecamp.com API Client
package API::Basecamp;
use Data::Object::Class;
use Data::Object::Signatures;
use Data::Object::Library qw(
Str
);
lib/API/Basecamp.pm view on Meta::CPAN
# append path suffix
$url->path("@{[$url->path]}.json") if $url->path !~ /\.json$/;
}
method resource (@segments) {
# build new resource instance
my $instance = __PACKAGE__->new(
debug => $self->debug,
fatal => $self->fatal,
retries => $self->retries,
timeout => $self->timeout,
lib/API/Basecamp.pm view on Meta::CPAN
username => $self->username,
password => $self->password,
version => $self->version,
);
# resource locator
my $url = $instance->url;
# modify resource locator if possible
$url->path(join '/', $self->url->path, @segments);
# return resource instance
return $instance;
}
1;
lib/API/Basecamp.pm view on Meta::CPAN
$basecamp->debug(1);
$basecamp->fatal(1);
my $project = $basecamp->projects('605816632');
my $results = $project->fetch;
# after some introspection
$project->update( ... );
lib/API/Basecamp.pm view on Meta::CPAN
=head2 debug
$basecamp->debug;
$basecamp->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
$basecamp->fatal;
$basecamp->fatal(1);
The fatal attribute if true promotes 4xx and 5xx server response codes to
exceptions, a L<API::Client::Exception> object.
=head2 retries
$basecamp->retries;
$basecamp->retries(10);
The retries attribute determines how many times an HTTP request should be
retried if a 4xx or 5xx response is received. This attribute defaults to 0.
=head2 timeout
$basecamp->timeout;
$basecamp->timeout(5);
lib/API/Basecamp.pm view on Meta::CPAN
=head1 METHODS
=head2 action
my $result = $basecamp->action($verb, %args);
# e.g.
$basecamp->action('head', %args); # HEAD request
$basecamp->action('options', %args); # OPTIONS request
$basecamp->action('patch', %args); # PATCH request
The action method issues a request to the API resource represented by the
object. The first parameter will be used as the HTTP request method. The
arguments, expected to be a list of key/value pairs, will be included in the
request if the key is either C<data> or C<query>.
=head2 create
my $results = $basecamp->create(%args);
# or
$basecamp->POST(%args);
The create method issues a C<POST> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 delete
my $results = $basecamp->delete(%args);
# or
$basecamp->DELETE(%args);
The delete method issues a C<DELETE> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 fetch
my $results = $basecamp->fetch(%args);
# or
$basecamp->GET(%args);
The fetch method issues a C<GET> request to the API resource represented by the
object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 update
my $results = $basecamp->update(%args);
# or
$basecamp->PUT(%args);
The update method issues a C<PUT> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head1 RESOURCES
=head2 accesses
$basecamp->projects('605816632')->accesses;
The accesses method returns a new instance representative of the API
I<Accesses> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/accesses.md>.
=head2 attachments
$basecamp->attachments;
The attachments method returns a new instance representative of the API
I<Attachments> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/attachments.md>.
=head2 calendar_events
$basecamp->calendar_events;
The calendar_events method returns a new instance representative of the API
I<Calendar Events> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/calendar_events.md>.
=head2 calendars
$basecamp->calendars;
The calendars method returns a new instance representative of the API
I<Calendars> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/calendars.md>.
=head2 comments
$basecamp->projects('605816632')->comments;
The comments method returns a new instance representative of the API
I<Comments> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/comments.md>.
=head2 documents
$basecamp->documents;
The documents method returns a new instance representative of the API
I<Documents> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/documents.md>.
=head2 events
$basecamp->events;
The events method returns a new instance representative of the API
I<Events> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/events.md>.
=head2 groups
$basecamp->groups;
The groups method returns a new instance representative of the API
I<Groups> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/groups.md>.
=head2 messages
$basecamp->projects('605816632')->messages;
The messages method returns a new instance representative of the API
I<Messages> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/messages.md>.
=head2 people
$basecamp->people;
The people method returns a new instance representative of the API
I<People> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/people.md>.
=head2 project_templates
$basecamp->project_templates;
The project_templates method returns a new instance representative of the API
I<Project Templates> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/project_templates.md>.
=head2 projects
$basecamp->projects;
The projects method returns a new instance representative of the API
I<Projects> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/projects.md>.
=head2 stars
$basecamp->stars;
The stars method returns a new instance representative of the API
I<Stars> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/stars.md>.
=head2 todo_lists
$basecamp->todo_lists;
The todo_lists method returns a new instance representative of the API
I<Todo Lists> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/todolists.md>.
=head2 todos
$basecamp->projects('605816632')->todos;
The todos method returns a new instance representative of the API
I<Todos> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/todos.md>.
=head2 topics
$basecamp->topics;
The topics method returns a new instance representative of the API
I<Topics> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/topics.md>.
=head2 uploads
$basecamp->projects('605816632')->uploads;
The uploads method returns a new instance representative of the API
I<Uploads> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/uploads.md>.
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/BigBlueButton.pm view on Meta::CPAN
=head1 SYNOPSIS
use API::BigBlueButton;
my $bbb = API::BigBlueButton->new( server => 'bbb.myhost', secret => '1234567890' );
my $res = $bbb->get_version;
if ( $res->success ) {
my $version = $res->response->version
}
else {
warn "Error occured: " . $res->error . ", Status: " . $res->status;
}
=head1 DESCRIPTION
client for BigBlueButton API
lib/API/BigBlueButton.pm view on Meta::CPAN
%param:
server
Ip-address or hostname in which the server is located. Required parameter.
secret
Shared secret. Required parameter.
lib/API/BigBlueButton.pm view on Meta::CPAN
my $ua = LWP::UserAgent->new;
$ua->ssl_opts(verify_hostname => 0) if $self->{use_https};
$ua->timeout( $self->{ timeout } );
my $res = $ua->get( $url );
return API::BigBlueButton::Response->new( $res );
}
1;
__END__
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/CLI.pm view on Meta::CPAN
% githubcl GET /repos/:owner/:repo perlpunk API-CLI-p5
The generated help will show all methods, endpoints, parameters and
options.
Query parameters are represented as command line options starting with
C<--q->:
% metacpancl GET /pod/:module App::Spec --q-content-type text/x-pod
=head1 NAME
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/CPanel.pm view on Meta::CPAN
my $ip = $ip_list->[0];
my $dname = 'perlaround.ru';
my $user_name = 'user1';
my $client_creation_result = API::CPanel::user::create( {
%{ $connection_params },
username => $user_name,
password => 'user_password',
domain => $dname,
});
# Switch off account:
my $suspend_result = API::CPanel::user::disable( {
%{ $connection_params },
user => $user_name,
} );
unless ( $suspend_result ) {
die "Cannot suspend account";
}
# Switch on account
my $resume_result = API::CPanel::user::enable( {
%{ $connection_params },
user => $user_name,
} );
unless ( $resume_result ) {
die "Cannot resumeaccount";
}
# Delete account
my $delete_result = API::CPanel::user::delete( {
%{ $connection_params },
user => $user_name,
} );
unless ( $delete_result ) {
die "Cannot delete account";
}
=cut
lib/API/CPanel.pm view on Meta::CPAN
my $params = shift;
return '' unless $params &&
ref $params eq 'HASH' && %$params ;
my $result = join '&', map { "$_=$params->{$_}" } sort keys %$params;
warn $result if $DEBUG;
return $result;
}
# Kill slashes at start / end string
# STATIC(STRING:input_string)
sub kill_start_end_slashes {
lib/API/CPanel.pm view on Meta::CPAN
warn "Auth hash: $auth_hash\nQuery string: $query_string\n" if $DEBUG;
my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new( GET => $query_string );
$request->header( Authorization => $auth_hash );
my $response = $ua->request( $request );
my $content = $response->content;
if ($response->header('content-type') eq 'text/xml') {
warn $content if $DEBUG;
return $content;
} else {
return '';
}
lib/API/CPanel.pm view on Meta::CPAN
return '' unless $ref;
return ref $ref;
}
# INTERNAL!!! Check server answer result
# STATIC(data_block)
sub is_success {
my $data_block = shift;
my $want_hash = shift;
if ( $data_block &&
ref $data_block eq 'HASH' &&
(( $data_block->{status} &&
$data_block->{status} eq '1' ) ||
( $data_block->{result} &&
$data_block->{result} eq '1' ))
) {
return 1;
} else {
return $want_hash ? {} : '';
}
lib/API/CPanel.pm view on Meta::CPAN
# Abstract sub for action methods
sub action_abstract {
my %params = @_;
my $result = query_abstract(
params => $params{params},
func => $params{func},
container => $params{container},
allowed_fields => $params{allowed_fields},
);
return $params{want_hash} && is_success( $result, $params{want_hash} ) ? $result : is_success( $result );
}
# Abstract sub for fetch arrays
sub fetch_array_abstract {
my %params = @_;
my $result_field = $params{result_field} || '';
my $result_list = [ ];
my $result = query_abstract(
params => $params{params},
func => $params{func},
container => $params{container},
allowed_fields => $params{allowed_fields},
);
return $result_list unless $result;
$result = [ $result ] if ref $result ne 'ARRAY';
foreach my $elem ( @{ $result } ) {
push @$result_list, $result_field ? $elem->{$result_field} : $elem;
};
return $result_list;
}
# Abstract sub for fetch hash
sub fetch_hash_abstract {
my %params = @_;
my $result = query_abstract(
params => $params{params},
func => $params{func},
container => $params{container},
allowed_fields => $params{allowed_fields},
);
my $result_hash = {};
return $result_hash unless $params{key_field};
my $key_field = $params{key_field};
foreach my $each ( @$result ) {
$result_hash->{$each->{$key_field}} = $each;
}
return $result_hash;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Client.pm view on Meta::CPAN
}
method dispatch(Str :$method = 'get', Any %args) {
my $log = $self->logger->info("@{[uc($method)]} @{[$self->url->to_string]}");
my $result = $self->execute(%args, method => $method);
$log->end;
return $result;
}
method fetch(Any %args) {
return $self->dispatch(%args, method => 'get');
lib/API/Client.pm view on Meta::CPAN
method process(Object $ua, Object $tx, Any %args) {
return $self;
}
method resource(Str @segments) {
my $url;
if (@segments) {
$url = $self->url->clone;
lib/API/Client.pm view on Meta::CPAN
$ua->max_redirects(0);
$ua->connect_timeout($self->timeout);
$ua->request_timeout($self->timeout);
# transaction
my ($ok, $tx, $req, $res);
# times to retry failures
my $retries = $self->retries;
# transaction retry loop
for (my $i = 0; $i < ($retries || 1); $i++) {
# execute transaction
$tx = $ua->start($ua->build_tx($method, $url, $headers, @args));
$self->process($ua, $tx, %args);
# transaction objects
$req = $tx->req;
$res = $tx->res;
# determine success/failure
$ok = $res->code ? $res->code !~ /(4|5)\d\d/ : 0;
# log activity
if ($req && $res) {
my $log = $self->logger;
my $msg = join " ", "attempt", ("#".($i+1)), ": $method", $url->to_string;
$log->debug("req: $msg")->data({
request => $req->to_string =~ s/\s*$/\n\n\n/r
});
$log->debug("res: $msg")->data({
response => $res->to_string =~ s/\s*$/\n\n\n/r
});
# output to the console where applicable
$log->info("res: $msg [@{[$res->code]}]");
$log->output if $self->debug;
}
# no retry necessary
last if $ok;
}
# throw exception if fatal is truthy
if ($req && $res && $self->fatal && !$ok) {
my $code = $res->code;
$self->stash(tx => $tx);
$self->throw([$code, uc "${code}_http_response"]);
}
# return transaction
return $tx;
}
lib/API/Client.pm view on Meta::CPAN
use API::Client;
my $client = API::Client->new(url => 'https://httpbin.org');
# $client->resource('post');
# $client->update(json => {...});
=cut
lib/API/Client.pm view on Meta::CPAN
superclass, this module does not map specific HTTP requests to specific
routines, nor does it provide parameter validation, pagination, or other
conventions found in typical API client implementations; Instead, it simply
provides a simple and consistent mechanism for dynamically generating HTTP
requests. Additionally, this module has support for debugging and retrying API
calls as well as throwing exceptions when 4xx and 5xx server response codes are
returned.
=cut
=head1 INTEGRATES
lib/API/Client.pm view on Meta::CPAN
=head2 building
# given: synopsis
my $resource = $client->resource('get');
# GET /get
my $get = $client->resource('get')->dispatch;
# HEAD /head
my $head = $client->resource('head')->dispatch(
method => 'head'
);
# PATCH /patch
my $patch = $client->resource('patch')->dispatch(
method => 'patch'
);
[$get, $head, $patch]
Building up an HTTP request is extremely easy, simply call the L</resource> to
create a new object instance representing the API endpoint you wish to issue a
request against.
=cut
=head2 chaining
# given: synopsis
# https://httpbin.org/users
my $users = $client->resource('users');
# https://httpbin.org/users/c09e91a
my $user = $client->resource('users', 'c09e91a');
# https://httpbin.org/users/c09e91a
my $new_user = $users->resource('c09e91a');
[$users, $user, $new_user]
Because each call to L</resource> returns a new object instance configured with
a path (resource locator) based on the supplied parameters, reuse and request
isolation are made simple, i.e., you will only need to configure the client
once in your application.
=cut
=head2 creating
# given: synopsis
my $tx1 = $client->resource('post')->create(
json => {active => 1}
);
# is equivalent to
my $tx2 = $client->resource('post')->dispatch(
method => 'post',
json => {active => 1}
);
[$tx1, $tx2]
This example illustrates how you might create a new API resource.
=cut
=head2 deleting
# given: synopsis
my $tx1 = $client->resource('delete')->delete(
json => {active => 1}
);
# is equivalent to
my $tx2 = $client->resource('delete')->dispatch(
method => 'delete',
json => {active => 1}
);
[$tx1, $tx2]
This example illustrates how you might delete a new API resource.
=cut
=head2 fetching
# given: synopsis
my $tx1 = $client->resource('get')->fetch(
query => {active => 1}
);
# is equivalent to
my $tx2 = $client->resource('get')->dispatch(
method => 'get',
query => {active => 1}
);
[$tx1, $tx2]
This example illustrates how you might fetch an API resource.
=cut
=head2 subclassing
lib/API/Client.pm view on Meta::CPAN
my $hookbin = Hookbin->new;
This package was designed to be subclassed and provides hooks into the client
building and request dispatching processes. Specifically, there are three
useful hooks (i.e. methods, which if present are used to build up the client
object and requests), which are, the C<auth> hook, which should return a
C<Tuple[Str, Str]> which is used to configure the basic auth header, the
C<base> hook which should return a C<Tuple[Str]> which is used to configure the
base URL, and the C<headers> hook, which should return a
C<ArrayRef[Tuple[Str, Str]]> which are used to configure the HTTP request
lib/API/Client.pm view on Meta::CPAN
=head2 transacting
# given: synopsis
my $tx1 = $client->resource('patch')->patch(
json => {active => 1}
);
# is equivalent to
my $tx2 = $client->resource('patch')->dispatch(
method => 'patch',
json => {active => 1}
);
[$tx1, $tx2]
An HTTP request is only issued when the L</dispatch> method is called, directly
or indirectly. Those calls return a L<Mojo::Transaction> object which provides
access to the C<request> and C<response> objects.
=cut
=head2 updating
# given: synopsis
my $tx1 = $client->resource('put')->update(
json => {active => 1}
);
# is equivalent to
my $tx2 = $client->resource('put')->dispatch(
method => 'put',
json => {active => 1}
);
[$tx1, $tx2]
This example illustrates how you might update a new API resource.
=cut
=head1 ATTRIBUTES
lib/API/Client.pm view on Meta::CPAN
=head2 create
create(Any %args) : InstanceOf["Mojo::Transaction"]
The create method issues a C<POST> request to the API resource represented by
the object.
=over 4
=item create example #1
# given: synopsis
$client->resource('post')->create(
json => {active => 1}
);
=back
lib/API/Client.pm view on Meta::CPAN
=head2 delete
delete(Any %args) : InstanceOf["Mojo::Transaction"]
The delete method issues a C<DELETE> request to the API resource represented by
the object.
=over 4
=item delete example #1
# given: synopsis
$client->resource('delete')->delete;
=back
=cut
=head2 dispatch
dispatch(Str :$method = 'get', Any %args) : InstanceOf["Mojo::Transaction"]
The dispatch method issues a request to the API resource represented by the
object.
=over 4
=item dispatch example #1
# given: synopsis
$client->resource('get')->dispatch;
=back
=over 4
=item dispatch example #2
# given: synopsis
$client->resource('post')->dispatch(
method => 'post', body => 'active=1'
);
=back
lib/API/Client.pm view on Meta::CPAN
=item dispatch example #3
# given: synopsis
$client->resource('get')->dispatch(
method => 'get', query => {active => 1}
);
=back
lib/API/Client.pm view on Meta::CPAN
=item dispatch example #4
# given: synopsis
$client->resource('post')->dispatch(
method => 'post', json => {active => 1}
);
=back
lib/API/Client.pm view on Meta::CPAN
=item dispatch example #5
# given: synopsis
$client->resource('post')->dispatch(
method => 'post', form => {active => 1}
);
=back
lib/API/Client.pm view on Meta::CPAN
=item dispatch example #6
# given: synopsis
$client->resource('put')->dispatch(
method => 'put', json => {active => 1}
);
=back
lib/API/Client.pm view on Meta::CPAN
=item dispatch example #7
# given: synopsis
$client->resource('patch')->dispatch(
method => 'patch', json => {active => 1}
);
=back
lib/API/Client.pm view on Meta::CPAN
=item dispatch example #8
# given: synopsis
$client->resource('delete')->dispatch(
method => 'delete', json => {active => 1}
);
=back
lib/API/Client.pm view on Meta::CPAN
=head2 fetch
fetch(Any %args) : InstanceOf["Mojo::Transaction"]
The fetch method issues a C<GET> request to the API resource represented by the
object.
=over 4
=item fetch example #1
# given: synopsis
$client->resource('get')->fetch;
=back
=cut
=head2 patch
patch(Any %args) : InstanceOf["Mojo::Transaction"]
The patch method issues a C<PATCH> request to the API resource represented by
the object.
=over 4
=item patch example #1
# given: synopsis
$client->resource('patch')->patch(
json => {active => 1}
);
=back
lib/API/Client.pm view on Meta::CPAN
=head2 process
process(Object $ua, Object $tx, Any %args) : Object
The process method acts as an C<after> hook triggered after each response where
you can modify the transactor objects.
=over 4
=item process example #1
lib/API/Client.pm view on Meta::CPAN
=back
=cut
=head2 resource
resource(Str @segments) : Object
The resource method returns a new instance of the object for the API resource
endpoint specified.
=over 4
=item resource example #1
# given: synopsis
$client->resource('status', 200);
=back
=cut
lib/API/Client.pm view on Meta::CPAN
=head2 update
update(Any %args) : InstanceOf["Mojo::Transaction"]
The update method issues a C<PUT> request to the API resource represented by
the object.
=over 4
=item update example #1
# given: synopsis
$client->resource('put')->update(
json => {active => 1}
);
=back
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/DeutscheBahn/Fahrplan.pm view on Meta::CPAN
sub _request {
my ( $self, $name, %args ) = @_;
my ( $method, $uri ) = $self->_create_uri( $name, %args );
my $response = $self->_client->$method($uri);
return JSON::XS::decode_json $response->{content};
}
sub _create_uri {
my ( $self, $name, %args ) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/DirectAdmin.pm view on Meta::CPAN
return '' unless ref $params eq 'HASH' && scalar keys %$params;
my %params = %$params;
my $result = join '&', map { "$_=$params{$_}" } sort keys %params;
return $result;
}
# Get + deparse
# STATIC(STRING: query_string)
sub process_query {
lib/API/DirectAdmin.pm view on Meta::CPAN
my $content;
my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new( $method, $url );
if ( $method eq 'GET' ) {
my $response = $ua->request( $request );
$content = $response->content;
}
else { # Temporary URL for making request
my $temp_uri = URI->new('http:');
$temp_uri->query_form( $params );
$request->content( $temp_uri->query );
$request->content_type('application/x-www-form-urlencoded');
my $response = $ua->request($request);
$content = $response->content;
}
warn "Answer: " . $content if $self->{debug};
return $content if $params->{noparse};
return $self->parse_answer($content);
}
# Parse answer
sub parse_answer {
my ($self, $response) = @_;
return '' unless $response;
my %answer;
$response =~ s/<br>|&#\d+//ig; # Some trash from answer
$response =~ s/\n+/\n/ig;
my @params = split /&/, $response;
foreach my $param ( @params ) {
my ($key, $value) = split /=/, $param;
if ( $key =~ /(.*)\[\]/ ) { # lists
push @{ $answer{$1} }, $value;
lib/API/DirectAdmin.pm view on Meta::CPAN
my $dname = 'reg.ru';
my $user_name = 'user1';
my $email = 'user1@example.com';
my $package = 'newpackage';
my $client_creation_result = $da->user->create( {
username => $user_name,
passwd => 'user_password',
passwd2 => 'user_password',
domain => $dname,
email => $email,
package => $package,
ip => $ip,
});
# Switch off account:
my $suspend_result = $da->user->disable( {
select0 => $user_name,
} );
if ( $suspend_result->{error} == 1 ) {
die "Cannot suspend account $suspend_result->{text}";
}
# Switch on account
my $resume_result = $da->user->enable( {
select0 => $user_name,
} );
if ( $resume_result->{error} == 1 ) {
die "Cannot Resume account $resume_result->{text}";
}
# Delete account
my $delete_result = $da->user->delete( {
select0 => $user_name,
} );
if ( $delete_result->{error} == 1 ) {
die "Cannot delete account $delete_result->{text}";
}
# Custom request
my %params = (
action => 'package',
package => 'package_name',
user => 'username',
);
my $responce = $da->query(
command => 'CMD_API_MODIFY_USER',
method => 'POST',
params => \%params,
allowed_fields => 'action
package
lib/API/DirectAdmin.pm view on Meta::CPAN
Create a new user in DirectAdmin panel.
Example:
my $result = $da->user->create( {
username => 'username',
passwd => 'user_password',
passwd2 => 'user_password',
domain => 'example.com',
email => 'email@example.com',
lib/API/DirectAdmin.pm view on Meta::CPAN
Note: Some DirectAdmin's API methods required parameter "select0" for choose value from list. Like list of users, databases, ip, etc.
Example:
my $result = $da->user->delete( {
select0 => 'username',
} );
=item disable/enable
Two different methods for disable and enable users with same params.
Example:
my $disable_result = $da->user->disable( {
select0 => 'username',
} );
my $enable_result = $da->user->enable( {
select0 => 'username',
} );
=item change_password
Change password for user
Example:
my $result = $da->user->change_password( {
username => 'username',
passwd => 'new_password',
passwd2 => 'new_password',
} );
lib/API/DirectAdmin.pm view on Meta::CPAN
Change package (tariff plan) for user
Example:
my $result = $da->user->change_package( {
username => 'username',
package => 'new_package',
} );
=item show_packages
Return list of available packages.
Note: If you created packages through administrator user - you must use admin's login and password for authorisation. Obviously, if packages was created by reseller user - use reseller authorisation.
Example:
my $packages = $da->user->show_packages();
lib/API/DirectAdmin.pm view on Meta::CPAN
);
# init
my $da = API::DirectAdmin->new(%auth);
$result = $da->domain->add({
domain => 'newdomain.com',
php => 'ON',
cgi => 'ON',
});
lib/API/DirectAdmin.pm view on Meta::CPAN
);
# init
my $da = API::DirectAdmin->new(%auth);
my $result = $da->mysql->adddb( {
name => 'default', # will be 'customer_default'
user => 'default', # will be 'customer_default'
passwd => 'password',
passwd2 => 'password',
} );
lib/API/DirectAdmin.pm view on Meta::CPAN
Delete selected database from user.
Example:
my $result = $da->mysql->deldb({ select0 => 'database_name' });
=back
=head2 API::DirectAdmin::Ip
=over
=item list
Return array reference of list ip adresses;
Example:
my $ip_list = $da->ip->list();
=item add
Add IP address to server config
Example:
my $result = $da->ip->add({
ip => '123.234.123.234',
status => 'server',
});
=item remove
Remove ip from server
Example:
my $result = $da->ip->remove({
select0 => '123.234.123.234',
});
=back
lib/API/DirectAdmin.pm view on Meta::CPAN
Add zone record to dns for domain. Available types of records: A, AAAA, NS, MX, TXT, PTR, CNAME, SRV
Example:
my $result = $da->dns->add_record({
domain => 'domain.com',
type => 'A',
name => 'subdomain', # will be "subdomain.domain.com." in record
value => '127.127.127.127',
});
Example with MX record:
my $result = $da->dns->add_record( {
domain => 'domain.com',
type => 'MX',
name => 'mx1',
value => 10,
} );
lib/API/DirectAdmin.pm view on Meta::CPAN
Remove record from domain zone
Example:
my $result = $da->dns->remove_record({
domain => 'domain.com',
type => 'A',
name => 'subdomain',
value => '127.127.127.127',
});
Example with MX record:
my $result = $da->dns->remove_record({
domain => 'domain.com',
type => 'mx',
name => 'mx1',
value => 10,
});
lib/API/DirectAdmin.pm view on Meta::CPAN
make test
make install
=head1 DEPENDENCIES
This module requires these other modules and libraries:
Modern::Perl
LWP::UserAgent
HTTP::Request
URI
Carp
view all matches for this distribution
view release on metacpan or search on metacpan
bin/drip_client.pl view on Meta::CPAN
=item B<addsub>
Add a subscriber. At a minimum, must also specify -email, or -id.
Accepts: -email, -id, -new_email, -user_id, -time_zone, -lifetime_value, -ip_address
=item B<delsub>
Delete a subscriber. Must specify -email, or -id.
bin/drip_client.pl view on Meta::CPAN
=item B<startwork>
Start a user on a workflow
Requires: -workflow
Accepts: -email, -id, -user_id, -time_zone, -prospect
=item B<event>
Record that an event happened.
Requires: -email or -id, -action
Accepts: -prospect
=back
=head2 Additional Parameters
The parameters B<-email>, B<-id>, B<-new_email>, B<-user_id>, B<-time_zone>,
B<-lifetime_vaule>, B<-ip_address>, B<-prospect>, B<-action> are documented at
L<https://www.getdrip.com/docs/rest-api> and may be used with the above
operations.
=over
=item B<workflow>
bin/drip_client.pl view on Meta::CPAN
'man',
'verbose|verb|v+',
'conf=s',
'addsub', 'getsub', 'delsub', 'getwork', 'startwork', 'event',
'workflow=i', 'action=s',
'email=s', 'id=s', 'new_email=s', 'user_id=s', 'time_zone=s', 'lifetime_vaule=i', 'ip_address=s', 'prospect'
) or pod2usage(2);
pod2usage(1) if $OPT{help};
pod2usage(-exitval => 0, -verbose => 2) if $OPT{man};
p %OPT if $OPT{verbose};
bin/drip_client.pl view on Meta::CPAN
$OPT{email} or $OPT{id} or pod2usage( "Either -email or -id is required for -event" );
$OPT{action} or pod2usage( "-action is required for -event" );
my $content = _build_hash( %OPT, keys => [qw(email id action prospect)] );
my $result = $client->do_request( POST => 'events', { events => [ $content ] } );
p $result;
}
sub get_workflows {
my %OPT = @_;
my $result = $client->do_request( GET => 'workflows' );
p $result;
}
sub start_workflow {
my %OPT = @_;
bin/drip_client.pl view on Meta::CPAN
my $subscriber = _build_hash( %OPT, keys => [qw( email id user_id time_zone prospect )] );
my $endpoint = 'workflows/' . $OPT{workflow} . '/subscribers';
my $result = $client->do_request( POST => $endpoint, { subscribers => [ $subscriber ] } );
p $result;
}
sub delete_subscribers {
my %OPT = @_;
my $id = $OPT{email} || $OPT{id};
die "email or id required in delete subscriber" unless $id;
my $result = $client->do_request( DELETE => "subscribers/$id" );
p $result;
}
sub add_subscribers {
my %OPT = @_;
my $subscriber = _build_hash( %OPT, keys => [qw( email id new_email user_id time_zone lifetime_value ip_address )] );
die "email or id required in add subscriber" unless $subscriber->{email} or $subscriber->{id};
my $result = $client->do_request( POST => 'subscribers', { subscribers => [ $subscriber ]});
p $result;
}
sub _build_hash {
my %OPT = @_;
my $build = {};
bin/drip_client.pl view on Meta::CPAN
}
return $build;
}
sub get_subscribers {
my $result = $client->do_request( GET => 'subscribers' );
p $result;
}
view all matches for this distribution
view release on metacpan or search on metacpan
examples/edw/Rest.pl view on Meta::CPAN
query => $query
);
# get local IP
if ( !defined $h_setup{ip} || !length $h_setup{ip} ) {
my $response = HTTP::Tiny->new->get('http://monip.org/');
unless ( $response->{success} ) {
print STDERR "\tunable to reach external network to get IP address.\n";
exit(1);
}
($h_setup{ip}) = ($response->{content} =~ /IP\s:\s(\d+\.\d+\.\d+\.\d+)/gm);
}
foreach my $p ( qw/ grid ip token site query / ) {
if ( !defined $h_setup{$p} || !length $h_setup{$p} ) {
print STDERR "\tmissing $p parameter, check help.\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Facebook.pm view on Meta::CPAN
# ABSTRACT: Facebook.com API Client
package API::Facebook;
use Data::Object::Class;
use Data::Object::Signatures;
use Data::Object::Library qw(
Str
);
lib/API/Facebook.pm view on Meta::CPAN
# access token parameter
$url->query->merge(access_token => $self->access_token) if $self->access_token;
}
method resource (@segments) {
# build new resource instance
my $instance = __PACKAGE__->new(
access_token => $self->access_token,
debug => $self->debug,
fatal => $self->fatal,
retries => $self->retries,
lib/API/Facebook.pm view on Meta::CPAN
identifier => $self->identifier,
version => $self->version,
);
# resource locator
my $url = $instance->url;
# modify resource locator if possible
$url->path(join '/', $self->url->path, @segments);
# return resource instance
return $instance;
}
1;
lib/API/Facebook.pm view on Meta::CPAN
$facebook->debug(1);
$facebook->fatal(1);
my $feed = $facebook->me('feed');
my $results = $feed->fetch;
# after some introspection
$feed->update( ... );
lib/API/Facebook.pm view on Meta::CPAN
=head2 debug
$facebook->debug;
$facebook->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
$facebook->fatal;
$facebook->fatal(1);
The fatal attribute if true promotes 4xx and 5xx server response codes to
exceptions, a L<API::Client::Exception> object.
=head2 retries
$facebook->retries;
$facebook->retries(10);
The retries attribute determines how many times an HTTP request should be
retried if a 4xx or 5xx response is received. This attribute defaults to 1.
=head2 timeout
$facebook->timeout;
$facebook->timeout(5);
lib/API/Facebook.pm view on Meta::CPAN
=head1 METHODS
=head2 action
my $result = $facebook->action($verb, %args);
# e.g.
$facebook->action('head', %args); # HEAD request
$facebook->action('options', %args); # OPTIONS request
$facebook->action('patch', %args); # PATCH request
The action method issues a request to the API resource represented by the
object. The first parameter will be used as the HTTP request method. The
arguments, expected to be a list of key/value pairs, will be included in the
request if the key is either C<data> or C<query>.
=head2 create
my $results = $facebook->create(%args);
# or
$facebook->POST(%args);
The create method issues a C<POST> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 delete
my $results = $facebook->delete(%args);
# or
$facebook->DELETE(%args);
The delete method issues a C<DELETE> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 fetch
my $results = $facebook->fetch(%args);
# or
$facebook->GET(%args);
The fetch method issues a C<GET> request to the API resource represented by the
object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 update
my $results = $facebook->update(%args);
# or
$facebook->PUT(%args);
The update method issues a C<PUT> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head1 RESOURCES
=head2 achievement
$facebook->resource(param('achievement'));
The achievement resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/achievement>.
=head2 achievement_type
$facebook->resource(param('achievement_type'));
The achievement_type resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/achievement_type>.
=head2 ad_campaign
$facebook->resource(param('ad-campaign'));
The ad_campaign resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/marketing-api/reference/ad-campaign>.
=head2 ad_campaign_group
$facebook->resource(param('ad-campaign-group'));
The ad_campaign_group resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group>.
=head2 ad_image
$facebook->resource(param('ad-image'));
The ad_image resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/marketing-api/reference/ad-image>.
=head2 ad_label
$facebook->resource(param('ad-label'));
The ad_label resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/marketing-api/reference/ad-label>.
=head2 app_request
$facebook->resource(param('app-request'));
The app_request resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/app-request>.
=head2 application
$facebook->resource(param('application'));
The application resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/application>.
=head2 application_context
$facebook->resource(param('application-context'));
The application_context resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/application-context>.
=head2 friend_list
$facebook->resource(param('friend-list'));
The friend_list resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/friend-list>.
=head2 hashtag
$facebook->resource(param('hashtag'));
The hashtag resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/hashtag>.
=head2 life_event
$facebook->resource(param('life-event'));
The life_event resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/life-event>.
=head2 mailing_address
$facebook->resource(param('mailing-address'));
The mailing_address resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/mailing-address>.
=head2 offsite_pixel
$facebook->resource(param('offsite-pixel'));
The offsite_pixel resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/offsite-pixel>.
=head2 open_graph_context
$facebook->resource(param('open-graph-context'));
The open_graph_context resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/open-graph-context>.
=head2 page
$facebook->resource(param('page'));
The page resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/page>.
=head2 photo
$facebook->resource(param('photo'));
The photo resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/photo>.
=head2 place_tag
$facebook->resource(param('place-tag'));
The place_tag resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/place-tag>.
=head2 product_catalog
$facebook->resource(param('product-catalog'));
The product_catalog resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/marketing-api/reference/product-catalog>.
=head2 product_feed
$facebook->resource(param('product-feed'));
The product_feed resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/product-feed>.
=head2 product_feed_upload
$facebook->resource(param('product-feed-upload'));
The product_feed_upload resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/product-feed-upload>.
=head2 product_feed_upload_error
$facebook->resource(param('product-feed-upload-error'));
The product_feed_upload_error resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/product-feed-upload-error>.
=head2 product_group
$facebook->resource(param('product-group'));
The product_group resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/product-group>.
=head2 product_item
$facebook->resource(param('product-item'));
The product_item resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/product-item>.
=head2 product_set
$facebook->resource(param('product-set'));
The product_set resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/product-set>.
=head2 promotion_info
$facebook->resource(param('promotion-info'));
The promotion_info resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/promotion-info>.
=head2 user
$facebook->resource(param('user'));
The user resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/user>.
=head2 user_context
$facebook->resource(param('user-context'));
The user_context resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/user-context>.
=head2 video
$facebook->resource(param('video'));
The video resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/video>.
=head2 video_broadcast
$facebook->resource(param('video-broadcast'));
The video_broadcast resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/video-broadcast>.
=head2 video_list
$facebook->resource(param('video-list'));
The video_list resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/video-list>.
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/GitForge.pm view on Meta::CPAN
=head1 FUNCTIONS
=head2 new_from_domain domain => $domain, access_key => $key
Instantiate an object representing the GitForge at C<$domain> which
does L<API::GitForge::Role::GitForge>. This function will only
succeed for known forges; see C<%API::GitForge::known_forges>. The
C<access_key> argument is optional; if present, it should be an API
key for the forge.
$API::GitForge::known_forges{"ourlab.com"} = "API::GitForge::GitLab";
my $ourlab = API::GitForge::new_from_domain(
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Github.pm view on Meta::CPAN
# ABSTRACT: Github.com API Client
package API::Github;
use Data::Object::Class;
use Data::Object::Signatures;
use Data::Object::Library qw(
Str
);
lib/API/Github.pm view on Meta::CPAN
return $self;
}
method resource (@segments) {
# build new resource instance
my $instance = __PACKAGE__->new(
debug => $self->debug,
fatal => $self->fatal,
retries => $self->retries,
timeout => $self->timeout,
lib/API/Github.pm view on Meta::CPAN
username => $self->username,
token => $self->token,
version => $self->version,
);
# resource locator
my $url = $instance->url;
# modify resource locator if possible
$url->path(join '/', $self->url->path, @segments);
# return resource instance
return $instance;
}
1;
lib/API/Github.pm view on Meta::CPAN
$github->debug(1);
$github->fatal(1);
my $user = $github->users('h@x0r');
my $results = $user->fetch;
# after some introspection
$user->update( ... );
lib/API/Github.pm view on Meta::CPAN
=head2 debug
$github->debug;
$github->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
$github->fatal;
$github->fatal(1);
The fatal attribute if true promotes 4xx and 5xx server response codes to
exceptions, a L<API::Client::Exception> object.
=head2 retries
$github->retries;
$github->retries(10);
The retries attribute determines how many times an HTTP request should be
retried if a 4xx or 5xx response is received. This attribute defaults to 0.
=head2 timeout
$github->timeout;
$github->timeout(5);
lib/API/Github.pm view on Meta::CPAN
=head1 METHODS
=head2 action
my $result = $github->action($verb, %args);
# e.g.
$github->action('head', %args); # HEAD request
$github->action('options', %args); # OPTIONS request
$github->action('patch', %args); # PATCH request
The action method issues a request to the API resource represented by the
object. The first parameter will be used as the HTTP request method. The
arguments, expected to be a list of key/value pairs, will be included in the
request if the key is either C<data> or C<query>.
=head2 create
my $results = $github->create(%args);
# or
$github->POST(%args);
The create method issues a C<POST> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 delete
my $results = $github->delete(%args);
# or
$github->DELETE(%args);
The delete method issues a C<DELETE> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 fetch
my $results = $github->fetch(%args);
# or
$github->GET(%args);
The fetch method issues a C<GET> request to the API resource represented by the
object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 update
my $results = $github->update(%args);
# or
$github->PUT(%args);
The update method issues a C<PUT> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head1 RESOURCES
=head2 emojis
$github->emojis;
The emojis method returns a new instance representative of the API
I<emojis> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/emojis>.
=head2 events
$github->events;
The events method returns a new instance representative of the API
I<events> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/activity/events>.
=head2 feeds
$github->feeds;
The feeds method returns a new instance representative of the API
I<feeds> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/activity/feeds>.
=head2 gists
$github->gists;
The gists method returns a new instance representative of the API
I<gists> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/gists>.
=head2 gitignore
$github->gitignore;
The gitignore method returns a new instance representative of the API
I<gitignore> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/gitignore>.
=head2 issues
$github->issues;
The issues method returns a new instance representative of the API
I<issues> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/issues>.
=head2 licenses
$github->licenses;
The licenses method returns a new instance representative of the API
I<licenses> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/licenses>.
=head2 markdown
$github->markdown;
The markdown method returns a new instance representative of the API
I<markdown> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/markdown>.
=head2 meta
$github->meta;
The meta method returns a new instance representative of the API
I<meta> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/meta>.
=head2 notifications
$github->notifications;
The notifications method returns a new instance representative of the API
I<notifications> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/activity/notifications>.
=head2 orgs
$github->orgs;
The orgs method returns a new instance representative of the API
I<orgs> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/orgs>.
=head2 rate_limit
$github->rate_limit;
The rate_limit method returns a new instance representative of the API
I<rate_limit> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/rate_limit>.
=head2 repos
$github->repos;
The repos method returns a new instance representative of the API
I<repos> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/repos>.
=head2 search
$github->search;
The search method returns a new instance representative of the API
I<search> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/search>.
=head2 users
$github->users;
The users method returns a new instance representative of the API
I<users> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.github.com/v3/users>.
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Google.pm view on Meta::CPAN
} else {
die 'no json file specified!';
}
$h->{ua} = Mojo::UserAgent->new();
$h->{debug} = $params->{debug};
$h->{max_refresh_attempts} = $params->{max_refresh_attempts} || 5;
return bless $h, $class;
}
sub refresh_access_token {
my ($self, $params) = @_;
warn "Attempt to refresh access_token with params: ".Dumper $params if $self->{debug};
$params->{grant_type} = 'refresh_token';
$self->{ua}->post('https://www.googleapis.com/oauth2/v4/token' => form => $params)->res->json; # tokens
};
sub client_id {
shift->{tokensfile}->get('gapi/client_id');
lib/API/Google.pm view on Meta::CPAN
shift->{tokensfile}->get('gapi/client_secret');
}
sub refresh_access_token_silent {
my ($self, $user) = @_;
my $tokens = $self->refresh_access_token({
client_id => $self->client_id,
client_secret => $self->client_secret,
refresh_token => $self->get_refresh_token_from_storage($user)
});
warn "New tokens got" if $self->{debug};
my $res = {};
$res->{old} = $self->get_access_token_from_storage($user);
warn Dumper $tokens if $self->{debug};
if ($tokens->{access_token}) {
$self->set_access_token_to_storage($user, $tokens->{access_token});
}
$res->{new} = $self->get_access_token_from_storage($user);
return $res;
};
sub get_refresh_token_from_storage {
my ($self, $user) = @_;
warn "get_refresh_token_from_storage(".$user.")" if $self->{debug};
return $self->{tokensfile}->get('gapi/tokens/'.$user.'/refresh_token');
};
sub get_access_token_from_storage {
my ($self, $user) = @_;
$self->{tokensfile}->get('gapi/tokens/'.$user.'/access_token');
lib/API/Google.pm view on Meta::CPAN
$payload = { payload => $payload };
%$params = (%$params, %$payload);
my $tx = $self->build_http_transaction($params);
my $res = $self->{ua}->start($tx)->res->json;
# for future:
# if ( grep { $_->{message} eq 'Invalid Credentials' && $_->{reason} eq 'authError'} @{$res->{error}{errors}} ) { ... }
warn "First api_query() result : ".Dumper $res if $self->{debug};
if (defined $res->{error}) { # token expired error handling
my $attempt = 1;
while ($res->{error}{message} eq 'Invalid Credentials') {
if ($attempt == $self->{max_refresh_attempts}) {
last;
}
warn "Seems like access_token was expired. Attemptimg update it automatically ..." if $self->{debug};
$self->refresh_access_token_silent($params->{user});
$tx = $self->build_http_transaction($params);
$res = $self->{ua}->start($tx)->res->json;
$attempt++;
}
if ($attempt > 1) {
warn "access_token was automatically refreshed";
}
}
return $res;
};
1;
lib/API/Google.pm view on Meta::CPAN
=head1 SYNOPSIS
use API::Google;
my $gapi = API::Google->new({ tokensfile => 'config.json' });
$gapi->refresh_access_token_silent('someuser@gmail.com');
$gapi->api_query({
method => 'post',
route => 'https://www.googleapis.com/calendar/v3/calendars/'.$calendar_id.'/events',
user => 'someuser@gmail.com'
lib/API/Google.pm view on Meta::CPAN
{
"client_id": "001122334455-abcdefghijklmnopqrstuvwxyz012345.apps.googleusercontent.com",
"client_secret": "1ayL76NlEKjj85eZOipFZkyM",
"tokens": {
"email_1@gmail.com": {
"refresh_token": "1/cI5jWSVnsUyCbasCQpDmz8uhQyfnWWphxvb1ST3oTHE",
"access_token": "ya29.Ci-KA8aJYEAyZoxkMsYbbU9H_zj2t9-7u1aKUtrOtak3pDhJvCEPIdkW-xg2lRQdrA"
},
"email_2@gmail.com": {
"access_token": "ya29.Ci-KAzT9JpaPriZ-ugON4FnANBXZexTZOz-E6U4M-hjplbIcMYpTbo0AmGV__tV5FA",
"refresh_token": "1/_37lsRFSRaUJkAAAuJIRXRUueft5eLWaIsJ0lkJmEMU"
}
}
}
}
=head1 SUBROUTINES/METHODS
=head2 refresh_access_token_silent
Get new access token for user from Google API server and store it in jsonfile
=head2 build_headers
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Handle.pm view on Meta::CPAN
$args{content} ||= $args{data} ||= $args{body};
$args{method} ||= $args{type};
$args{uri} ||= $self->_join_uri( $args{path} );
# Preserve hash order. Maybe needed for SOAP.
if ( defined $args{content} and (
( ref $args{content} eq 'ARRAY' ) or # Deprecated - backwards compatibility
( ref $args{content} eq 'REF' and ref ${ $args{content} } eq 'ARRAY' ) # New style ? => \[]
)
) {
lib/API/Handle.pm view on Meta::CPAN
# Leave it up to the API implementation to encode the hash/array ref into JSON / Form data / XML / etc.
$req->content( $args{content} ) if defined $args{content};
$req->method( $args{method} ) if defined $args{method};
$req->uri( $args{uri} );
my $res = $self->ua->request( $req );
return wantarray ? ( $res, $req ) : $res;
}
sub db {
my ( $self, @args ) = @_;
$self->_database->switch_to( @args ) if @args;
lib/API/Handle.pm view on Meta::CPAN
version 0.02
=head3 _tied
Recursively tie \[ key => $val, key => $val, ... ] data to create preserved-order hashes ( needed for SOAP ).
=head1 AUTHOR
Nour Sharabash <amirite@cpan.org>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/INSEE/Sirene.pm view on Meta::CPAN
numvoie => 'numeroVoieEtablissement',
typevoie => 'typeVoieEtablissement',
nomvoie => 'libelleVoieEtablissement',
codePostal => 'codePostalEtablissement',
nomCommune => 'libelleCommuneEtablissement',
adresseComplete => [
'numeroVoieEtablissement',
'typeVoieEtablissement', 'libelleVoieEtablissement',
'codePostalEtablissement', 'libelleCommuneEtablissement'
],
};
sub new {
my $class = shift;
my ($credentials, $timeout, $max_results, $proxy) = @_;
my $self = bless {
credentials => $credentials,
user_agent => undef,
token_expiration => undef,
max_results => undef,
debug_mode => 0,
current_endpoint => undef,
}, $class;
$self->_initUserAgent();
$self->setProxy($proxy);
$self->setMaxResults($max_results);
$self->setTimeout($timeout);
return $self;
}
lib/API/INSEE/Sirene.pm view on Meta::CPAN
$self->{'credentials'} = $credentials;
}
sub setMaxResults {
my ($self, $max_results) = @_;
$max_results //= DEFAULT_MAX_RESULTS;
$self->{'max_results'} = $max_results > HARD_MAX_RESULTS ? HARD_MAX_RESULTS : $max_results;
}
sub setDebugMode {
my ($self, $debug_value) = @_;
lib/API/INSEE/Sirene.pm view on Meta::CPAN
$self->{'current_endpoint'} = $endpoint;
}
sub _dumpRequest {
my ($self, $request, $response) = @_;
my $dump = sprintf "Sent request:\n%s\n", $request->as_string;
$dump .= sprintf "Received response:\n%s\n", $response->as_string if defined $response;
return $dump;
}
sub _initUserAgent {
lib/API/INSEE/Sirene.pm view on Meta::CPAN
my $request = POST API_AUTH_URL,
Authorization => "Basic $self->{'credentials'}",
Content => [ grant_type => 'client_credentials' ];
my $response = $self->{'user_agent'}->request($request);
my $json_obj;
if ($response->content_type =~ m/^application\/json/) {
$json_obj = decode_json($response->content);
}
else {
return 1, $self->_dumpRequest($request, $response); # the API may return xml intead of json...
}
switch ($response->code) {
case HTTP_OK {
$self->{'token_expiration'} = time + $json_obj->{'expires_in'};
$self->{'user_agent'}->default_header( Authorization => "Bearer $json_obj->{'access_token'}" );
return 0;
}
case HTTP_UNAUTHORIZED { # wrong credentials
return 1 , $json_obj->{'error_description'};
}
else { # oh dear we are in trouble
return 1, $self->_dumpRequest($request, $response);
}
}
}
sub _sendRequest {
lib/API/INSEE/Sirene.pm view on Meta::CPAN
if (!defined $self->{'token_expiration'} || $self->{'token_expiration'} < time) {
my ($err, $msg) = $self->_getToken();
croak $msg if $err;
}
my $response = $self->{'user_agent'}->request($request);
switch ($response->code) {
case [ HTTP_OK, HTTP_NOT_FOUND ] {
return 0, $response->content;
}
case HTTP_MOVED_PERMANENTLY { # duplicated legal unit/ establishment
return 1, sprintf "%s\n%s", $response->message, $response->header('Location');
}
case [
HTTP_REQUEST_URI_TOO_LARGE, HTTP_TOO_MANY_REQUESTS,
HTTP_UNAUTHORIZED, HTTP_FORBIDDEN,
HTTP_SERVICE_UNAVAILABLE
] {
# There is no syntax error in request, the http message should be sufficient to understand the problem
return 1, $response->message;
}
else { # case HTTP_BAD_REQUEST || HTTP_INTERNAL_SERVER_ERROR
return 1, $self->_dumpRequest($request, $response);
}
}
}
sub _buildParameters {
my ($self, $usefull_fields, $desired_fields, $criteria) = @_;
# Parameters names come from the documentation
my $parameters = {
date => strftime('%Y-%m-%d', localtime),
nombre => $self->{'max_results'},
};
$parameters->{'champs'} = $self->_buildFields($usefull_fields, $desired_fields) if (defined $desired_fields && $desired_fields ne 'all');
$parameters->{'q'} = sprintf('(%s)', $criteria) if defined $criteria;
return $parameters;
lib/API/INSEE/Sirene.pm view on Meta::CPAN
# Examples to get information about an establishment with SIRET number '12345678987654'
$sirene->getEstablishmentBySIRET(12345678987654, 'all');
# or
my $fields_that_interest_me = ['numeroVoieEtablissement', 'typeVoieEtablissement', 'libelleVoieEtablissement',
'codePostalEtablissement', 'libelleCommuneEtablissement'];
$sirene->getEstablishmentBySIRET(12345678987654, $fields_that_interest_me);
# or
$sirene->getEstablishmentBySIRET(12345678987654, 'denominationUniteLegale');
# or simply
lib/API/INSEE/Sirene.pm view on Meta::CPAN
=head1 DESCRIPTION
This module allows you to interact with the Sirene API of INSEE (Institut National de la Statistique et des Ãtudes Ãconomiques) in France.
It contains a set of functions that can perform searches on INSEE's database to get some information about french companies like their SIREN number, company name, company headquarters address, etc.
The terms "enterprise", "legal unit" and "establishment" used in this documentation are defined at the INSEE website in the following pages:
=over 4
lib/API/INSEE/Sirene.pm view on Meta::CPAN
=head1 CONSTANTS
=head2 DEFAULT_MAX_RESULTS
The API's default number of results for each request. You can override it with the C<< setMaxResults >> method. A too big value may impact response time and general performances.
This constant is set to 20 results.
=head2 DEFAULT_TIMEOUT
This constant specifies how many seconds the client module has to wait for server response before giving up. You can override it with the C<< setTimeout >> method.
This constant is set to 20 seconds.
=head2 HARD_MAX_RESULTS
The maximum number of results that you can get. This value can't be increased (restricted by API). If you try to send a request with a higher value, the C<nombre> parameter will be forced to HARD_MAX_RESULTS value.
This constant is set to 1000 results.
=head2 MAX_SIREN_LENGTH
A SIREN number has a maximum length of 9 digits.
lib/API/INSEE/Sirene.pm view on Meta::CPAN
A SIREN number has a maximum length of 14 digits.
=head2 MIN_LENGTH
In order to avoid useless requests with too short SIREN/SIRET numbers, the module requires at least 3 digits to allow you performing a search.
=head1 METHODS
=head2 getCustomCriteria
lib/API/INSEE/Sirene.pm view on Meta::CPAN
This method is used to perform a search with a custom criteria built using the C<< getCustomCriteria >> method.
Before using this method, you have to specify the targeted endpoint by calling the C<< setCurrentEndpoint >> method.
my $final_criteria = "$criteria1 OR $criteria2";
my ($err, $result) = $sirene->$sirene->searchByCustomCriteria($final_criteria);
=head2 searchEstablishmentBySIRET
Search all establishments which SIRET number is begining by the number given in parameter.
lib/API/INSEE/Sirene.pm view on Meta::CPAN
$sirene->setDebugMode(1);
=head2 setMaxResults
Used to override the B<< DEFAULT_MAX_RESULTS >> value to get more results, within the limit of B<< HARD_MAX_RESULTS >> value.
$sirene->setMaxResults(30);
=head2 setProxy
lib/API/INSEE/Sirene.pm view on Meta::CPAN
=head1 PARAMETERS
All search methods take an optional C<< $desired_fields >> parameter that comes in three differents flavours:
my $fields_that_interest_me = ['dateCreationUniteLegale', 'sigleUniteLegale'];
my $response_json = $sirene->getLegalUnitBySIREN(123456789, $fields_that_interest_me);
# or
my $response_json = $sirene->getLegalUnitBySIREN(123456789, 'dateCreationUniteLegale');
# or
my $response_json = $sirene->getLegalUnitBySIREN(123456789, 'all');
When you don't specify any desired field, the module returns a selection of fields that are most likely to interest you. (see C<$useful_fields_legal_unit> and C<$useful_fields_establishment> in source code to find out which ones)
If you want all fields, you have to specify it explicitly by passing the value 'all' as parameter.
=head1 RETURN VALUES
Each method returns a list of two elements: a return code, which is 0 in case of success, or something else in case of failure; and the result of the request (some json or an error message). In case of problem when calling API (malformed request for ...
The module may launch a croak if the crendentials are not initialized or if the SIREN/SIRET numbers are not given in a correct format.
=head1 ALIAS
lib/API/INSEE/Sirene.pm view on Meta::CPAN
numvoie => 'numeroVoieEtablissement',
typevoie => 'typeVoieEtablissement',
nomvoie => 'libelleVoieEtablissement',
codePostal => 'codePostalEtablissement',
nomCommune => 'libelleCommuneEtablissement',
adresseComplete => [
'numeroVoieEtablissement',
'typeVoieEtablissement', 'libelleVoieEtablissement',
'codePostalEtablissement', 'libelleCommuneEtablissement'
],
};
B<Usage:>
my $response_json = $sirene->getLegalUnitBySIREN(123456789, 'nom');
is equivalent to
my $response_json = $sirene->getLegalUnitBySIREN(123456789, 'denominationUniteLegale');
=head1 AUTHOR
Justin Fouquet <jfouquet at lncsa dot fr>
view all matches for this distribution
view release on metacpan or search on metacpan
add_database.pl view on Meta::CPAN
host => $host,
path => 'manager',
);
my $db_creation_result = API::ISPManager::db::create( {
%connection_params,
name => $db_name,
dbtype => 'MySQL',
dbencoding => 'default',
dbuser => 'newuser',
add_database.pl view on Meta::CPAN
dbpassword => $db_pass,
dbconfirm => $db_pass,
} );
if ($db_creation_result) {
print "$db_name success added!\n";
} else {
warn Dumper($API::ISPManager::last_answer);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Instagram.pm view on Meta::CPAN
has client_id => ( is => 'ro', required => 1 );
has client_secret => ( is => 'ro', required => 1 );
has redirect_uri => ( is => 'ro', required => 1 );
has scope => ( is => 'ro', default => sub { 'basic' } );
has response_type => ( is => 'ro', default => sub { 'code' } );
has grant_type => ( is => 'ro', default => sub { 'authorization_code' } );
has code => ( is => 'rw', isa => sub { confess "Code not provided" unless $_[0] } );
has access_token => ( is => 'rw', isa => sub { confess "No access token provided" unless $_[0] } );
has no_cache => ( is => 'rw', default => sub { 0 } );
lib/API/Instagram.pm view on Meta::CPAN
sub get_auth_url {
my $self = shift;
carp "User already authorized with code: " . $self->code if $self->code;
my @auth_fields = qw(client_id redirect_uri response_type scope);
for ( @auth_fields ) {
carp "ERROR: $_ required for generating authorization URL" and return unless defined $self->$_;
}
my $uri = URI->new( $self->_authorize_url );
lib/API/Instagram.pm view on Meta::CPAN
carp "A valid access_token is required";
return {}
}
}
# If URL is not prepared, prepares it
unless ( $opts->{prepared_url} ){
$url =~ s|^/||;
$params->{access_token} = $self->access_token;
# Prepares the URL
my $uri = URI->new( $self->_endpoint_url );
$uri->path_segments( $uri->path_segments, split '/', $url );
$uri->query_form($params);
$url = $uri->as_string;
}
# For debugging purposes
print "Requesting: $url$/" if $self->_debug;
# Treats response content
my $res = decode_json $self->_ua->$method( $url, [], $params )->decoded_content;
# Verifies meta node
my $meta = $res->{meta};
carp "$meta->{error_type}: $meta->{error_message}" if $meta->{code} ne '200';
use Data::Dumper;
# die Dumper $res;
$res;
}
sub _request_data { shift->_request(@_)->{data} || {} }
sub _del { shift->_request_data( 'delete', @_ ) }
lib/API/Instagram.pm view on Meta::CPAN
=head1 NAME
API::Instagram - Object Oriented Interface for the Instagram REST and Search APIs
=for Pod::Coverage client_id client_secret grant_type no_cache redirect_uri response_type scope BUILD
=for HTML <a href="https://travis-ci.org/gabrielmad/API-Instagram"><img src="https://travis-ci.org/gabrielmad/API-Instagram.svg?branch=build%2Fmaster"></a>
=for HTML <a href='https://coveralls.io/r/gabrielmad/API-Instagram?branch=build%2Fmaster'><img src='https://coveralls.io/repos/gabrielmad/API-Instagram/badge.png?branch=build%2Fmaster' alt='Coverage Status' /></a>
lib/API/Instagram.pm view on Meta::CPAN
my $instagram = API::Instagram->new({
client_id => 'xxxxxxxxxx',
client_secret => 'xxxxxxxxxx',
redirect_uri => 'http://localhost',
scope => 'basic',
response_type => 'code',
granty_type => 'authorization_code',
});
print $instagram->get_auth_url;
lib/API/Instagram.pm view on Meta::CPAN
my $instagram = API::Instagram->new({
client_id => $client_id,
client_secret => $client_secret,
redirect_uri => 'http://localhost',
scope => 'basic',
response_type => 'code',
granty_type => 'authorization_code',
no_cache => 1,
});
Returns an L<API::Instagram> object.
lib/API/Instagram.pm view on Meta::CPAN
Set C<client_id>, C<client_secret> and C<redirect_uri> with the ones registered
to your application. See L<http://instagram.com/developer/clients/manage/>.
C<scope> is the scope of access. See L<http://instagram.com/developer/authentication/#scope>.
C<response_type> and C<granty_type> do no vary. See L<http://instagram.com/developer/authentication/>.
By default, L<API::Instagram> caches created objects to avoid duplications. You can disable
this feature setting a true value to C<no_chace> parameter.
=head2 instance
view all matches for this distribution
view release on metacpan or search on metacpan
API/Intis/lib/API/error_codes.pm view on Meta::CPAN
case "14" { $descr = 'There are more than 50 numbers in the request'; }
case "15" { $descr = 'List not specified'; }
case "16" { $descr = 'Invalid phone number'; }
case "17" { $descr = 'SMS ID not specified'; }
case "18" { $descr = 'Status not obtained'; }
case "19" { $descr = 'Empty response'; }
case "20" { $descr = 'The number already exists'; }
case "21" { $descr = 'No name'; }
case "22" { $descr = 'Template already exists'; }
case "23" { $descr = 'Month not specifies (Format: YYYY-MM)'; }
case "24" { $descr = 'Timestamp not specified'; }
view all matches for this distribution
view release on metacpan or search on metacpan
example/list_videochats.pl view on Meta::CPAN
my $api = API::MailboxOrg->new(
user => 'test@example.tld',
password => 'a_password',
);
my $result = $api->videochat->list( mail => 'test@example.tld' );
p $result;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Mathpix.pm view on Meta::CPAN
my $mathpix = API::Mathpix->new({
app_id => $ENV{MATHPIX_APP_ID},
app_key => $ENV{MATHPIX_APP_KEY},
});
my $response = $mathpix->process({
src => 'https://mathpix.com/examples/limit.jpg',
});
print $response->text;
=head1 EXPORT
A list of functions that can be exported. You can delete this section
lib/API/Mathpix.pm view on Meta::CPAN
my $encoded_data = encode_json($opt);
my $r = HTTP::Request->new('POST', $url, $headers, $encoded_data);
my $response;
if ($self->_bucket->tick) {
$response = $self->_ua->request($r);
}
else {
warn 'Rate limiting !';
}
if ($response->is_success) {
my $data = decode_json($response->decoded_content);
return API::Mathpix::Response->new($data);
}
else {
warn $response->status_line;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Medium.pm view on Meta::CPAN
isa => 'Str',
is => 'rw',
required => 1,
);
has 'refresh_token' => (
isa => 'Str',
is => 'ro',
);
has '_client' => (
lib/API/Medium.pm view on Meta::CPAN
}
sub get_current_user {
my $self = shift;
my $res = $self->_request( 'GET', 'me' );
return $res->{data};
}
sub create_post {
my ( $self, $user_id, $post ) = @_;
$post->{publishStatus} ||= 'draft';
my $res = $self->_request( 'POST', 'users/' . $user_id . '/posts', $post );
return $res->{data}{url};
}
sub create_publication_post {
my ( $self, $publication_id, $post ) = @_;
$post->{publishStatus} ||= 'draft';
my $res =
$self->_request( 'POST', 'publications/' . $publication_id . '/posts',
$post );
return $res->{data}{url};
}
sub _request {
my ( $self, $method, $endpoint, $data ) = @_;
my $url = join( '/', $self->server, $endpoint );
my $res;
if ($data) {
$res = $self->_client->request( $method, $url,
{ content => encode_json($data) } );
}
else {
$res = $self->_client->request( $method, $url );
}
if ( $res->{success} ) {
return decode_json( $res->{content} );
}
else {
$log->errorf( "Could not talk to medium: %i %s",
$res->{status}, $res->{reason} );
die join( ' ', $res->{status}, $res->{reason} );
}
}
__PACKAGE__->meta->make_immutable;
1;
lib/API/Medium.pm view on Meta::CPAN
=head1 DESCRIPTION
It's probably a good idea to read L<the Medium API
docs|https://github.com/Medium/medium-api-docs> first, especially as
the various data structures you have to send (or might get back) are
B<not> documented here.
See F<example/hello_medium.pl> for a complete script.
=head2 Authentication
lib/API/Medium.pm view on Meta::CPAN
=over
=item * OAuth2 Login
=item * Get a new access_token from refresh_token
=item * C<publications>
=item * C<contributors>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/MikroTik.pm view on Meta::CPAN
# non-blocking
return $self->_command(Mojo::IOLoop->singleton, $cmd, $attr, $query, $cb)
if $cb;
# blocking
my $res;
$self->_command($self->ioloop, $cmd, $attr, $query,
sub { $_[0]->ioloop->stop(); $res = $_[2]; });
$self->ioloop->start();
return $res;
}
sub command_p {
Carp::croak 'Mojolicious v7.54+ is required for using promises.'
unless PROMISES;
lib/API/MikroTik.pm view on Meta::CPAN
$self->_command(
Mojo::IOLoop->singleton,
$cmd, $attr, $query,
sub {
return $p->reject($_[1], $_[2]) if $_[1];
$p->resolve($_[2]);
}
);
return $p;
}
lib/API/MikroTik.pm view on Meta::CPAN
sub _close {
my ($self, $loop) = @_;
$self->_fail_all($loop, 'closed prematurely');
delete $self->{handles}{$loop};
delete $self->{responses}{$loop};
}
sub _command {
my ($self, $loop, $cmd, $attr, $query, $cb) = @_;
lib/API/MikroTik.pm view on Meta::CPAN
my $tls = $self->tls;
my $port = $self->port ? $self->{port} : $tls ? 8729 : 8728;
$r->{loop}->client(
{
address => $self->host,
port => $port,
timeout => CONN_TIMEOUT,
tls => $tls,
tls_ciphers => 'HIGH'
} => sub {
lib/API/MikroTik.pm view on Meta::CPAN
$loop->delay(
sub {
$self->_command($loop, '/login', {}, undef, $_[0]->begin());
},
sub {
my ($delay, $err, $res) = @_;
return $self->$cb($err) if $err;
my $secret
= md5_sum("\x00", $self->password, pack 'H*', $res->[0]{ret});
$self->_command($loop, '/login',
{name => $self->user, response => "00$secret"},
undef, $delay->begin());
},
sub {
$self->$cb($_[1]);
},
lib/API/MikroTik.pm view on Meta::CPAN
sub _read {
my ($self, $loop, $bytes) = @_;
warn "-- read bytes from socket: " . (length $bytes) . "\n" if DEBUG;
my $response = $self->{responses}{$loop} ||= API::MikroTik::Response->new();
my $data = $response->parse(\$bytes);
for (@$data) {
next unless my $r = $self->{requests}{delete $_->{'.tag'}};
my $type = delete $_->{'.type'};
push @{$r->{data} ||= Mojo::Collection->new()}, $_
lib/API/MikroTik.pm view on Meta::CPAN
return $r->{tag} if $r->{subscription};
weaken $self;
$r->{timeout} = $r->{loop}
->timer($self->timeout => sub { $self->_fail($r, 'response timeout') });
return $r->{tag};
}
1;
lib/API/MikroTik.pm view on Meta::CPAN
printf "%s: %s\n", $_->{name}, $_->{type} for @$list;
# Non-blocking
my $tag = $api->command(
'/system/resource/print',
{'.proplist' => 'board-name,version,uptime'} => sub {
my ($api, $err, $list) = @_;
...;
}
);
lib/API/MikroTik.pm view on Meta::CPAN
);
Mojo::IOLoop->start();
# Promises
$api->cmd_p('/interface/print')
->then(sub { my $res = shift }, sub { my ($err, $attr) = @_ })
->finally(sub { Mojo::IOLoop->stop() });
Mojo::IOLoop->start();
=head1 DESCRIPTION
lib/API/MikroTik.pm view on Meta::CPAN
=head2 host
my $host = $api->host;
$api = $api->host('border-gw.local');
Host name or IP address to connect to. Defaults to C<192.168.88.1>.
=head2 ioloop
my $loop = $api->ioloop;
$api = $api->loop(Mojo::IOLoop->new());
lib/API/MikroTik.pm view on Meta::CPAN
my $port = $api->port;
$api = $api->port(8000);
API service port for connection. Defaults to C<8729> and C<8728> for TLS and
clear text connections respectively.
=head2 timeout
my $timeout = $api->timeout;
$api = $api->timeout(15);
Timeout in seconds for sending request and receiving response before command
will be canceled. Default is C<10> seconds.
=head2 tls
my $tls = $api->tls;
lib/API/MikroTik.pm view on Meta::CPAN
=head1 METHODS
=head2 cancel
# subscribe to a command output
my $tag = $api->subscribe('/ping', {address => '127.0.0.1'} => sub {...});
# cancel command after 10 seconds
Mojo::IOLoop->timer(10 => sub { $api->cancel($tag) });
# or with callback
lib/API/MikroTik.pm view on Meta::CPAN
for (@$list) {...}
$api->command('/user/set', {'.id' => 'admin', comment => 'System admin'});
# Non-blocking
$api->command('/ip/address/print' => sub {
my ($api, $err, $list) = @_;
return if $err;
for (@$list) {...}
lib/API/MikroTik.pm view on Meta::CPAN
containing elements returned by a host. You can append a callback for non-blocking
calls.
In a case of error it may return extra attributes to C<!trap> or C<!fatal> API
replies in addition to error messages in an L</error> attribute or an C<$err>
argument. You should never rely on defines of the result to catch errors.
For a query syntax refer to L<API::MikroTik::Query>.
=head2 command_p
my $promise = $api->command_p('/interface/print');
$promise->then(
sub {
my $res = shift;
...
})->catch(sub {
my ($err, $attr) = @_;
});
lib/API/MikroTik.pm view on Meta::CPAN
required for promises functionality.
=head2 subscribe
my $tag = $api->subscribe('/ping',
{address => '127.0.0.1'} => sub {
my ($api, $err, $res) = @_;
});
Mojo::IOLoop->timer(
3 => sub { $api->cancel($tag) }
);
Subscribe to an output of commands with continuous responses such as C<listen> or
C<ping>. Should be terminated with L</cancel>.
=head1 DEBUGGING
You can set the API_MIKROTIK_DEBUG environment variable to get some debug output
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Name.pm view on Meta::CPAN
# ABSTRACT: Name.com API Client
package API::Name;
use Data::Object::Class;
use Data::Object::Signatures;
use Data::Object::Library qw(
Str
);
lib/API/Name.pm view on Meta::CPAN
$headers->header('Api-Username' => $user);
$headers->header('Api-Token' => $token);
}
method resource (@segments) {
# build new resource instance
my $instance = __PACKAGE__->new(
debug => $self->debug,
fatal => $self->fatal,
retries => $self->retries,
timeout => $self->timeout,
lib/API/Name.pm view on Meta::CPAN
token => $self->token,
user => $self->user,
version => $self->version,
);
# resource locator
my $url = $instance->url;
# modify resource locator if possible
$url->path(join '/', $self->url->path, @segments);
# return resource instance
return $instance;
}
1;
lib/API/Name.pm view on Meta::CPAN
$name->debug(1);
$name->fatal(1);
my $domain = $name->domains(get => 'example.com');
my $results = $domain->fetch;
# after some introspection
$domain->update( ... );
=head1 DESCRIPTION
This distribution provides an object-oriented thin-client library for
interacting with the Name (L<https://www.name.com>) API. For usage and
documentation information visit L<https://www.name.com/reseller/API-documentation>.
API::Name is derived from L<API::Client> and inherits all of it's
functionality. Please read the documentation for API::Client for more usage
information.
=head1 ATTRIBUTES
lib/API/Name.pm view on Meta::CPAN
=head2 debug
$name->debug;
$name->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
$name->fatal;
$name->fatal(1);
The fatal attribute if true promotes 4xx and 5xx server response codes to
exceptions, a L<API::Client::Exception> object.
=head2 retries
$name->retries;
$name->retries(10);
The retries attribute determines how many times an HTTP request should be
retried if a 4xx or 5xx response is received. This attribute defaults to 0.
=head2 timeout
$name->timeout;
$name->timeout(5);
lib/API/Name.pm view on Meta::CPAN
=head1 METHODS
=head2 action
my $result = $name->action($verb, %args);
# e.g.
$name->action('head', %args); # HEAD request
$name->action('options', %args); # OPTIONS request
$name->action('patch', %args); # PATCH request
The action method issues a request to the API resource represented by the
object. The first parameter will be used as the HTTP request method. The
arguments, expected to be a list of key/value pairs, will be included in the
request if the key is either C<data> or C<query>.
=head2 create
my $results = $name->create(%args);
# or
$name->POST(%args);
The create method issues a C<POST> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 delete
my $results = $name->delete(%args);
# or
$name->DELETE(%args);
The delete method issues a C<DELETE> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 fetch
my $results = $name->fetch(%args);
# or
$name->GET(%args);
The fetch method issues a C<GET> request to the API resource represented by the
object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 update
my $results = $name->update(%args);
# or
$name->PUT(%args);
The update method issues a C<PUT> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head1 RESOURCES
=head2 account
$name->account;
The account method returns a new instance representative of the API
I<account> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://www.name.com/reseller/API-documentation>.
=head2 dns
$name->dns;
The dns method returns a new instance representative of the API
I<dns> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://www.name.com/reseller/API-documentation>.
=head2 domain
$name->domain;
The domain method returns a new instance representative of the API
I<domain> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://www.name.com/reseller/API-documentation>.
=head2 host
$name->host;
The host method returns a new instance representative of the API
I<host> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://www.name.com/reseller/API-documentation>.
=head2 login
$name->login;
The login method returns a new instance representative of the API
I<login> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://www.name.com/reseller/API-documentation>.
=head2 logout
$name->logout;
The logout method returns a new instance representative of the API
I<logout> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://www.name.com/reseller/API-documentation>.
=head2 order
$name->order;
The order method returns a new instance representative of the API
I<order> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://www.name.com/reseller/API-documentation>.
=head1 AUTHOR
Al Newkirk <anewkirk@ana.io>
view all matches for this distribution