package WWW::SourceForge;
use strict;
use LWP::Simple qw(get);
use JSON::Parse;
use XML::Feed;
use File::HomeDir;
our $VERSION = '0.73'; # This is the overall version for the entire
# package, so sho
,
},
ref($class) || $class
);
return $self;
}
=head2 call
Usage : my $json = $sfapi->call(
method => whatever,
arg1 => 'value',
rss',
);
Returns : Hashref, containing a bunch of data. Format defaults to
'json', but in some cases, you'll want to force rss because that's
how the return is available. Wi
ts at unixadm dot org>
#
use strict;
use warnings;
use IO::Socket::SSL;
use LWP::UserAgent;
use JSON;
use MIME::Base64;
our $VERSION = "0.2";
sub new {bless {'success' => 1}, $_[0]}
sub success {
or'} = "could not set up user agent";
return 0
}
1
}
sub processResponse {
my $res = decode_json $_[1];
unless ($res->{'status'} == 1) {
$_[0]->{'success'} = 0;
$_[0]->{'error'} = sprintf "
>post(
'https://api'.($_[0]->{'test'}?'test':'').'.startssl.com/', {
'RequestData' => encode_json {
'tokenId' => $_[0]->{'tokenID'},
'actionType' => 'ApplyCertificate',
'certType' =>
see L<Data::Clean::JSON>.
This property specifies postfilters for function result. Currently the focus of
this property is converting values that are unsafe when exporting to JSON/YAML.
Value: a ha
oder's facility, for example the L<JSON>
module can convert blessed object:
use JSON 2;
my $encoder = JSON->new->convert_blessed;
{
local *DateTime::TO_JSON = sub { $_[0]->ymd };
print $
encoder->encode($doc);
}
But this currently can't convert coderefs. JSON also can't handle circular
references, which neither this wrapper property nor the above way can work
around.
=head1 HOMEPAG
return [];
},
);
=head2 prepare_raygun
Prepare the error structure to be converted to JSON and sent to raygun.io.
=cut
sub prepare_raygun {
my $self = shift;
return {
inn
s://metacpan.org/pod/WebService::Raygun'
};
}
=head2 prepare_raygun
Converts a Perl hash to JSON.
=cut
sub prepare_raygun {
my $self = shift;
my $formatter = DateTime::Format::Str
le scripts in the distribution.
=cut
use Moose;
use Method::Signatures;
use LWP::UserAgent;
use JSON;
use YAML;
=head1 ATTRIBUTES
=over
=item debug
If debug is set, lots of stuff will get dumped
$self->debug) {
print STDERR Dump($self->response);
}
my $json = decode_json($self->response->content);
return $json->{versions};
}
=item login
Logs in.
=cut
method login {
$self
int STDERR Dump($self->response);
}
my $json = decode_json($self->response->content);
my $userId = $json->{data}{userId};
my $authToken = $json->{data}{authToken};
$self->userId($userId
package Sailthru::Client;
use strict;
use warnings;
use Carp;
use JSON::XS;
use LWP::UserAgent;
use Digest::MD5 qw( md5_hex );
use Params::Validate qw( :all );
use Readonly;
use URI;
our $VERSION =
LAR } );
my ( $action, $data, $request_type ) = @params;
my $payload = $self->_prepare_json_payload($data);
my $action_uri = $API_URI . $action;
my $response = $self->_http_reques
reset => $response->header('x-rate-limit-reset')
};
}
return decode_json( $response->content );
}
# args:
# * uri - scalar
# * data - hashref
# * method - scalar
sub _ht
pe qw(uri_escape);
use LWP::UserAgent;
use Carp qw(croak);
use Digest::SHA qw(sha256_base64);
use JSON;
=head1 NAME
WebService::Ooyala - Perl interface to Ooyala's API, currently only read
operation
path, $body, $params) = @_;
my $path = "/" . $self->{api_version} . "/" . $relative_path;
my $json_body = {};
my $url =
$self->build_path_with_authentication_params($http_method, $path,
$par
ailed to GET $full_url - " . $resp->status_line;
}
if ($resp->is_success) {
return decode_json($resp->decoded_content);
}
} else {
croak
"Trying to call a method that is not implemente
d::Signatures;
use namespace::autoclean;
extends 'WebService::SendGrid';
use URI;
use Carp;
use JSON::XS;
use Mail::RFC822::Address qw(valid);
has 'first_name' => ( is => 'rw', isa => 'Str', requir
e_request('/api/profile.get.json', {});
my $res = $self->_dispatch_request($req);
return $self->_process_error($res) if $res->code != 100;
my $content = ${ decode_json $res->content }[0];
# it
e_request('/api/profile.set.json', \%data);
my $res = $self->_dispatch_request($req);
return $self->_process_error($res) if $res->code != 200;
my $content = decode_json $res->content;
}
method
webservice
use Carp;
use HTTP::Tiny;
use URI::Escape qw( uri_escape );
use JSON::MaybeXS qw( decode_json encode_json JSON );
use Try::Tiny;
use Exception::Class (
'SMS::Send::Retarus::Exception'
> {
# to ensure the response is JSON
'accept' => 'application/json; charset=utf-8',
'content-type' => 'application/json; charset=utf-8',
},
timeout
content => encode_json(\%message),
}
);
if ( $response->{success} ) {
my $content;
try {
$content = decode_json( $response->{content} );
n::Format::LDAP::make_ldif($self);
}
elsif ($opts->{as} eq "json") {
require JSON;
$dump = JSON::encode_json(\%struct);
}
elsif ($opts->{as} eq "perl") {
$dump
$dump = $dumper->Dump;
}
# add a newline if output is missing one (typically for JSON)
$dump .= "\n" unless $dump =~ /\n$/;
return print $dump
}
else {
s set,
otherwise returns the result.
B<Arguments>
=over
=item *
C<as> - specify the format: C<json>, C<perl>, C<yaml>
=back
=head2 task_info
Print information about the RackObject
=head2 tas
oseX::WithCache;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Headers;
use HTTP::Message;
use JSON;
use Class::Date qw/gmdate/;
use POSIX; #strftime
use YAML qw/Dump LoadFile DumpFile/;
use Encode
g' => HTTP::Message::decodable ); # Enable compression
$h->header( 'Accept' => "application/json" );
my $data = $self->request_from_api(
headers => $h,
uri => 'ht
=> "application/json" );
$h->header( 'Accept-Encoding' => HTTP::Message::decodable ); # Enable compression
$h->header( 'Accept' => "application/json" );
$h->head
=head3 L<File::Slurper>
=head3 L<File::Type>
=head3 L<Hash::Merge>
=head3 L<JSON>
=head3 L<JSON::Syck>
=head3 L<JSON::XS>
=head3 L<List::AllUtils>
=head3 L<List::MoreUtils>
=head3 L<Log::Log4p
t;
use warnings;
use Carp qw/croak/;
use URI::Escape qw/uri_escape/;
use HTTP::Tiny;
use JSON::PP qw/decode_json/;
use Class::Accessor::Lite (
rw => [qw/
cd
type
endpoint
es->{status} $res->{reason}" unless $res->{success};
my $json = $res->{content};
return $json if $raw;
return decode_json($json);
}
sub data {
my ($self, $domain, $delimi) = @_;
ape_ijson
my $escaped_js = escape_ijson($raw_js);
JavaScript-escapes the input string except for the apostrophe and returns it,
so it can be used within a JSON element.
=cut
sub escape_ijson {
aygun> method may be called to retreive the structure in a form
that can be converted directly to JSON.
=head1 INTERFACE
=cut
use Data::GUID 'guid_string';
use Mouse::Util::TypeConstraints;
subt
aygun> method may be called to retreive the structure in a form
that can be converted directly to JSON.
=head1 INTERFACE
=cut
use Filesys::DfPortable;
use Sys::Info;
use Sys::Info::OS;
use POSIX (
=> sub {
return '';
},
);
=head2 prepare_raygun
Prepare the data for conversion to JSON.
=cut
sub prepare_raygun {
my $self = shift;
return {
lineNumber => $self->line
C<RAYGUN_API_KEY> environment variable.
=cut
use LWP::UserAgent;
use URI;
use Mozilla::CA;
use JSON;
use WebService::Raygun::Message;
has api_key => (
is => 'rw',
isa => 'Str',
$ua = $self->user_agent;
my $json = JSON->new->allow_nonref;
my $jsoned = $json->pretty->encode( $message->prepare_raygun );
### json : $jsoned
my $req = HTTP::Request->new( P
req->header( 'Content-Type' => 'application/json' );
$req->header( 'X-ApiKey' => $api_key );
$req->content($jsoned);
### json message : $jsoned;
my $response = $ua->request($req);
d::Signatures;
use namespace::autoclean;
extends 'WebService::SendGrid';
use URI;
use Carp;
use JSON::XS;
use DateTime::Format::HTTP;
use Mail::RFC822::Address qw(valid);
subtype 'Email', as 'Str',
headers' => ( is => 'rw', isa => 'HashRef', required => 0 );
# A collection of key/value pairs in JSON format
has 'date' => ( is => 'rw', isa => 'Str', required => 1, default => sub {
DateTime::Form
ate_request('/api/mail.send.json', \%data);
my $res = $self->_dispatch_request($req);
return $self->_process_error($res) if $res->code != 100;
my $content = decode_json $res->content;
}
1;
__E