del
__PACKAGE__->config(
server => 'http://localhost:3000',
type => 'application/json',
clientattrs => {timeout => 5},
);
# controller
sub foo : Local {
my ($self, $c) = @_;
_url => $self->url,
trace => $self->debug
);
$client->enable('Format::JSON');
$client->enable('Auth::Basic', username => $self->username, password => $self->passwor
, mail (team inbox).
item tags
List of tags to be added to the message. Can be either an array (JSON only) or a string with tags delimited with commas. User tags should start with '@'. Hashtags can
trict;
use warnings;
use JSON;
use LWP::UserAgent;
use URI::Encode qw( uri_encode );
use Carp qw/croak/;
my $API_BASE = 'http://api.facebook.com/method/fql.query?format=json&query=';
sub query {
encode( $API_BASE . $args->{query} ) );
if ( $response->is_success ) {
return decode_json $response->content;
}
else {
croak $response->status_line;
}
}
1;
__END__
ike_count FROM link_stat WHERE url="http://twitter.com"'
});
Returns a hash reference of the JSON returned from the API.
=head1 SEE ALSO
L<Facebook>, L<WWW::Facebook::API>, L<WWW::Facebook::FQL
:ConfigLoader::General>
L<Catalyst::Plugin::ConfigLoader::INI>,
L<Catalyst::Plugin::ConfigLoader::JSON>,
L<Catalyst::Plugin::ConfigLoader::Perl>,
L<Catalyst::Plugin::ConfigLoader::XML>, and
L<Catalyst
> files
and Maketext classes under your application's I18N namespace.
=head2 L<Catalyst::Plugin::JSONRPC>
=head2 L<Catalyst::Plugin::Message>
=head2 L<Catalyst::Plugin::MobileAgent>
=head2 L<Catal
ering pages with L<HTML::Template>.
=head2 L<Catalyst::View::Jemplate>
=head2 L<Catalyst::View::JSON>
=head2 L<Catalyst::View::Mason>
A view component for rendering pages with L<HTML::Mason>.
=he
Net::Flowdock::Stream::VERSION = '0.01';
}
use Moose;
# ABSTRACT: Streaming API for Flowdock
use JSON;
use MIME::Base64;
use Net::HTTPS::NB;
has token => (
is => 'ro',
isa => 'Str',
);
Authorization => 'Basic ' . MIME::Base64::encode($auth),
Accept => 'application/json',
);
my ($code, $message, %headers) = $s->read_response_headers;
die "Unable to conn
$self->_readbuf($buf);
warn "New event:\n$chunk" if $self->debug;
return decode_json($chunk);
}
return;
}
__PACKAGE__->meta->make_immutable;
no Moose;
1;
__END__
=pod
=
my ($self, $msg) = @_;
my $bytes = Protocol::WebSocket::Frame->new
( buffer => JSON::encode_json($msg),
version => $self->version)->to_bytes;
$self->h->push_write($bytes);
}
::Strava - Interface to the Strava API version 2
=cut
use Any::Moose;
use Any::URI::Escape;
use JSON;
use LWP::UserAgent;
use Data::Dumper;
has 'ride' => ( is => 'rw', isa => 'Int', required => 0 )
ON = 0.01;
our $Ua = LWP::UserAgent->new( agent => join( '_', __PACKAGE__, $VERSION ) );
our $Json = JSON->new->allow_nonref;
=head1 METHODS
=over 4
=item efforts
$s = WebService::Strava->new;
my $res = $Ua->get($url);
die "query for $url failed!" unless $res->is_success;
$res = $Json->decode( $res->content );
my @efforts;
# $DB::single = 1;
foreach my $effort ( @{ $re
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\
oose;
use Net::SSLeay qw/die_now die_if_ssl_error/;
use Socket;
use Encode qw(decode encode);
use JSON::XS;
our $VERSION = '0.0202';
has message => (
is => 'rw',
isa => 'Str',
de
>custom} > 0) {
$data->{custom} = $self->custom;
}
my $jsonxs = JSON::XS->new->utf8(1)->encode($data);
$jsonxs =~ s/("badge":)"([^"]+)"/$1$2/;
return
chr(0)
. pa
ck( 'n', 32 )
. pack( 'H*', $self->devicetoken )
. pack( 'n', length($jsonxs) )
. $jsonxs;
}
sub write {
my ( $self, $args ) = @_;
if ( $args->{devicetoken} ) { $self->de
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}
t_api_declare cronio => (
api_base_url => 'http://api.cron.io/v1',
api_format => 'json',
api_format_mode => 'content-type',
authentication => 1,
);
net_api_method create_use
strict;
use warnings;
use Config::Tiny;
use LWP::Authen::OAuth2;
use JSON qw(decode_json encode_json);
use JSON::Parse 'valid_json';
use Carp qw(croak);
use File::Basename;
use File::MimeInfo::Magic;
);
my $json = $response->decoded_content;
if (! valid_json($json) ) {
croak("Something went wrong, a JSON string wasn't returned");
}
if ($ENV{STRAVA_DEBUG}) {
say Dumper($json);
}
return decode_json($json);
}
method delete_api($api_path) {
my $response = $self->auth->delete($self->{api_base}.$api_path);
if ($ENV{STRAVA_DEBUG}) {
say Dumper($response);
}
return $r
to set description and path of self.
sub create {
my $self = shift;
my $payload = $self->json->encode({description => $self->description, name => $self->name});
$self->fin->post(
ders => $self->fin->headers_for_json,
payload => $payload,
on_success => sub {
my $response = shift;
my $h = $self->json->decode($response->content);
ts,
headers => $fin->accept_header_for_json,
on_success => sub {
my $response = shift;
my $h = $class->json->decode($response->content);
my $ns =
nteger,
# and it won't pick it as float unless you serialise it explicitly as such: "5.0".
sub to_json {
my $self = shift;
no warnings; # value may not be a number
my $float = 0 + $self->
ault
codec for a directory or filesystem.
$directory->codec('json');
$file = $directory->file('foo.json'); # has json codec set
=head1 AUTHOR
Andy Wardley L<http://wardley.org/>
=he
;
use Moose;
extends 'Net::Fluidinfo::Value::Native';
# A Perl integer is a JSON integer. Sanitize with int().
sub to_json {
my $self = shift;
no warnings; # the value may not be an integer i
',
url => 'Badger::Codec::URL',
yaml => 'Badger::Codec::YAML',
json => 'Badger::Codec::JSON',
html => 'Badger::Codec::HTML',
tt => 'Badger::Codec::TT',
m
ows options to default to
the values set by preceeding options.
Changed L<Badger::Codec::JSON> to use L<JSON::XS> if available.
Mr T is now using Badger 0.06 in production code and is happy to repo
extensions quiet',
words => 'ENCODING CODECS',
constants => 'DOT NONE TRUE FALSE YAML JSON UTF8 ARRAY HASH SCALAR',
constant => {
ABSOLUTE => 'absolute',
RELATIVE => '
merge_mismatch => 'Cannot merge items for %s: %s and %s',
};
our $EXTENSIONS = [YAML, JSON];
our $ENCODING = UTF8;
our $CODECS = { };
our $STAT_TTL = 0;
#------------------------
# Configuration files can be in any data format which Badger::Codecs can
# handle (e.g. JSON, YAML, etc). The 'extensions' configuration option
# and any $EXTENSIONS defined in package
ecs are for encoding and decoding data between all sorts of different
formats: Unicode, Base 64, JSON, YAML, Storable, and so on. Codecs are
simple wrappers around existing modules that make it tri