f->ua(shift);
return $self;
}
sub cancel {
my $self = shift;
my ($from, $to) = @_;
my $json = $self->ua->post(
'https://www.google.com/voice/call/cancel/' => form => {
forwardingN
',
_rnr_se => $self->rnr_se
}
)->res->json;
$@ = $json->{data}->{code} and return unless $json->{ok};
return $json->{ok};
}
1;
=head1 NAME
Google::Voice::Call
=head1 DES
ON
use strictures 1;
use Moo;
use Wight;
use Encode;
use File::Share qw/dist_file/;
use Cwd;
use JSON::XS;
has 'output' => ( is => 'rw', default => sub { 'example.png'} );
has 'rows' => ( is => 'rw'
semble a microsite with Handlebars
use strict;
use warnings;
use File::Next;
use Path::Class;
use JSON;
use Try::Tiny;
use Text::Handlebars;
use Text::Xslate 'mark_raw';
sub assemble {
my $class
andlebars',
content_name => 'content.handlebars',
config_name => 'config.json',
templates_dir => 'templates/',
fragments_dir => 'fragments/',
bui
$child->is_dir;
# any level in the hierarchy can have a wrapper.handlebars or config.json
next if $child->basename eq $args->{wrapper_name}
|| $child->basenam
CT: Save google charts to images using phantomjs
our $VERSION = '0.003'; # VERSION
use Moo;
use JSON::XS;
use Encode;
extends 'Wight::Chart';
sub src_html { 'google.html' }
#TODO: import roles for
$self->height - $self->border,
},
%{$self->options}
};
my $args = decode_utf8(encode_json({
options => $options,
type => $types->{$self->type},
rows => $self->rows,
column
package Google::Voice;
use strict;
use warnings;
use Mojo::UserAgent;
use Mojo::JSON;
use IO::Socket::SSL 1.37;
use Google::Voice::Feed;
use Google::Voice::Call;
use Mojo::Base -base;
our $VERSIO
nd_sms {
my $self = shift;
my $c = $self->ua;
my ($phone, $content) = @_;
my $json = $c->post(
'https://www.google.com/voice/b/0/sms/send',
form => { id
_rnr_se => $self->rnr_se
}
)->res->json;
$@ = $json->{data}->{code} and return unless $json->{ok};
return $json->{ok};
}
for my $feed (
qw/ all starred spam trash
package Wight::Chart::ChartJS;
use Moo;
use JSON::XS;
use Encode;
use Graphics::Color::RGB;
extends 'Wight::Chart';
our $VERSION = '0.003'; # VERSION
#TODO: import roles for each type for more opti
park => { cls => "Line", config => {
scaleShowLabels => JSON::XS::false,
pointDot => JSON::XS::false,
scaleShowGridLines => JSON::XS::false,
}},
bar => { cls => "Bar" },
radar => { c
_;
my $w = $self->wight;
my $src = $types->{$self->type};
my $config = {
animation => JSON::XS::false,
%{$src->{config} || {} },
%{$local_config || {} },
};
#if type is spark,
008005;
use strict;
use warnings;
our $VERSION = "0.02";
use parent qw/Plack::Middleware/;
use JSON;
use Try::Tiny;
use Data::Dumper;
use Text::Xslate;
use Plack::Request;
use Term::ANSIColor;
use
ype", "application/json");
req.send(JSON.stringify(opts));
req.onreadystatechange = function() {
if(req.readyState == 4) {
var res = JSON.parse(req.response
THOR
Tasuku SUENAGA a.k.a. gunyarakun E<lt>tasuku-s-github@titech.acE<gt>
=head1 TODO
- REPL
- JSON response
=head1 SEE ALSO
L<Plack::Middleware::StackTrace> L<Devel::StackTrace::AsHTML> L<Plack:
y $json = $self->ua->post(
'https://www.google.com/voice/inbox/deleteMessages' => form => {
messages => $self->id,
trash => 1,
_rnr_se => $self->rnr_se
}
)->res->json;
$@ = $json->{data}->{code} and return unless $json->{ok};
return $json->{ok};
}
sub download {
my $self = shift;
my ($from, $to) = @_;
my $res = $self->ua->get(
'https://www.google.c
"jpg" => "image/jpeg",
"js" => "application/javascript",
"json" => "application/json",
"log" => "text/plain",
"m3u" => "audio/x-mpegurl",
"m4
ash;
}
1;
__END__
=head1 NAME
Cake::Plugin::I18N
=head1 SYNOPSIS
##in your settings.json
{
"plugins" : [
"I18N" : {
"path" : "/full/path/to/your/l
CT: get Ivan Bessarabov's weight data
use strict;
use warnings;
use Carp;
use LWP::Simple;
use JSON;
use Time::Local;
my $true = 1;
my $false = '';
sub new {
my ($class, %opts) = @_;
cr
";
}
}
sub __get_data {
my ($self) = @_;
my $json = get("http://ivan.bessarabov.ru/weight.json");
my $data = from_json($json);
my $day_data = $data->[0]->{day};
my %date2we
shift},$class);
}
sub true {'true' }
sub false { undef }
sub null { 'null' }
##from json to perl
sub to_perl {
my $self = shift;
#remove comments
$self->{data} =~ s/\n+\s
ata";
croak "invalid json" if $@;
#return bless($str,'Cake::Utils::Serializer::Base');
return $str;
return _stringify($data);
}
sub to_json {
my $self = shift;
1)->Pair(' : ');
my $json = $dumper->Dump;
$json =~ s/(?:'((.*?)[^\\'])?')/$1 ? '"'.$1.'"' : '""'/ge;
$json =~ s/\\'/'/g;
$json =~ s/\\\\/\\/g;
$json =~ s/(\\x\{(.*?)\})/chr(h
package Confman::API;
use strict;
use IO::File;
use JSON;
use REST::Client;
use MIME::Base64;
use Digest::MD5 qw(md5_hex);
sub new {
my $class = shift;
my $self = bless({}, ref($class) || $clas
g_dir} ||= "/etc/confman";
$self->{json} = JSON->new->allow_nonref;
$self;
}
sub config_path {
my $self = shift;
return $self->{config_dir} . "/config.json"
}
sub api_key {
my $self = shif
g_path) {
my $fh = IO::File->new($config_path);
local $/ = undef;
my $config = $self->json->decode(<$fh>);
$fh->close();
while(my ($key, $value) = each(%$config)) {
$self->{
my/application/my_application_local.{yml,yaml,cnf,conf,jsn,json,...}
and
path/to/my/application/my_application.{yml,yaml,cnf,conf,jsn,json,...}
... and load the found configuration information app
==============================================
# Load Settings from outer file / must be a valid json file
#============================================================================
sub loadSett
ake::Utils::get_file($file);
}; if ($@){
die "can't open file $file";
}
##json to perl
return Cake::Utils->serialize($conf)->to_perl;
}
#==============================
lf->body(Dumper $data);
}
sub json {
my $self = shift;
my $data = shift;
if (ref $data eq 'HASH'){
$data = $self->serialize($data)->to_json;
}
$self->content_type
:UserAgent;
use JSON::Any;
use HTTP::Request::Common qw(POST);
our @EXPORT_OK = qw(verify_remotely);
my $REMOTE_VERIFIER = 'https://verifier.login.persona.org/verify';
my $json = JSON::Any->new;
ha
ata;
if ($resp->is_success) {
my $message = $resp->decoded_content;
$data = $json->decode($message);
}
else {
$data = {
status => 'failure',
rected links in the README and POD.
=item Added:
Replaced Changes with changes.pod.
Added META.json.
=back
=head2 0.03 (23 Sep 1999)
=over 4
=item Fixed:
Reduced ATTRIBUTES setup to a single e
ge::Passing>, send output to MongoDB
=head1 METHODS
=over
=item consume
Consumes a message by JSON encoding it save it in MongoDB
=back
=head1 ATTRIBUTES
=over
=item database
Required, Str, t
List nesting, among other things, it's hard to be exactly
# precise about the size of the JSON serialization, but this will get
# us pretty close.
my $featSize = $self->{me
isa => sub {
my $t = $_[0];
is_string($t) && array_includes([qw(xml json)],$t) || die("type must be 'xml' or 'json'");
},
default => sub { 'xml'; },
lazy => 1
);
sub generator {
my($
Collection
state $mods = do {
#MODS::Record->from_json expects binary input (decode_json is applied)
if($self->type eq "json"){
$self->fh->binmode(":raw");
}
my $m
= $self->type eq "xml" ? MODS::Record->from_xml($self->fh) : MODS::Record->from_json($self->fh);
my $res = ref($m) eq "MODS::Element::Mods" ? [$m] : $m->mods;
$res;
};
return $i <