afc',
);
# return link for open in browser
say $oauth->get_code();
# return JSON with access_token
say Dumper $oauth->get_token( code => 3557461 );
=head1 DESCRIPTION
Yande
oauth-intro-docpage/
=cut
package Yandex::OAuth;
use 5.008001;
use utf8;
use Modern::Perl;
use JSON::XS;
use URI::Escape;
use LWP::UserAgent;
use Moo;
our $VERSION = "0.07";
has 'ua' => (
i
return a json with access_token or error if code has expired
$oauth->get_token( code => XXXXXX );
=cut
sub get_token {
my ( $self, %params ) = @_;
return JSON::XS::decode_json( $self->
JSON;
use MIME::Base64 qw( encode_base64 decode_base64 );
use Exporter 'import';
our @EXPORT_OK = qw(
encode_json_for_signing
encode_base64_unpadded
decode_base64
sign_json signed_json
verify_json_signature
redact_event redacted_event
sign_event_json signed_event_json
verify_event_json_signature
);
my $sign = Crypt::NaCl::Sodium->sign;
my $json_canon = JSON->new
=cut
=head1 FUNCTIONS
=cut
=head2 encode_json_for_signing
$json = encode_json_for_signing( $data )
Encodes a given HASH reference as Canonical JSON, having removed the
C<signatures> and C<uns
::VerifyEmail::VERSION = '0.03';
use 5.006;
use Moo;
use Net::HTTP::Tiny qw(http_get);
use JSON qw(decode_json);
use WebService::VerifyEmail::Response;
has username => (is => 'ro');
has password => (
rd,
$email_address);
return WebService::VerifyEmail::Response->new( decode_json( http_get($url) ) );
}
1;
=head1 NAME
WebService::VerifyEmail - check validity of an email add
req = POST('http://example.com/foo?param=value&pet=dog',
Content_Type => 'application/json',
Content_MD5 => 'Sd/dVLAcvNLSq16eXua5uQ==',
Content_Length => 18,
req = POST('http://example.com/foo?param=value&pet=dog',
Content_Type => 'application/json',
Content_MD5 => 'Sd/dVLAcvNLSq16eXua5uQ==',
Content_Length => 18,
e warnings;
our $VERSION = '0.6.1'; # VERSION
use attributes;
use JSON::XS;
use Mojo::UserAgent;
use Data::Dumper;
use Mojo::JSON;
sub new {
my $that = shift;
my $proto = ref($that) || $t
$self->{endpoint};
}
sub get_plugins {
my ($self) = @_;
$self->_get("/plugins")->res->json;
}
sub auth {
my ( $self, $user, $pass ) = @_;
my ( $proto, $endpoint ) =
( $self-
elf->_ua->post( "$proto$user:$pass\@$endpoint/1.0/user/login",
json => {} )->res->json;
if ( $ref->{ok} == Mojo::JSON->true ) {
return $ref->{data};
}
return 0;
}
sub _u
strict;
use warnings;
our $VERSION = '0.01';
use base 'SMS::Send::Driver';
use MIME::Base64;
use JSON;
use Data::Dumper;
sub new {
my ($class, %args) = @_;
die "$class needs hash_ref with _login a
t as _sender to new. Max 11 chars.
return $self;
}
sub send_sms {
my ($self, %args) = @_;
my $json_args = {
text => "$args{'text'}",
to => "sms:$args{'to'}"
e => "text",
sms_originator_text => "$self->{_sender}"
};
my $response = _post($self, to_json($json_args));
if ($response->{status} eq "200") {
return 1;
}
return 0;
}
sub _post {
my ($se
onfig;
}
use Ukigumo::Agent::Dispatcher;
use Ukigumo::Logger;
__PACKAGE__->load_plugins(qw(Web::JSON ShareDir));
sub dispatch {
my ($c) = @_;
return Ukigumo::Agent::Dispatcher->dispatch($c)
8;
use Amon2::Web::Dispatcher::RouterBoom;
use Ukigumo::Agent::Manager;
use Data::Validator;
use JSON;
get '/' => sub {
my $c = shift;
$c->render(
'index.tt' => {
childr
my $res = $c->render_json({errors => $errors});
$res->code(400);
return $res;
}
$c->manager->register_job(+{%$args});
return $c->render_json(+{});
};
post '/api/git
= shift;
$c->logger->infof("payload: %s", $c->req->param('payload'));
my $payload = from_json $c->req->param('payload');
my $args;
if (!$payload->{deleted} and my $ref = $payload->{re
ata};
my $ret = $cl->call(
"POST", "1.0", "user",
user => undef,
ref => $self->req->json->{data},
);
my $ret = $cl->call( "DELETE", "1.0", "user", user => $self->param("user_id") );
($status, $expires, @rr) = @_;
if ($status == EV::ADNS::s_ok) {
use JSON::XS;
warn encode_json \@rr;
}
}
The format of result records varies considerably, here is som
chmark::Forking qw(timethis timethese cmpthese);
use Time::Out qw(timeout);
use Time::HiRes;
use JSON;
use Net::Riak;
use Data::Riak;
use Data::Riak::Fast;
use Riak::Tiny;
use FindBin qw($Bin);
use
foo_data_riak',
riak => $data_riak_client
}
);
$data_riak_bucket->add( key => encode_json($hash) );
my $data_riak_fast_client = Data::Riak::Fast->new(
{ transport => Data::Riak::Fa
ast',
riak => $data_riak_fast_client
}
);
$data_riak_fast_bucket->add( key => encode_json($hash) );
my $riak_tiny_client = Riak::Tiny->new( host => 'http://127.0.0.1:8098' );
cmpthese(
qw(timethis timethese cmpthese);
use Net::Riak;
use Time::Out qw(timeout);
use Time::HiRes;
use JSON;
use FindBin qw($Bin);
use lib "$Bin/../lib";
use Riak::Light;
die "please set the RIAK_PBC_HOS
foo_data_riak',
riak => $data_riak_client
}
);
$data_riak_bucket->add( key => encode_json($hash) );
use Data::Riak::Fast;
my $data_riak_fast_client = Data::Riak::Fast->new(
{ tran
ey => encode_json($hash) );
use Riak::Tiny;
my $riak_tiny_client = Riak::Tiny->new( host => 'http://127.0.0.1:8098' );
$riak_tiny_client->new_object( foo_riak_tiny => key => encode_json($hash) );
mbridge::VERSION = '0.02';
use Moose;
use HTTP::Request;
use LWP::UserAgent;
use URI::Encode;
use JSON;
use namespace::autoclean;
with 'Dictionary::Cambridge::Response';
has "base_url" => (
is
=> 'ro',
isa => 'URI::Encode',
lazy_build => 1
);
has "json" => (
is => 'ro',
isa => 'JSON',
lazy_build => 1
);
sub _build_user_agent {
return LWP::Use
Request->new();
}
sub _build_encode_uri {
return URI::Encode->new();
}
sub _build_json {
return JSON->new()->utf8;
}
sub get_entry {
my ( $self, $word ) = @_;
my $response;
r::Util qw(blessed);
use IO::Socket;
use Socket qw(TCP_NODELAY IPPROTO_TCP);
use Const::Fast;
use JSON;
use Carp;
use Module::Runtime qw(use_module);
use Moo;
# ABSTRACT: Fast and lightweight Perl cl
$vclock ) =
$check->(@_);
( $content_type ||= 'application/json' ) eq 'application/json'
and $value = encode_json($value);
$self->_store( $bucket, $key, $value, $content_type, $i
$check->(@_);
my @args;
push @args, ref($request) ? encode_json($request) : $request;
push @args, 'application/json';
push @args, $callback if $callback;
$self->map_reduce_raw(
package Catalyst::TraitFor::Request::QueryFromJSONY;
use Moo::Role;
use JSONY;
our $VERSION = '0.002';
has query_data_options => (
is=>'ro',
required=>1,
lazy=>1,
builder=>'build_query_data
$param, $err) = @_; die $err },
};
}
has _jsony => (
is=>'ro',
required=>1,
lazy=>1,
builder=>'build_jsony');
sub build_jsony { JSONY->new }
has _query_data_cache => (
is=>'ro',
->{$_} :
$local_options{param_missing}->($self, $_);
my $deserialized = eval { $self->_jsony->load($val) }
|| $local_options{parse_error}->($self, $val, $@);
$self->_query_data_
rom the command line
$ catmandu convert Zotero --userID <userID> to JSON
$ catmandu convert Zotero --groupID <groupID> to JSON
# From Perl
use Catmandu;
my $importer = Catmandu->importer
----------------------
sub _metapath
{
my ($mod) = @_;
my $metapath;
for my $ext (qw/json yml/) {
my $p = catfile($mod->status->extract, "META.$ext");
if (-f $p) {
return if ( $d eq $b );
}
return $d;
}
#--- PRIVATE METHOD ---
# We read the META.json or META.yml file with Parse::CPAN::META and extract
# data needed for makedepends and pkgdesc if
odobj) = ($self->status, $self->parent);
# Leave metareqs undef if there is no META.yml/META.json.
my $path = _metapath($modobj) or return;
my $meta = eval { Parse::CPAN::Meta::LoadFi
} = 1;
}
return $self->render(json => $aResponse);
}
else {
$aResponse->{error} = 1;
return $self->render(json => $aResponse);
}
}
);
$r->rout
the command line
$ catmandu convert Zotero --userID <userID> to JSON
$ catmandu convert Zotero --groupID <groupID> to JSON
# From Perl
use Catmandu;
my $importer = Catmandu->i
e:
use PerlX::QuoteOperator::URL 'qh';
use JSON qw(decode_json);
say decode_json( qh{ http://twitter.com/statuses/show/6592721580.json } )->{text};
# => "He nose the truth."
=