view release on metacpan or search on metacpan
lib/Finance/Bank/Paytrail.pm view on Meta::CPAN
(Nice-to-have) Populated when you call submit. The entire unprocessed response content.
=cut
has 'server_response' => ( is => 'rw' ); # the response as a perl data structure, decoded from json
=head2 result_code
(Nice-to-have) Populated when you call submit. The HTTP status code of the reply.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/BitFlip.pm view on Meta::CPAN
my $url = "$url_prefix$method_args";
my $res = $self->{_http}->get($url);
die "Can't retrieve $url: $res->{status} - $res->{reason}"
unless $res->{success};
my $decoded;
eval { $decoded = $self->{_json}->decode($res->{content}) };
die "Can't decode response from $url: $@" if $@;
log_trace("API GET response: %s", $decoded);
die "API response not an array: $decoded" unless ref $decoded eq 'ARRAY';
die "API response is not success: $decoded->[0] - $decoded->[1]" if defined $decoded->[0];
$decoded;
}
sub post_request {
my ($self, $method, %args) = @_;
lib/Finance/BitFlip.pm view on Meta::CPAN
my $url = "$url_prefix$method";
my $res = $self->{_http}->post($url, $options);
die "Can't retrieve $url: $res->{status} - $res->{reason}"
unless $res->{success};
my $decoded;
eval { $decoded = $self->{_json}->decode($res->{content}) };
die "Can't decode response from $url: $@" if $@;
log_trace("API POST response: %s", $decoded);
die "API response not an array: $decoded" unless ref $decoded eq 'ARRAY';
die "API response is not success: $decoded->[0] - $decoded->[1]" if defined $decoded->[0];
$decoded;
}
1;
# ABSTRACT: Trade with bitflip.li using Perl
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/Bitcoin/Yacuna.pm view on Meta::CPAN
elsif('POST' eq $httpMethod){
my $req = new HTTP::Request('POST', $self->{'uri'} . $self->{'basePath'} . $self->{'apiVersion'}.'/'.$restPath);
$req->content_type('application/x-www-form-urlencoded');
$req->content($body);
my $res = $self->{'httpClient'}->request($req);
return $res->decoded_content;
}
};
return $self->{'httpClient'}->response->decoded_content if $self->{'httpClient'}->response;
}
sub prepareAuth(){
my ($path, $body, $httpMethod, $apiSecret, $debug) = @_;
my $tokenSalt = ''.time*1000;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/Card/Discover.pm view on Meta::CPAN
return unless $res->is_success;
# The response content is a url-encoded string.
my %data = do {
my $u = URI->new;
$u->query($res->decoded_content);
$u->query_form
};
return if not %data or 'error' eq $data{action};
return \%data;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/CoinbasePro/Lite.pm view on Meta::CPAN
log_trace("JSON API request: %s", $url);
my $res = $self->{_http}->get($url);
die "Can't retrieve $url: $res->{status} - $res->{reason}"
unless $res->{success};
my $decoded;
eval { $decoded = $self->{_json}->decode($res->{content}) };
die "Can't decode response from $url: $@" if $@;
log_trace("JSON API response: %s", $decoded);
$decoded;
}
sub _request {
my ($self, $is_private, $method, $request_path, $params) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
CompanyNames/TextSupport.pm view on Meta::CPAN
declassification declassified declassify declassifying
declayed declaying
declination declinations decline declined decliner decliners declines declining
declinist declinists
declutched declutching
decodable decode decoded decoder decoders decodes decoding
decoked decoking
decollation decollators
decollete decolletes
decolonization decolonize decolonized decolonizing
decoloration decolored decoloring
CompanyNames/TextSupport.pm view on Meta::CPAN
precursor precursors precursory
precusor precusors
predate predation predator predators
predecease predeceases
predecessor predecessors
predecoded predecoder
predefinable predefine predefined predefines predefining
predeterminable predeterminately predetermine predetermined predetermining
predicate predicated predicates
predict predictabilities predictability predictable predictably predictated predicted predicting prediction predictions predictive predictively predicts
predictor predictors
CompanyNames/TextSupport.pm view on Meta::CPAN
decliner
decliners
declines
declining
decode
decoded
decoder
decoders
decodes
decoding
decodings
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/Crypto/Exchange/Kraken.pm view on Meta::CPAN
my $response = $self->ua->request($req);
if ($response->is_success) {
my $data;
try {
$data = decode_json($response->decoded_content);
}
catch {
die "Unable to decode JSON from Kraken!", $/;
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/Dogecoin/API.pm view on Meta::CPAN
while (my ($key, $value) = each %params) {
$uri->query_param( $key => $value );
}
my $response = $self->ua->get( $uri );
my $result = $self->json->decode( $response->decoded_content );
Carp::croak( "Bad API call from $method() call" ) if $result eq 'Bad Query';
Carp::croak( "Invalid API key '" . $self->api_key . "'" )
if $result eq 'Invalid API Key';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/Indodax.pm view on Meta::CPAN
log_trace("JSON API request: %s", $url);
my $res = $self->{_http}->get($url);
die "Can't retrieve $url: $res->{status} - $res->{reason}"
unless $res->{success};
my $decoded;
eval { $decoded = $self->{_json}->decode($res->{content}) };
die "Can't decode response from $url: $@" if $@;
log_trace("JSON API response: %s", $decoded);
$decoded;
}
sub tapi {
my ($self, $method, %args) = @_;
lib/Finance/Indodax.pm view on Meta::CPAN
my $url = "$url_prefix/tapi/";
my $res = $self->{_http}->post($url, $options);
die "Can't retrieve $url: $res->{status} - $res->{reason}"
unless $res->{success};
my $decoded;
eval { $decoded = $self->{_json}->decode($res->{content}) };
die "Can't decode response from $url: $@" if $@;
log_trace("TAPI response: %s", $decoded);
die "API response not a hash: $decoded" unless ref $decoded eq 'HASH';
die "API response is not success: $decoded->{error}" unless $decoded->{success};
$decoded;
}
sub _check_pair {
my $pair = shift;
$pair =~ /\A(\w{3,5})_(\w{3,5})\z/
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/PremiumBonds.pm view on Meta::CPAN
if (!$resp->is_success) {
warn "Request failed - " . $resp->status_line;
return;
}
my $resp_data = JSON::from_json($resp->decoded_content);
if ($resp_data->{holder_number} eq 'is_invalid') {
carp "Holder number not recognised by NS+I";
return;
}
view all matches for this distribution
view release on metacpan or search on metacpan
devel/Casablanca.pm view on Meta::CPAN
foreach my $symbol (@symbol_list) {
my $url = make_url ($symbol);
my $req = HTTP::Request->new ('GET', $url);
$ua->prepare_request ($req);
$req->accept_decodable; # we know decoded_content() below
$req->user_agent (__PACKAGE__."/$VERSION " . $req->user_agent);
### Request: $req->as_string
my $resp = $ua->request ($req);
resp_to_quotes ($fq, $symbol, $resp, \%quotes);
devel/Casablanca.pm view on Meta::CPAN
$quotes->{$symbol,'currency'} = 'MAD';
$quotes->{$symbol,'source'} = __PACKAGE__;
$quotes->{$symbol,'success'} = 1;
# defaults to latin1, which is right
my $content = $resp->decoded_content (raise_error => 1, charset => 'none');
if (! $resp->is_success) {
$quotes->{$symbol,'success'} = 0;
$quotes->{$symbol,'errormsg'} = $resp->status_line;
return;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/Quote/IEX.pm view on Meta::CPAN
$info{ $symbol, 'errormsg' }
= sprintf( $errormsg, $symbol, $url, $code, $desc );
next;
}
my $data = decode_json( $response->decoded_content );
if ( !defined $data->{latestPrice} ) {
my $code = $response->code;
my $desc = status_message($code);
$info{ $symbol, 'success' } = 0;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/Quote/ASX.pm view on Meta::CPAN
$error = "Failed to parse JSON data from ASX server '$url'. Error: '$@'.";
### ASX.pm Error: $error
return $status, $error, undef;
}
# Return valid, decoded data
$status = 1;
return $status, $error, $data;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finnigan.pm view on Meta::CPAN
my $o = Finnigan::Object->decode(\*STREAM, $arg);
$o->dump;
where 'Object' is a symbol for any of the specific decoder objects
(C<Finnigan::*>) and C<STREAM> is an open filehandle positioned at the
start of the structure to be decoded. Some decoders may require an
additional argument (file format version).
=head1 DESCRIPTION
C<Finnigan> is a non-functional package whose only purpose is to pull
lib/Finnigan.pm view on Meta::CPAN
=item decode($stream, $arg)
Each C<Finnigan::*> object has a constructor method named C<decode()>,
whose first argument is a filehandle positioned at the start of the
object to be decoded. Some decoders require additional arguments, such
as the file version number. A single argument is passed as it is,
while multiple arguments can be passed as an array reference.
The constructor advances the handle to the start of the next object,
so seeking to the start of the object of interest is only necessary
lib/Finnigan.pm view on Meta::CPAN
calling of object constructors in sequency. In reality, it is often
more efficient to seek ahead to fetch an index structure stored near
the end of the file, then go back to the data stream using the
pointers in the index.
The decoded data can be obtained by calling accessor methods on the
object or by de-referencing the object reference (since all Finnigan
objects are blessed hash references):
$x = $object->element
lib/Finnigan.pm view on Meta::CPAN
=item dump(%args)
All Finnigan objects are the descendants of L<Finnigan::Decoder>. One
of the methods they inherit is C<dump>, which provides an easy way to
explore the contents of decoded objects. The C<dump> method prints out
the structure of the object it is called on in a few styles, with
relative or absolute addressess.
For example, many object dumps used in L<this
wiki|http://code.google.com/p/unfinnigan/wiki/WikiHome> were created
lib/Finnigan.pm view on Meta::CPAN
inspecting the structures with the C<dump> method.
This may seem like a kludgy way of reading four bytes, but the upshot
is that the resulting C<$object> will have the size, type and location
information tucked into it, so it can be analysed and dumped in a way
consistent with other decoded objects. The advantage becomes even more
apparent when the structure is more complex than a single scalar object.
The inherited C<read> method provides the core functionality in all Finnigan
decoders.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Firebase.pm view on Meta::CPAN
sub process_response {
my ($self, $response) = @_;
$self->debug($response->header('X-Firebase-Auth-Debug'));
if ($response->is_success) {
if ($response->decoded_content eq 'null') {
return undef;
}
else {
my $result = eval { from_json($response->decoded_content) };
if ($@) {
warn $response->decoded_content;
ouch 500, 'Server returned unparsable content.';#, { error => $@, content => $response->decoded_content };
}
return $result;
}
}
else {
ouch 500, $response->status_line, $response->decoded_content;
}
}
=head1 NAME
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Flickr/API.pm view on Meta::CPAN
if ($response->{_rc} != 200){
$response->set_fail(0, "API returned a non-200 status code ($response->{_rc})");
return $response;
}
my $content = $response->decoded_content();
$content = $response->content() unless defined $content;
my $xls = XML::LibXML::Simple->new(ForceArray => 0);
my $tree = XML::Parser::Lite::Tree::instance()->parse($content);
lib/Flickr/API.pm view on Meta::CPAN
if ($response->{_rc} != 200){
$response->set_fail(0, "Upload returned a non-200 status code ($response->{_rc})");
return $response;
}
my $content = $response->decoded_content();
$content = $response->content() unless defined $content;
my $xls = XML::LibXML::Simple->new(ForceArray => 0);
my $tree = XML::Parser::Lite::Tree::instance()->parse($content);
lib/Flickr/API.pm view on Meta::CPAN
$orequest->sign;
my $response = $self->get($orequest->to_url);
my $content = $response->decoded_content();
$content = $response->content() unless defined $content;
if ($content =~ m/^oauth_problem=(.+)$/) {
carp "\nRequest token not granted: '",$1,"'\n";
lib/Flickr/API.pm view on Meta::CPAN
$request->sign;
my $response = $self->get($request->to_url);
my $content = $response->decoded_content();
$content = $response->content() unless defined $content;
if ($content =~ m/^oauth_problem=(.+)$/) {
carp "\nAccess token not granted: '",$1,"'\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Flickr/API2/Raw.pm view on Meta::CPAN
my $response = $self->do_request($request);
croak("API call failed with HTTP status: " . $response->code)
unless $response->code == 200;
my $content = $response->decoded_content;
$content = $response->content() unless defined $content;
my $json = eval { decode_json($content) };
if ($@) {
croak("Failed to parse API response as JSON. Error=$@\nContent=$content\n");
view all matches for this distribution