ut extend it instead.
=cut
use strict;
use warnings;
use Moo;
use Carp qw/ confess carp /;
use JSON ();
use Try::Tiny;
use Business::Fixflo::Paginator;
=head1 ATTRIBUTES
client
url
ur
the object.
my %data = $Issue->to_hash;
=head2 to_json
Returns a json string representation of the object.
my $json = $Issue->to_json;
=head2 get
Populates the object with its attributes
);
delete( $hash{warn_unknown_attributes} );
return %hash;
}
sub to_json {
my ( $self ) = @_;
return JSON->new->canonical->encode( { $self->to_hash } );
}
sub get {
my ( $self )
Business::Fixflo::QuickViewPanel;
use MIME::Base64 qw/ encode_base64 /;
use LWP::UserAgent;
use JSON ();
use Carp qw/ carp confess /;
=head1 ATTRIBUTES
=head2 username
Your Fixflo username (requi
LETE/ ) {
if ( $params ) {
$req->content_type( 'application/json' );
$req->content( JSON->new->encode( $params ) );
carp( $req->content )
i
s->content;
if ( $res->headers->header( 'content-type' ) =~ m!application/json! ) {
$data = JSON->new->decode( $data );
}
return $data;
}
else {
#!/opt/tools/bin/perl
use strict;
use warnings;
use Mojolicious::Lite;
use Mojo::JSON qw/ decode_json encode_json /;
use Readonly;
use FindBin qw/$Bin/;
use lib $Bin;
$ENV{MOJO_LOG_LEVEL} = 'fatal
_found;
my @items = map { $entity_item->( $_,undef,$url ) } $start .. $end;
$self->render(
json => {
PreviousURL => $prev ? "$uri?page=$prev" : undef,
NextURL => "$uri?page=
$url ) } $start .. $end;
my $total_pages = $do_next_page ? $next : $prev + 1;
$self->render(
json => {
PreviousURL => $prev ? "$uri?page=$prev" : undef,
NextURL => $do_next_page ? "$u
$issue->get;
...
}
}
my $issue = $ff->issue( $id );
my $json = $issue->to_json;
# third party API:
my $ff = Business::Fixflo->new(
api_key => $
package Dist::Zilla::Plugin::GitLab::Update 1.0002;
use Modern::Perl;
use Carp;
use JSON::MaybeXS;
use Moose;
use List::Util qw(first);
use URL::Encode qw(url_encode_utf8);
extends 'Dist::Zilla::Plug
nt-type'} = 'application/json';
$self->log_debug("Sending PUT $url");
my $response = HTTP::Tiny->new->request(
'PUT', $url,
{
content => encode_json($params),
head
package Dist::Zilla::Plugin::GitLab::Create 1.0002;
use Modern::Perl;
use JSON::MaybeXS;
use Moose;
use Try::Tiny;
use Git::Wrapper;
use File::Basename;
extends 'Dist::Zilla::Plugin::GitLab';
with '
);
my $url = $self->api . '/projects';
$content = encode_json($params);
$headers->{'content-type'} = 'application/json';
$self->log_debug("Sending POST $url");
my $response = $htt
package Dist::Zilla::Plugin::GitLab 1.0002;
use Modern::Perl;
use JSON::MaybeXS;
use Moose;
use Try::Tiny;
use HTTP::Tiny;
use Git::Wrapper;
use Class::Load qw(try_load_class);
has api => (
is
urn $repo;
}
sub _check_response {
my ( $self, $response ) = @_;
try {
my $json_text = decode_json( $response->{content} );
if ( !$response->{success} ) {
require Data::
->Terse(1)
->Sortkeys(1)->Dump
);
return;
}
return $json_text;
}
catch {
$self->log("Error: $_");
if ( $response
&& !$response
,sub {
my ( $self ) = @_;
$self->Id or $self->Id( undef ); # force Id of null in JSON
return { $self->to_hash };
} );
}
sub property {
my ( $self ) = @_;
my $Pro
$issue->get;
...
}
}
my $issue = $ff->issue( $id );
my $json = $issue->to_json;
# third party API:
my $ff = Business::Fixflo->new(
api_key => $
Draft',sub {
my ( $self ) = @_;
$self->Id or $self->Id( undef ); # force null in JSON request
my $post_data = { $self->to_hash };
if ( $self->Address ) {
se strict;
use warnings;
use Moo;
use JSON ();
use Carp qw/ cluck /;
with 'Throwable';
=head1 ATTRIBUTES
=head2 message (required)
The error message, if JSON is passed this will be coerced to a s
ta to a file as it may contain
sensitive information such as API key(s).
=cut
# plain string or JSON
has message => (
is => 'ro',
required => 1,
coerce => sub {
my ( $mes
# defensive decoding
eval { $message = JSON->new->decode( $message ) };
$@ && do { return "Failed to parse JSON response ($message): $@"; };
if ( ref( $mess
pagination through fixflo data returned as a list.
=cut
use strict;
use warnings;
use Moo;
use JSON ();
use Business::Fixflo::Issue;
=head1 ATTRIBUTES
client
objects
class
links
ection_id // (), @_);
$h->trace_msg(join('; ', '<-- ', $method, ($ret ? ref($response)->encode_json($response) : $response), "\n")) if $is_trace;
unless ($ret) {
if ($response->{protocol}) {
ice::WsScreenshot;
use Moo;
use URI::Encode qw( uri_encode );
use LWP::UserAgent;
use JSON::MaybeXS qw( decode_json );
use URI;
our $VERSION = '0.002';
has base_url => (
is => 'rw',
re
e_screenshot_url( $args ) );
if ( $res->content_type eq 'application/json' ) {
die "Error: " . decode_json($res->decoded_content)->{details};
}
return $res;
}
sub store_scr
package Dist::Zilla::Plugin::GitLab::Meta 1.0002;
use Modern::Perl;
use JSON::MaybeXS;
use URL::Encode qw(url_encode_utf8);
use Moose;
extends 'Dist::Zilla::Plugin::GitLab';
with 'Dist::Zilla::Role:
epo_name.git"
: $repo->{http_url_to_repo};
if ( !$offline && $repo->{issues_enabled} == JSON->true() ) {
$bugtracker = "$html_url/-/issues";
}
my $meta;
$meta->{resources} =
ing UTF-8
=head1 NAME
Dist::Zilla::Plugin::GitLab::Meta - Add a GitLab repo's info to META.{yml,json}
=head1 VERSION
version 1.0002
=head1 SYNOPSIS
Configure git with your GitLab login name:
use strict;
use Carp;
use version; our $VERSION = qv('v0.3.1');
use HTTP::Request::Common;
use JSON;
use LWP::UserAgent;
use URI::Escape;
# Module implementation here
my $lpurl = 'https://leanpub
= LWP::UserAgent->new(
agent => "libwebservice-leanpub-perl/$VERSION",
);
$self->{json} = JSON->new;
return $self;
} # new()
#----- coupons -----
sub create_coupon {
my ($self,
equest( { path => '/coupons.json', var => $var } );
} # create_coupon()
sub get_coupon_list {
my ($self) = @_;
return $self->_get_request( { path => '/coupons.json' } );
} # get_coupon_list
=end html
=head1 SYNOPSIS
The B<jl> command allows you to show the "JSON in JSON" log nicely. Recursively decode JSON in JSON string like below
$ echo '{"foo":"{\"bar\":\"{\\\"baz\\\":123}\"}
{
"baz" : 123
}
}
}
A complecated log can be converted to nice JSON structure to treat a tool like C<jq> .
echo '{"service":"Foo-Service","pod":"bar-baz-12345",
>\\nThis is log message. foo, bar, baz, qux, long message is going to be splitted nicely to treat JSON by jq without any special function\",\"timestamp\":1560526739}"}' | jl -xxxx
{
"messag
rs => undef,
}, $class;
}
sub TO_JSON { $_[0]->{func} }
package PerlYamlReferenceParserPrelude;
use boolean;
use Carp;
use Encode;
use Exporter 'import';
use JSON::PP;
use Time::HiRes qw< gettimeo
$value, ref($value)];
}
my $json = JSON::PP->new->canonical->allow_unknown->allow_nonref->convert_blessed;
sub json_stringify {
my $string;
eval {
$string = $json->encode($_[0]);
};
confe
sObject $o) {
return json_stringify [ sort keys %$o ];
}
if (isArray $o) {
return "[${\ join ',', map stringify($_), @$o}]";
}
if (isString $o) {
$_ = json_stringify $o;
s/^"(.
package App::jl;
use strict;
use warnings;
use JSON qw//;
use Sub::Data::Recursive;
use B;
use Getopt::Long qw/GetOptionsFromArray/;
our $VERSION = '0.20';
my $MAX_RECURSIVE_CALL = 255;
my $MAYBE_U
my $opt = $class->_parse_opt(@argv);
my $self = bless {
_opt => $opt,
_json => JSON->new->utf8->pretty(!$opt->{no_pretty})->canonical(1),
__current_orig_line => undef,
Keys = 1;
}
}
sub _process {
my ($self) = @_;
my $decoded = eval {
$self->{_json}->decode($self->{__current_orig_line});
};
if ($@) {
return $self->{__current_ori
ackage Finance::Nadex;
use strict;
use warnings;
our $VERSION = '0.12';
use LWP::UserAgent;
use JSON;
use Carp;
use Finance::Nadex::Order;
use Finance::Nadex::Position;
use Finance::Nadex::Contract;
my $json_obj = $self->_post( $login_url, $login_content );
$self->{user_agent}->cookie_jar->scan( \&_get_session_id );
$self->{session_id} = $session_id;
$self->{balance} = $json_obj-
te(
$url,
'Accept' => 'application/json; charset=UTF-8',
'Content-Type' => 'application/json; charset=UTF-8',
'Accept-Encoding' => 'text/html',