troller::REST'; }
__PACKAGE__->config(
namespace => 'api/1.0',
default => 'application/json',
);
=head1 NAME
CPAN::Mini::Inject::REST::Controller::API::Version1_0
=head1 DESCRIPTION
Cat
odule => $module, version => $version};
# Add all modules listed in META.json / META.yml
if (my $meta = _load_meta($newfile)) {
while (my ($module,
$archive->extract(to => "$vol/$dir");
if (my @meta = File::Find::Rule->file->name('META.json')->in("$vol/$dir")) {
return Parse::CPAN::Meta->load_file(shift @meta);
}
if (my
rict;
use warnings;
use v5.10;
use FindBin '$Bin';
use lib "$Bin/../lib";
use Net::LastFMAPI;
use JSON::XS;
use YAML::Syck;
die "usage: $0 user.whatEver something=nothing nothing=Some Things etc=etc\
use Alice::HTTP::Request;
use Alice::HTTP::Stream::XHR;
use Alice::HTTP::Stream::WebSocket;
use JSON;
use Encode;
use Any::Moose;
has app => (
is => 'ro',
isa => 'Alice',
required => 1,
);
new_server', $name);
my $listitem = $self->render('server_listitem', $name);
$res->body(to_json({config => $config, listitem => $listitem}));
$res->header("Cache-control" => "no-cache");
$r
$self, $req, $res) = @_;
$res->content_type("text/plain; charset=utf-8");
{
$res->body(to_json($self->app->config->serialized,
{utf8 => 1, pretty => 1}));
}
$res->send;
}
__PACKAGE_
::JSON;
use Mojo::URL;
use WebService::PutIo::Result;
use Carp qw/croak/;
__PACKAGE__->attr([qw/api_key api_secret/]);
__PACKAGE__->attr(ua => sub { Mojo::UserAgent->new; });
__PACKAGE__->attr(json =
> sub { Mojo::JSON->new; });
sub request {
my ($self,$class,$method,%params)=@_;
croak "Must set api_key and api_secret" unless $self->api_key && $self->api_secret;
$params ||= ();
my $data={
a
od")
->query(method=>$method);
my $tx=$self->ua->post_form( $url => { request => $self->json->encode($data) } );
if (my $res=$tx->success) {
return WebService::PutIo::Result->new( respons
astFMAPI;
use strict;
use warnings;
use v5.10;
use LWP::UserAgent;
use Digest::MD5 'md5_hex';
use JSON::XS;
use YAML::Syck;
use File::Slurp;
use File::Path 'make_path';
use File::HomeDir 'my_home';
us
y $file = shift;
my $json = encode_json(shift);
write_file($file, $json);
}
sub loadfile {
my $file = shift;
my $json = read_file($file);
decode_json($json);
}
#{{{
our $methods =
}
}
$params{method} = $method;
$params{api_key} = $api_key;
$params{format} = "json" unless $params{format} || $xml;
delete $params{format} if $params{format} && $params{format}
is => 'ro',
isa => Serializer,
required => 1,
default => 'JSON',
coerce => 1,
);
has destination => (
is => 'rw',
isa => 'Str
qIO;
use Moose;
use Bio::Chado::Schema;
use File::Spec::Functions;
use App::Mimosa::Database;
use JSON::Any;
use namespace::autoclean;
BEGIN { extends 'Catalyst::View::Bio::SeqIO' };
__PACKAGE__->c
Mini::Inject::REST::Client::API;
use Moose;
use Carp qw/confess/;
use HTTP::Request::Common;
use JSON;
use MIME::Base64;
use REST::Client;
use Try::Tiny;
use URI;
has 'host' => (isa => 'Str', is
----------
sub process {
my ($self, $response) = @_;
my $content = try {
decode_json($response->responseContent);
} catch {
$response->responseContent;
};
;
$type = 'json' unless $type;
open my $fh, '<:encoding(utf-8)', $file or die "opening $file - $!";
my $txt = do { local $/; <$fh> };
if($type eq 'json') {
require JSON;
return JSON->new->deco
nce;
use Moose;
use Bio::Chado::Schema;
use File::Spec::Functions;
use App::Mimosa::Database;
use JSON::Any;
use Data::Dumper;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller' };
sub
$mimosa_sequence_set_id, $name ) = @_;
my $bcs = $c->model('BCS');
my $return_json = ( $name =~ m/\.json$/ );
$name =~ s/\.txt$//g;
$name =~ s/\.fasta$//g;
# Mimosa resultsets
/;
use Mojo::JSON;
use Carp qw/croak/;
__PACKAGE__->attr(qw/response/);
__PACKAGE__->attr('json' => sub { Mojo::JSON->new });
__PACKAGE__->attr( data => sub { my $self=shift;$self->json->decode($sel
representing the response from put.io
=head2 json
JSON object for deserializing. Defaults to a plain L<Mojo::JSON>.
=head2 data
The deserialized JSON body.
=head1 METHODS
=head2 count
Number
oogle::Language;
use 5.006;
use strict;
use warnings;
our $VERSION = '0.14';
use Carp ();
use JSON 2.0 ();
use LWP::UserAgent;
use URI;
use constant GOOGLE_DETECT_URL => 'http://ajax.googleapi
$value;
}
}
for (qw'json ua') {
if (defined(my $value = delete $conf{$_})) {
$self->$_($value);
}
}
unless ($self->json) {
$self->json(JSON->new);
}
unless ($self->
sub json {
my $self = shift;
if (@_) {
my $json = shift;
Carp::croak q{'json' requires an object based on 'JSON'}
unless $json && $json->isa('JSON');
$self->{json} = $json;
To use the Perl client library, you must be running Perl >= 5.8.8.
You also need to use LWP and JSON >=2.0
The snippets of sample code in this document can be copied and pasted into your code and t
se class wrapping json atom feed entry tags for google data API v2.
=head1 SYNOPSIS
use WebService::GData::Feed::Entry;
my $feed = new WebService::GData::Feed::Entry($jsonfeed->{entry}->[0]
m L<WebService::GData::Feed>>
This package wraps the entry tag from a query for a feed using the json format of the Google Data API v2
(no other format is supported!).
It gives you access to some of
ead3 new
=over
Accept the content of the entry tag from a feed that has been perlified (from_json($json_string))
and an optional request object,L<WebService::GData::Base>.
The request object is no
ft;
$this->{_query} = {
'v' => GDATA_MINIMUM_VERSION,
alt => JSON,
prettyprint => FALSE,
strict => TRUE,
};
return $this;
}
sub set_
ry_string();# by default:?alt=json&v=2&prettyprint=false&strict=true
#?alt=jsonc&v=2&prettyprint=false&strict=true&start-index=1&max-results=10
$query->alt('jsonc')->limit(10,1)->to_query_str
ing();
print $query->get('alt');#jsonc
$query->v(1);#throw an error as only 2 is ok.
$query->prettyprint(1);#throw an error as only 'true' or 'false' is possible.
#use constants whe
vice::GData::Query;
use WebService::GData::Error;
use WebService::GData::Constants qw(:all);
use JSON;
use LWP;
#the base class specifies the basic get/post/insert/update/delete methods
our $VERSIO
st($req);
my $ret = $this->_request($req);
return $this->query->get('alt') =~ m/^jsonc*$/ ? from_json($ret) : $ret;
}
sub post {
my ( $this, $uri, $content ) = @_;
_error_invali_ur
tent,$callback);
#modify the query string query string: ?alt=jsonc&v=2&prettyprint=false&strict=true
$base->query->alt('jsonc')->prettyprint('false');
#overwrite WebService::GData::Que
ta::Feed - Base class wrapping json atom feed for google data API v2.
=head1 SYNOPSIS
use WebService::GData::Feed;
my $feed = new WebService::GData::Feed($jsonfeed);
$feed->title;
TION
I<inherits from L<WebService::GData>>
This package wraps the result from a query using the json format of the Google Data API v2 (no other format is supported!).
It gives you access to some of
ad3 new
=over
Create a L<WebService::GData::Feed> instance.
Accept a json feed entry that has been perlified (from_json($json_string)) and an optional request object (L<WebService::GData::Base>).
T
te a L<WebService::GData::YouTube::Feed::Video> instance.
=back
B<Parameters>:
=over
=item C<jsonc_video_entry_feed:Object> (Optional)
=item C<authorization:Object> (Optional)
or
=item C<auth
deo->id('video_id')
=head1 CONFIGURATION AND ENVIRONMENT
none
=head1 DEPENDENCIES
L<JSON>
L<LWP>
=head1 INCOMPATIBILITIES
none
=head1 BUGS AND LIMITATIONS
If you do me the favor to
hsearch { shift->_get('V1/json/urlItemMatchSearch', @_); }
sub urlitemmatchlookup { shift->_get('V1/json/urlItemMatchLookup', @_); }
sub urlitemmatchadd { shift->_get('V1/json/urlItemMatchAdd', @_); }
sub urlitemmatchremove { shift->_get('V1/json/urlItemMatchRemove', @_); }
1;
$this->{namespaces} = {};
if ( ref( $args[0] ) eq 'HASH' ) {
#accept a text tag but json feed uses $t tag so adapt
#for compatibility
if ( $args[0]->{'$t'} ) {
bService::GData::Node::Category(scheme=>'author','yt:term'=>'Author');
#or coming from a json feed:
my $category = new WebService::GData::Node::Category({scheme=>'author','yt$term'=>'Auth
y the representation of one xml tag. Feed and Feed subclasses are the representation of an entire JSON response
or offers a subset.
See also:
=over
=item * L<WebService::GData::Node::AbstractEntity