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
view release on metacpan or search on metacpan
lib/API/Octopart.pm view on Meta::CPAN
# You should have received a copy of the GNU General Public License along with
# this module. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2022- eWheeler, Inc. L<https://www.linuxglobal.com/>
# Originally written by Eric Wheeler, KJ7LNW
# All rights reserved.
#
# All tradmarks, product names, logos, and brands are property of their
# respective owners and no grant or license is provided thereof.
#
package API::Octopart;
$VERSION = 1.003;
lib/API/Octopart.pm view on Meta::CPAN
User Agent debugging. This is very verbose and provides API communication details.
=item * json_debug => 1
JSON response debugging. This is very verbose and dumps the Octopart response
in JSON.
=back
=cut
lib/API/Octopart.pm view on Meta::CPAN
This is the max MOQ you will accept as being in
stock. For example, a 5000-part reel might be more
than you want for prototyping so set this to 10 or
100.
=item * seller => <regex> - Seller's name (regular expression)
This is a regular expression so something like
'Mouser|Digi-key' is valid.
=item * mfg => <regex> - Manufacturer name (regular expression)
Specifying the mfg name is useful if your part model
number is similar to those of other manufacturers.
=item * currency => <s> - eg, 'USD' for US dollars
lib/API/Octopart.pm view on Meta::CPAN
sub get_part_stock
{
my ($self, $part, %opts) = @_;
my $results = $self->get_part_stock_detail($part, %opts);
my %ret;
foreach my $result (@$results)
{
my $sellers = $result->{sellers};
foreach my $s (keys %$sellers)
{
$ret{$s} = $sellers->{$s};
delete $ret{$s}->{price_tier};
}
lib/API/Octopart.pm view on Meta::CPAN
'leadfree' => 'Lead Free',
'length' => '2mm',
'numberofpins' => '2',
'radiationhardening' => 'No',
'reachsvhc' => 'No SVHC',
'resistance' =>
"10k\x{ce}\x{a9}", # <- That is an Ohm symbol
'rohs' => 'Compliant',
'tolerance' => '1%',
'voltagerating_dc_' => '150V',
'width' => '1.25mm',
lib/API/Octopart.pm view on Meta::CPAN
}
=item * $o->octo_query($q) - Queries the Octopart API
Return the JSON response structure as a perl ARRAY/HASH given a query meeting Octopart's
API specification.
=cut
sub octo_query
lib/API/Octopart.pm view on Meta::CPAN
return;
}
);
$ua->add_handler(
"response_done",
sub {
my $msg = shift; # HTTP::Response
print STDERR "RECV << \n"
. $msg->headers->as_string . "\n"
. $msg->status_line . "\n"
lib/API/Octopart.pm view on Meta::CPAN
}
);
}
my $req;
my $response;
my $tries = 0;
while ($tries < 3)
{
$req = HTTP::Request->new('POST' => 'https://octopart.com/api/v4/endpoint',
lib/API/Octopart.pm view on Meta::CPAN
'DNT' => 1,
'Origin' => 'https://octopart.com',
),
encode_json( { query => $q }));
$response = $ua->request($req);
if (!$response->is_success)
{
$tries++;
print STDERR "query error, retry $tries. "
. $response->code . ": "
. $response->message . "\n";
sleep 2**$tries;
}
else
{
last;
}
}
$content = $response->decoded_content;
if (!$response->is_success) {
die "request: " . $req->as_string . "\n" .
"resp: " . $response->as_string;
}
}
my $j = from_json($content);
lib/API/Octopart.pm view on Meta::CPAN
return $self->{api_queries};
}
=item * $o->query_part_detail($part)
Return the JSON response structure as a perl ARRAY/HASH given a part search term
shown as "$part". This function calls $o->octo_query() with a query from Octopart's
"Basic Example" so you can easily lookup a specific part number. The has_stock()
and get_part_stock_detail() methods use this query internally.
=cut
lib/API/Octopart.pm view on Meta::CPAN
}
return $self->octo_query( qq(
query {
search(q: "$part", limit: 3) {
results {
part {
manufacturer {
name
}
mpn
lib/API/Octopart.pm view on Meta::CPAN
}
our %_valid_filter_opts = ( map { $_ => 1 } (qw/currency max_moq min_qty max_price mfg seller/) );
sub _parse_part_stock
{
my ($self, $resp, %opts) = @_;
foreach my $o (keys %opts)
{
die "invalid filter option: '$o'" if (!$_valid_filter_opts{$o});
}
my @results;
foreach my $r (@{ $resp->{data}{search}{results} })
{
$r = $r->{part};
my %part;
$part{mfg} = $r->{manufacturer}{name};
lib/API/Octopart.pm view on Meta::CPAN
}
}
$part{sellers} = \%ss;
push @results, \%part;
}
# Delete sellers that do not meet the constraints and
# add matching results to @ret:
my @ret;
foreach my $r (@results)
{
next if (defined($opts{mfg}) && $r->{mfg} !~ /$opts{mfg}/i);
foreach my $s (keys %{ $r->{sellers} })
{
lib/API/Octopart.pm view on Meta::CPAN
L<https://octopart.com/>, L<https://octopart.com/api>
=head1 ATTRIBUTION
Octopart is a registered trademark and brand of Octopart, Inc. All tradmarks,
product names, logos, and brands are property of their respective owners and no
grant or license is provided thereof.
The copyright below applies to this software module; the copyright holder is
unaffiliated with Octopart, Inc.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/ParallelsWPB.pm view on Meta::CPAN
use Carp;
use API::ParallelsWPB::Response;
use base qw/ API::ParallelsWPB::Requests /;
# ABSTRACT: client for Parallels Presence Builder API
our $VERSION = '0.03'; # VERSION
our $AUTHORITY = 'cpan:IMAGO'; # AUTHORITY
lib/API/ParallelsWPB.pm view on Meta::CPAN
}
$post_data = $self->_json->encode($data->{post_data});
}
$post_data ||= '{}';
my $response = $self->_send_request($data, $url, $post_data);
return $response;
}
sub _send_request {
my ( $self, $data, $url, $post_data ) = @_;
lib/API/ParallelsWPB.pm view on Meta::CPAN
$ua->ssl_opts( verify_hostname => 0 );
$ua->timeout( $self->{timeout} );
warn $req->as_string if ( $self->{debug} );
my $res = $ua->request( $req );
warn $res->as_string if ( $self->{debug} );
my $response = API::ParallelsWPB::Response->new( $res );
return $response;
}
sub _json {
my ( $self ) = @_;
lib/API/ParallelsWPB.pm view on Meta::CPAN
=encoding UTF-8
=head1 NAME
API::ParallelsWPB - client for Parallels Presence Builder API
=head1 VERSION
version 0.03
=head1 SYNOPSIS
my $client = API::ParallelsWPB->new( username => 'admin', password => 'passw0rd', server => 'builder.server.mysite.ru' );
my $response = $client->get_sites_info;
if ( $response->success ) {
for my $site ( @{ $response->response } ) {
say "UUID: ". $site->{uuid};
}
}
else {
warn "Error occured: " . $response->error . ", Status: " . $response->status;
}
=head1 METHODS
=head2 B<new($class, %param)>
lib/API/ParallelsWPB.pm view on Meta::CPAN
=over
=item username
Username for connection to Parallels WebPresence Builder instance. Required parameter.
=item password
Password for connection to Parallels WebPresence Builder instance. Required parameter.
=item server
Servername or server ip address for connection to Parallels WebPresence Builder instance. Optional parameter.
=item api_version
API version, used in API url constructing. Optional parameter.
lib/API/ParallelsWPB.pm view on Meta::CPAN
req_type : HTTP request type: get, post, put, delete. GET by default.
post_data: data for POST request. Must be hashref.
=head1 SEE ALSO
L<Parallels Presence Builder Guide|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide>
L<API::ParallelsWPB::Response>
L<API::ParallelsWPB::Requests>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Plesk.pm view on Meta::CPAN
$xml = $self->render_xml($xml);
warn "REQUEST $operator => $operation\n$xml" if $self->{debug};
my ($response, $error) = $self->xml_http_req($xml);
warn "RESPONSE $operator => $operation => $error\n$response" if $self->{debug};
unless ( $error ) {
$response = xml2hash $response, array => [$operation, 'result', 'property'];
}
return API::Plesk::Response->new(
operator => $operator,
operation => $operation,
response => $response,
error => $error,
);
}
sub bulk_send { confess "Not implemented!" }
lib/API/Plesk.pm view on Meta::CPAN
# LWP6 hack to prevent verification of hostname
$ua->ssl_opts(verify_hostname => 0) if $ua->can('ssl_opts');
warn $req->as_string if defined $self->{debug} && $self->{debug} > 1;
my $res = eval {
local $SIG{ALRM} = sub { die "connection timeout" };
alarm $self->{timeout};
$ua->request($req);
};
alarm 0;
warn $res->as_string if defined $self->{debug} && $self->{debug} > 1;
return ('', 'connection timeout')
if !$res || $@ || ref $res && $res->status_line =~ /connection timeout/;
return $res->is_success() ?
($res->content(), '') :
('', $res->status_line);
}
# renders xml packet for request
sub render_xml {
lib/API/Plesk.pm view on Meta::CPAN
api_version => '1.6.3.1',
debug => 0,
timeout => 30,
);
my $res = $api->customer->get();
if ($res->is_success) {
for ( @{$res->data} ) {
print "login: $_->{login}\n";
}
}
else {
print $res->error;
}
=head1 DESCRIPTION
At present the module provides interaction with Plesk 10.1 (API 1.6.3.1).
Distribution was completely rewritten and become more friendly for developers.
Naming of packages and methods become similar to the same operators and operations of Plesk XML API.
Partially implemented:
lib/API/Plesk.pm view on Meta::CPAN
=item xml_http_req( $xml )
Internal method. it implements real request sending to Plesk API.
Returns array ( $response_xml, $error ).
=back
=head1 SEE ALSO
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/PleskExpand.pm view on Meta::CPAN
use API::PleskExpand;
use API::Plesk::Response;
my $expand_client = API::PleskExpand->new(%params);
my $res = $expand_client->Func_Module->operation_type(%params);
if ($res->is_success) {
$res->get_data; # return arr ref of answer blocks
}
=head1 DESCRIPTION
At present the module provides interaction with Plesk Expand 2.2.4 (API 2.2.4.1). Complete support of operations with Accounts, partial support of work with domains. Support of addition of domains to user Accounts.
API::PleskExpand module gives the convenient interface for addition of new functions. Extensions represent modules in a folder Plesk with definitions of demanded functions. Each demanded operation is described by two functions: op and op_response_par...
For example, here the set of subs in the Accounts module is those.
create / create_response_parse
modify / modify_response_parse
delete / delete_response_parse
get / get_response_parse
=head1 EXPORT
Nothing.
lib/API/PleskExpand.pm view on Meta::CPAN
}
=item AUTOLOADed methods
All other methods are loaded by Autoload from corresponding modules.
Execute some operations (see API::PleskExpand::* modules documentation).
Example:
my $res = $expand_client->Func_Module->operation_type(%params);
# Func_Module -- module in API/PleskExpand folder
# operation_type -- sub which defined in Func_Module.
# params hash used as @_ for operation_type sub.
=back
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/PureStorage.pm view on Meta::CPAN
sub _api_get {
my $self = shift @_;
my $url = shift @_;
my $ret = $self->{client}->GET($url);
my $num = $ret->responseCode();
my $con = $ret->responseContent();
if ( $num == 500 ) {
die "API returned error 500 for '$url' - $con\n";
}
if ( $num != 200 ) {
die "API returned code $num for URL '$url'\n";
lib/API/PureStorage.pm view on Meta::CPAN
sub _api_post {
my $self = shift @_;
my $url = shift @_;
my $data = shift @_;
my $ret = $self->{client}->POST($url, to_json($data));
my $num = $ret->responseCode();
my $con = $ret->responseContent();
if ( $num == 500 ) {
die "API returned error 500 for '$url' - $con\n";
}
if ( $num != 200 ) {
die "API returned code $num for URL '$url'\n";
lib/API/PureStorage.pm view on Meta::CPAN
my $volume_info_ref = $pure->volume_info();
Returns an array or arrayref of general information about volumes include space
usage.
Each element of the array is a hash reference, representing a single volume.
=head3 Hash data reference:
* name - the name of this volume
lib/API/PureStorage.pm view on Meta::CPAN
Returns an array/arrayref of API versions supported by the storage array.
=head1 SEE ALSO
http://www.purestorage.com/
=head1 REQUESTS
=head1 BUGS AND SOURCE
view all matches for this distribution
view release on metacpan or search on metacpan
ReviewBoard.pm view on Meta::CPAN
my $link = $self->{_hostedurl}.'api/json/accounts/login/';
my $request = new HTTP::Request('POST',$link);
my $content = 'username='.$self->{_username}.'&password='.$self->{_password};
$request->content($content);
my $response = $self->{_useragent}->simple_request($request);
# extract cookie from response header
$self->{_cookie_jar}->extract_cookies($response);
bless $self,$class;
return $self;
ReviewBoard.pm view on Meta::CPAN
# get request to get review number based on change number
my $changenumlink = $self->{_hostedurl}.'/api/review-requests/?changenum='.$self->{_changenum};
my $request = new HTTP::Request('GET', $changenumlink);
$self->{_cookie_jar}->add_cookie_header($request);
my $response = $self->{_useragent}->simple_request($request);
my $xml = $response->as_string;
$xml=~ m/.*"id": (\d+),.*/;
my $reviewnum = $1;
my $reviewlink = $self->{_hostedurl}.'/r/'.$reviewnum;
ReviewBoard.pm view on Meta::CPAN
# get request to get review number based on change number
my $changenumlink = $self->{_hostedurl}.'/api/review-requests/?changenum='.$self->{_changenum};
my $request = new HTTP::Request('GET', $changenumlink);
$self->{_cookie_jar}->add_cookie_header($request);
my $response = $self->{_useragent}->simple_request($request);
my $xml = $response->as_string;
$xml =~ m/.*"description": "(.*)", "links".*/;
my $description = $1;
$description =~ s/(\\n)+/\n/g;
ReviewBoard.pm view on Meta::CPAN
$self->{_changenum} = $args{changenum};
my $changenumlink = $self->{_hostedurl}.'/api/review-requests/?changenum='.$self->{_changenum};
my $request = new HTTP::Request('GET', $changenumlink);
$self->{_cookie_jar}->add_cookie_header($request);
my $response = $self->{_useragent}->simple_request($request);
my $xml = $response->as_string;
$xml =~ m/.*"time_added": "(.*)", "summary".*/;
my $dateadded = $1;
return ($dateadded);
ReviewBoard.pm view on Meta::CPAN
$self->{_changenum} = $args{changenum};
my $changenumlink = $self->{_hostedurl}.'/api/review-requests/?changenum='.$self->{_changenum};
my $request = new HTTP::Request('GET', $changenumlink);
$self->{_cookie_jar}->add_cookie_header($request);
my $response = $self->{_useragent}->simple_request($request);
my $xml = $response->as_string;
$xml =~ /.*"last_updated": "(.*)", "description".*/;
my $lastupdated = $1;
ReviewBoard.pm view on Meta::CPAN
$self->{_changenum} = $args{changenum};
my $userlink = $self->{_hostedurl}.'/api/review-requests/?changenum='.$self->{_changenum};
my $request = new HTTP::Request('GET', $userlink);
$self->{_cookie_jar}->add_cookie_header($request);
my $response = $self->{_useragent}->simple_request($request);
my $xml = $response->as_string;
$xml =~ m/.*"target_people": (.*), "testing_done".*/;
my $name = $1;
my @arr;
my $count = @arr = $name =~ /"title": "(\w+)"/g;
ReviewBoard.pm view on Meta::CPAN
my $userlink = $self->{_hostedurl}.'/api/review-requests/?changenum='.$self->{_changenum};
my $request = new HTTP::Request('GET', $userlink);
$self->{_cookie_jar}->add_cookie_header($request);
my $response = $self->{_useragent}->simple_request($request);
my $xml = $response->as_string;
$xml =~ m/.*"submitter": (.*), "screenshots".*/;
my $name = $1;
my @arr;
my $count = @arr = $name =~ /"title": "(\w+)"/g;
ReviewBoard.pm view on Meta::CPAN
my $userlink = $self->{_hostedurl}.'/api/review-requests/?changenum='.$self->{_changenum};
my $request = new HTTP::Request('GET', $userlink);
$self->{_cookie_jar}->add_cookie_header($request);
my $response = $self->{_useragent}->simple_request($request);
my $xml = $response->as_string;
$xml =~ m/.*"summary": "(.*)", "public".*/;
my $summary = $1;
ReviewBoard.pm view on Meta::CPAN
$self->{_changenum} = $args{changenum};
my $userlink = $self->{_hostedurl}.'/api/review-requests/?changenum='.$self->{_changenum};
my $request = new HTTP::Request('GET', $userlink);
$self->{_cookie_jar}->add_cookie_header($request);
my $response = $self->{_useragent}->simple_request($request);
my $xml = $response->as_string;
$xml =~ m/.*"bugs_closed": (.*), "changenum".*/;
my $bugids = $1;
return ($bugids);
}
ReviewBoard.pm view on Meta::CPAN
$self->{_reviewnum} = $args{reviewnum};
my $userlink = $self->{_hostedurl}.'/api/review-requests/'.$self->{_reviewnum}.'/reviews/?counts-only=1';
my $request = new HTTP::Request('GET', $userlink);
$self->{_cookie_jar}->add_cookie_header($request);
my $response = $self->{_useragent}->simple_request($request);
my $xml = $response->as_string;
$xml =~ m/.*{"count": (\d+).*/ ;
my $count = $1;
return $count;
ReviewBoard.pm view on Meta::CPAN
$self->{_user} = $args{user};
my $userlink = $self->{_hostedurl}.'/api/review-requests/?from-user='.$self->{_user}.'&status=all&counts-only=1';
my $request = new HTTP::Request('GET', $userlink);
$self->{_cookie_jar}->add_cookie_header($request);
my $response = $self->{_useragent}->simple_request($request);
my $xml = $response->as_string;
$xml =~ m/.*{"count": (\d+).*/ ;
my $count = $1;
return ($count);
ReviewBoard.pm view on Meta::CPAN
$self->{_enddate} = $args{enddate};
my $userlink = $self->{_hostedurl}.'/api/review-requests/?from-user='.$self->{_user}.'&time-added-from='.$self->{_startdate}.'&time-added-to='.$self->{_enddate}.'&status=all&counts-only=1';
my $request = new HTTP::Request('GET', $userlink);
$self->{_cookie_jar}->add_cookie_header($request);
my $response = $self->{_useragent}->simple_request($request);
my $xml = $response->as_string;
$xml =~ m/.*{"count": (\d+).*/ ;
my $count = $1;
return $count;
ReviewBoard.pm view on Meta::CPAN
$self->{_status} = $args{status};
my $userlink = $self->{_hostedurl}.'/api/review-requests/?from-user='.$self->{_user}.'&status='.$self->{_status}.'&counts-only=1';
my $request = new HTTP::Request('GET', $userlink);
$self->{_cookie_jar}->add_cookie_header($request);
my $response = $self->{_useragent}->simple_request($request);
my $xml = $response->as_string;
$xml =~ m/.*{"count": (\d+).*/ ;
my $count = $1;
return $count;
ReviewBoard.pm view on Meta::CPAN
$self->{_user} = $args{user};
my $userlink = $self->{_hostedurl}.'/api/review-requests/?to-users='.$self->{_user}.'&counts-only=1';
my $request = new HTTP::Request('GET', $userlink);
$self->{_cookie_jar}->add_cookie_header($request);
my $response = $self->{_useragent}->simple_request($request);
my $xml = $response->as_string;
$xml =~ m/.*{"count": (\d+).*/ ;
my $count = $1;
return $count;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Stripe.pm view on Meta::CPAN
# ABSTRACT: Stripe.com API Client
package API::Stripe;
use Data::Object::Class;
use Data::Object::Signatures;
use Data::Object::Library qw(
Str
);
lib/API/Stripe.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/Stripe.pm view on Meta::CPAN
identifier => $self->identifier,
username => $self->username,
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/Stripe.pm view on Meta::CPAN
$stripe->debug(1);
$stripe->fatal(1);
my $charge = $stripe->charges('ch_163Gh12CVMZwIkvc');
my $results = $charge->fetch;
# after some introspection
$charge->update( ... );
lib/API/Stripe.pm view on Meta::CPAN
=head2 debug
$stripe->debug;
$stripe->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
$stripe->fatal;
$stripe->fatal(1);
The fatal attribute if true promotes 4xx and 5xx server response codes to
exceptions, a L<API::Client::Exception> object.
=head2 retries
$stripe->retries;
$stripe->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
$stripe->timeout;
$stripe->timeout(5);
lib/API/Stripe.pm view on Meta::CPAN
=head1 METHODS
=head2 action
my $result = $stripe->action($verb, %args);
# e.g.
$stripe->action('head', %args); # HEAD request
$stripe->action('options', %args); # OPTIONS request
$stripe->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 = $stripe->create(%args);
# or
$stripe->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 = $stripe->delete(%args);
# or
$stripe->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 = $stripe->fetch(%args);
# or
$stripe->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 = $stripe->update(%args);
# or
$stripe->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
$stripe->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://stripe.com/docs/api#account>.
=head2 application_fees
$stripe->application_fees;
The application_fees method returns a new instance representative of the API
I<Application Fees> 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://stripe.com/docs/api#application_fees>.
=head2 balance
$stripe->balance->history;
The balance method returns a new instance representative of the API
I<Balance> 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://stripe.com/docs/api#balance>.
=head2 bitcoin_receivers
$stripe->bitcoin->receivers;
The bitcoin_receivers method returns a new instance representative of the API
I<Bitcoin Receivers> 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://stripe.com/docs/api#bitcoin_receivers>.
=head2 cards
$stripe->cards;
The cards method returns a new instance representative of the API
I<Cards> 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://stripe.com/docs/api#cards>.
=head2 charges
$stripe->charges;
The charges method returns a new instance representative of the API
I<Charges> 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://stripe.com/docs/api#charges>.
=head2 coupons
$stripe->coupons;
The coupons method returns a new instance representative of the API
I<Coupons> 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://stripe.com/docs/api#coupons>.
=head2 customers
$stripe->customers;
The customers method returns a new instance representative of the API
I<Customers> 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://stripe.com/docs/api#customers>.
=head2 discounts
$stripe->discounts;
The discounts method returns a new instance representative of the API
I<Discounts> 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://stripe.com/docs/api#discounts>.
=head2 disputes
$stripe->disputes;
The disputes method returns a new instance representative of the API
I<Disputes> 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://stripe.com/docs/api#disputes>.
=head2 events
$stripe->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://stripe.com/docs/api#events>.
=head2 fee_refunds
$stripe->application_fees('fee_6HiNDgLZ85q6KD')->refunds('fr_6HiNza7kmLzMFc');
The fee_refunds method returns a new instance representative of the API
I<Application Fee Refunds> 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://stripe.com/docs/api#fee_refunds>.
=head2 file_uploads
$stripe->files;
The file_uploads method returns a new instance representative of the API
I<File 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://stripe.com/docs/api#file_uploads>.
=head2 invoiceitems
$stripe->invoiceitems;
The invoiceitems method returns a new instance representative of the API
I<Invoice Items> 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://stripe.com/docs/api#invoiceitems>.
=head2 invoices
$stripe->invoices;
The invoices method returns a new instance representative of the API
I<Invoices> 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://stripe.com/docs/api#invoices>.
=head2 plans
$stripe->plans;
The plans method returns a new instance representative of the API
I<Plans> 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://stripe.com/docs/api#plans>.
=head2 recipients
$stripe->recipients;
The recipients method returns a new instance representative of the API
I<Recipients> 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://stripe.com/docs/api#recipients>.
=head2 refunds
$stripe->refunds;
The refunds method returns a new instance representative of the API
I<Refunds> 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://stripe.com/docs/api#refunds>.
=head2 subscriptions
$stripe->subscriptions;
The subscriptions method returns a new instance representative of the API
I<Subscriptions> 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://stripe.com/docs/api#subscriptions>.
=head2 tokens
$stripe->tokens;
The tokens method returns a new instance representative of the API
I<Tokens> 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://stripe.com/docs/api#tokens>.
=head2 transfer_reversals
$stripe->transfers('tr_164xRv2eZvKYlo2CZxJZWm1E')->reversals;
The transfer_reversals method returns a new instance representative of the API
I<Transfer Reversals> 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://stripe.com/docs/api#transfer_reversals>.
=head2 transfers
$stripe->transfers;
The transfers method returns a new instance representative of the API
I<Transfers> 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://stripe.com/docs/api#transfers>.
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Trello.pm view on Meta::CPAN
# ABSTRACT: Trello.com API Client
package API::Trello;
use Data::Object::Class;
use Data::Object::Signatures;
use Data::Object::Library qw(
Str
);
lib/API/Trello.pm view on Meta::CPAN
# default headers
$headers->header('Content-Type' => 'application/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/Trello.pm view on Meta::CPAN
token => $self->token,
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/Trello.pm view on Meta::CPAN
$trello->debug(1);
$trello->fatal(1);
my $board = $trello->boards('4d5ea62fd76a');
my $results = $board->fetch;
# after some introspection
$board->update( ... );
lib/API/Trello.pm view on Meta::CPAN
=head2 debug
$trello->debug;
$trello->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
$trello->fatal;
$trello->fatal(1);
The fatal attribute if true promotes 4xx and 5xx server response codes to
exceptions, a L<API::Client::Exception> object.
=head2 retries
$trello->retries;
$trello->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
$trello->timeout;
$trello->timeout(5);
lib/API/Trello.pm view on Meta::CPAN
=head1 METHODS
=head2 action
my $result = $trello->action($verb, %args);
# e.g.
$trello->action('head', %args); # HEAD request
$trello->action('options', %args); # OPTIONS request
$trello->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 = $trello->create(%args);
# or
$trello->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 = $trello->delete(%args);
# or
$trello->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 = $trello->fetch(%args);
# or
$trello->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 = $trello->update(%args);
# or
$trello->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 actions
$trello->actions;
The actions method returns a new instance representative of the API
I<actions> 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://trello.com/docs/api/action/index.html>.
=head2 batch
$trello->batch;
The batch method returns a new instance representative of the API
I<batch> 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://trello.com/docs/api/batch/index.html>.
=head2 boards
$trello->boards;
The boards method returns a new instance representative of the API
I<boards> 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://trello.com/docs/api/board/index.html>.
=head2 cards
$trello->cards;
The cards method returns a new instance representative of the API
I<cards> 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://trello.com/docs/api/card/index.html>.
=head2 checklists
$trello->checklists;
The checklists method returns a new instance representative of the API
I<checklists> 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://trello.com/docs/api/checklist/index.html>.
=head2 labels
$trello->labels;
The labels method returns a new instance representative of the API
I<labels> 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://trello.com/docs/api/label/index.html>.
=head2 lists
$trello->lists;
The lists method returns a new instance representative of the API
I<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://trello.com/docs/api/list/index.html>.
=head2 members
$trello->members;
The members method returns a new instance representative of the API
I<members> 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://trello.com/docs/api/member/index.html>.
=head2 notifications
$trello->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://trello.com/docs/api/notification/index.html>.
=head2 organizations
$trello->organizations;
The organizations method returns a new instance representative of the API
I<organizations> 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://trello.com/docs/api/organization/index.html>.
=head2 search
$trello->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://trello.com/docs/api/search/index.html>.
=head2 sessions
$trello->sessions;
The sessions method returns a new instance representative of the API
I<sessions> 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://trello.com/docs/api/session/index.html>.
=head2 tokens
$trello->tokens;
The tokens method returns a new instance representative of the API
I<tokens> 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://trello.com/docs/api/token/index.html>.
=head2 types
$trello->types;
The types method returns a new instance representative of the API
I<types> 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://trello.com/docs/api/type/index.html>.
=head2 webhooks
$trello->webhooks;
The webhooks method returns a new instance representative of the API
I<webhooks> 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://trello.com/docs/api/webhook/index.html>.
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Twitter.pm view on Meta::CPAN
# ABSTRACT: Twitter.com API Client
package API::Twitter;
use Data::Object::Class;
use Data::Object::Signatures;
use Data::Object::Library qw(
Str
);
lib/API/Twitter.pm view on Meta::CPAN
);
has oauth_type => (
is => 'rw',
isa => Str,
default => 'protected resource',
required => 0,
);
# DEFAULTS
lib/API/Twitter.pm view on Meta::CPAN
# authorization header
$headers->header('Authorization' => $oauth->to_authorization_header);
}
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/Twitter.pm view on Meta::CPAN
access_token_secret => $self->access_token_secret,
consumer_key => $self->consumer_key,
consumer_secret => $self->consumer_secret,
);
# 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/Twitter.pm view on Meta::CPAN
$twitter->debug(1);
$twitter->fatal(1);
my $user = $twitter->users('lookup');
my $results = $user->fetch;
# after some introspection
$user->update( ... );
=head1 DESCRIPTION
This distribution provides an object-oriented thin-client library for
interacting with the Twitter (L<http://twitter.com>) API. For usage and
documentation information visit L<https://dev.twitter.com/rest/public>.
API::Twitter 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/Twitter.pm view on Meta::CPAN
=head2 debug
$twitter->debug;
$twitter->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
$twitter->fatal;
$twitter->fatal(1);
The fatal attribute if true promotes 4xx and 5xx server response codes to
exceptions, a L<API::Client::Exception> object.
=head2 retries
$twitter->retries;
$twitter->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
$twitter->timeout;
$twitter->timeout(5);
lib/API/Twitter.pm view on Meta::CPAN
=head1 METHODS
=head2 action
my $result = $twitter->action($verb, %args);
# e.g.
$twitter->action('head', %args); # HEAD request
$twitter->action('options', %args); # OPTIONS request
$twitter->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 = $twitter->create(%args);
# or
$twitter->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 = $twitter->delete(%args);
# or
$twitter->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 = $twitter->fetch(%args);
# or
$twitter->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 = $twitter->update(%args);
# or
$twitter->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
$twitter->account;
The account method 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://dev.twitter.com/rest/public#account>.
=head2 application
$twitter->application;
The application method 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://dev.twitter.com/rest/public#application>.
=head2 blocks
$twitter->blocks;
The blocks method 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://dev.twitter.com/rest/public#blocks>.
=head2 direct_messages
$twitter->direct_messages;
The direct_messages method 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://dev.twitter.com/rest/public#direct_messages>.
=head2 favorites
$twitter->favorites;
The favorites method 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://dev.twitter.com/rest/public#favorites>.
=head2 followers
$twitter->followers;
The followers method 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://dev.twitter.com/rest/public#followers>.
=head2 friends
$twitter->friends;
The friends method 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://dev.twitter.com/rest/public#friends>.
=head2 friendships
$twitter->friendships;
The friendships method 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://dev.twitter.com/rest/public#friendships>.
=head2 geo
$twitter->geo;
The geo method 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://dev.twitter.com/rest/public#geo>.
=head2 help
$twitter->help;
The help method 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://dev.twitter.com/rest/public#help>.
=head2 lists
$twitter->lists;
The lists method 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://dev.twitter.com/rest/public#lists>.
=head2 media
$twitter->media;
The media method 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://dev.twitter.com/rest/public#media>.
=head2 mutes
$twitter->mutes;
The mutes method 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://dev.twitter.com/rest/public#mutes>.
=head2 saved_searches
$twitter->saved_searches;
The saved_searches method 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://dev.twitter.com/rest/public#saved_searches>.
=head2 search
$twitter->search;
The search method 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://dev.twitter.com/rest/public#search>.
=head2 statuses
$twitter->statuses;
The statuses method 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://dev.twitter.com/rest/public#statuses>.
=head2 trends
$twitter->trends;
The trends method 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://dev.twitter.com/rest/public#trends>.
=head2 users
$twitter->users;
The users method 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://dev.twitter.com/rest/public#users>.
=head1 AUTHOR
Al Newkirk <anewkirk@ana.io>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Vultr.pm view on Meta::CPAN
use API::Vultr;
use Data::Dumper qw(Dumper);
my $vultr_api = API::Vultr->new(api_key => $ENV{VULTR_API_KEY});
my $create_response = $vultr_api->create_instance(
region => 'ewr',
plan => 'vc2-6c-16gb',
label => 'My Instance',
os_id => 215,
user_data => 'QmFzZTY4EVsw32WfsGGHsjKJI',
backups => 'enabled',
hostname => 'hostname'
);
if ($create_response->is_success) {
print Dumper($create_response->decoded_content);
}
else {
die $create_response->status_line;
}
=head1 API
=head2 ua
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Wunderlist.pm view on Meta::CPAN
# ABSTRACT: Wunderlist.com API Client
package API::Wunderlist;
use Data::Object::Class;
use Data::Object::Signatures;
use Data::Object::Library qw(
Str
);
lib/API/Wunderlist.pm view on Meta::CPAN
$headers->header('X-Access-Token' => $self->access_token);
$headers->header('Content-Type' => 'application/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/Wunderlist.pm view on Meta::CPAN
client_id => $self->client_id,
access_token => $self->access_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/Wunderlist.pm view on Meta::CPAN
$wunderlist->debug(1);
$wunderlist->fatal(1);
my $list = $wunderlist->lists('12345');
my $results = $list->fetch;
# after some introspection
$list->update( ... );
lib/API/Wunderlist.pm view on Meta::CPAN
=head2 debug
$wunderlist->debug;
$wunderlist->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
$wunderlist->fatal;
$wunderlist->fatal(1);
The fatal attribute if true promotes 4xx and 5xx server response codes to
exceptions, a L<API::Client::Exception> object.
=head2 retries
$wunderlist->retries;
$wunderlist->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
$wunderlist->timeout;
$wunderlist->timeout(5);
lib/API/Wunderlist.pm view on Meta::CPAN
=head1 METHODS
=head2 action
my $result = $wunderlist->action($verb, %args);
# e.g.
$wunderlist->action('head', %args); # HEAD request
$wunderlist->action('options', %args); # OPTIONS request
$wunderlist->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 = $wunderlist->create(%args);
# or
$wunderlist->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 = $wunderlist->delete(%args);
# or
$wunderlist->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 = $wunderlist->fetch(%args);
# or
$wunderlist->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 = $wunderlist->update(%args);
# or
$wunderlist->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 avatars
$wunderlist->avatars;
The avatars method returns a new instance representative of the API
I<Avatar> 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.wunderlist.com/documentation/endpoints/avatar>.
=head2 file_previews
$wunderlist->previews;
The file_previews method returns a new instance representative of the API
I<Preview> 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.wunderlist.com/documentation/endpoints/file_preview>.
=head2 files
$wunderlist->files;
The files method returns a new instance representative of the API
I<File> 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.wunderlist.com/documentation/endpoints/file>.
=head2 folders
$wunderlist->folders;
The folders method returns a new instance representative of the API
I<Folder> 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.wunderlist.com/documentation/endpoints/folder>.
=head2 lists
$wunderlist->lists;
The lists method returns a new instance representative of the API
I<List> 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.wunderlist.com/documentation/endpoints/list>.
=head2 memberships
$wunderlist->memberships;
The memberships method returns a new instance representative of the API
I<Membership> 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.wunderlist.com/documentation/endpoints/membership>.
=head2 notes
$wunderlist->notes;
The notes method returns a new instance representative of the API
I<Note> 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.wunderlist.com/documentation/endpoints/note>.
=head2 positions
$wunderlist->list_positions;
The positions method returns a new instance representative of the API
I<Positions> 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.wunderlist.com/documentation/endpoints/positions>.
=head2 reminders
$wunderlist->reminders;
The reminders method returns a new instance representative of the API
I<Reminder> 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.wunderlist.com/documentation/endpoints/reminder>.
=head2 subtasks
$wunderlist->subtasks;
The subtasks method returns a new instance representative of the API
I<Subtask> 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.wunderlist.com/documentation/endpoints/subtask>.
=head2 task_comments
$wunderlist->task_comments;
The task_comments method returns a new instance representative of the API
I<Task Comment> 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.wunderlist.com/documentation/endpoints/task_comment>.
=head2 tasks
$wunderlist->tasks;
The tasks method returns a new instance representative of the API
I<Task> 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.wunderlist.com/documentation/endpoints/task>.
=head2 uploads
$wunderlist->uploads;
The uploads method returns a new instance representative of the API
I<Upload> 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.wunderlist.com/documentation/endpoints/upload>.
=head2 users
$wunderlist->users;
The users method returns a new instance representative of the API
I<User> 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.wunderlist.com/documentation/endpoints/user>.
=head2 webhooks
$wunderlist->webhooks;
The webhooks method returns a new instance representative of the API
I<Webhooks> 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.wunderlist.com/documentation/endpoints/webhooks>.
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/APISchema.pm view on Meta::CPAN
=head1 SYNOPSIS
# bmi.def
resource figure => {
type => 'object',
description => 'Figure, which includes weight and height',
properties => {
weight => {
type => 'number',
lib/APISchema.pm view on Meta::CPAN
},
},
required => ['weight', 'height'],
};
resource bmi => {
type => 'object',
description => 'Body mass index',
properties => {
value => {
type => 'number',
lib/APISchema.pm view on Meta::CPAN
destination => {
controller => 'BMI',
action => 'calculate',
},
request => 'figure',
response => 'bmi',
};
# main.pl
use APISchema::DSL;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/APNS/Agent.pm view on Meta::CPAN
private_key
sandbox
debug_port
/],
ro_lazy => {
on_error_response => sub {
sub {
my $self = shift;
my %d = %{$_[0]};
warnf "identifier:%s\tstate:%s\ttoken:%s", $d{identifier}, $d{state}, $d{token} || '';
}
lib/APNS/Agent.pm view on Meta::CPAN
}
sub _do_monitor {
my ($self, $req) = @_;
my $result = {
sent => $self->_sent,
queued => scalar( @{ $self->_queue } ),
};
my $body = encode_json($result);
return [200, [
'Content-Type' => 'application/json; charset=utf-8',
'Content-Length' => length($body),
], [$body]];
lib/APNS/Agent.pm view on Meta::CPAN
if (@{$self->_queue}) {
$self->_sending;
}
},
on_error_response => sub {
my ($identifier, $state) = @_;
my $data = $self->_sent_cache->get($identifier) || {};
$self->on_error_response->($self, {
identifier => $identifier,
state => $state,
token => $data->{token},
payload => $data->{payload},
});
lib/APNS/Agent.pm view on Meta::CPAN
=head1 DESCRIPTION
APNS::Agent is agent server for APNS. It is also backend class of L<apns-agent>.
This module provides consistent connection to APNS and cares reconnection. It utilizes
L<AnyEvent::APNS> internally.
B<THE SOFTWARE IS ALPHA QUALITY. API MAY CHANGE WITHOUT NOTICE.>
=head1 API PARAMETERS
view all matches for this distribution