tence object
use JSON;
use Ubic::Lockf;
use Ubic::AtomicFile;
{
# support the compatibility with JSON.pm v1 just because we can
# see also: Ubic::ServiceLoader::Ext::json
no strict;
sub jsonToObj; *jsonToObj = (*{JSON::from_json}{CODE}) ? \&JSON::from_json : \&JSON::jsonToObj;
sub objToJson; *objToJson = (*{JSON::to_json}{CODE}) ? \&JSON::to_json : \&JSON::objToJson;
}
my
+)};
$data = { status => $status, enabled => $enabled };
}
else {
$data = jsonToObj($str);
}
return $data;
}
sub load {
my ($class, $fname) = @_;
return _load
gent(
join "/", __PACKAGE__, $OAuth::Lite2::VERSION);
}
$self->{format} ||= 'json';
$self->{response_parser} = OAuth::Lite2::Client::TokenResponseParser->new;
$self->{stat
nt(
join "/", __PACKAGE__, $OAuth::Lite2::VERSION);
}
# $self->{format} ||= 'json';
$self->{response_parser} = OAuth::Lite2::Client::TokenResponseParser->new;
return $sel
nt(
join "/", __PACKAGE__, $OAuth::Lite2::VERSION);
}
# $self->{format} ||= 'json';
$self->{response_parser} = OAuth::Lite2::Client::TokenResponseParser->new;
return $sel
n optional feature offered by a CPAN
#pod distribution and specified in the distribution's F<META.json> (or F<META.yml>)
#pod file.
#pod
#pod For the most part, this class will only be used when opera
bes an optional feature offered by a CPAN
distribution and specified in the distribution's F<META.json> (or F<META.yml>)
file.
For the most part, this class will only be used when operating on the re
; # returns false
=item * json
You can pass in a json string which will be parsed and used to populate the new
object. For example:
$results = Process::Results->new(json=>'{"errors":[{"id":"no-fil
<success> proeperty.
=head2 json()
C<< $results-E<gt>json() >> returns a JSON representation of the results object.
That's all, it takes no params, it just returns a JSON string.
OK, one minor thin
g to note is that the C<success> property is set to the JSON
value of C<true> or C<false>. Other then that, nothing complicated.
=head1 TERMS AND CONDITIONS
Copyright (c) 2016 by Miko O'Sullivan. Al
package Process::Results;
use strict;
use Carp 'croak';
use B;
use JSON::Tiny;
# debug tools
# use Debug::ShowStuff ':all';
# use Debug::ShowStuff::ShowVar;
# version
our $VERSION = '0.2';
# config
; # returns false
=item * json
You can pass in a json string which will be parsed and used to populate the new
object. For example:
$results = Process::Results->new(json=>'{"errors":[{"id":"no-fil
ults') {
return $opts{'results'};
}
}
# if json was sent, parse it
if ( $opts{'json'} ) {
$results = JSON::Tiny::decode_json($opts{'json'});
}
# else just create empty hashref
else {
r;
use File::Spec;
use File::Path 'make_path', 'remove_tree';
use File::Basename qw'dirname';
use JSON::XS;
use MIME::Base64;
require IO::All;
our $VERSION = '1.2.1'; # VERSION
sub get_repo_images {
catfile( $repo_dir, "repo.json" );
if ( -f $repo_file ) {
my $content = IO::All->new($repo_file)->slurp;
$self->res->headers->add( 'Content-Type', 'application/json' );
$self->render( t
binmode $fh;
print $fh $tx->res->body;
close $fh;
my $ref = $tx->res->json;
my $repo_dir = $self->app->get_repo_dir( repo => $self->repo->{name} );
for my $
ious::Controller';
our $VERSION = '1.2.1'; # VERSION
sub index {
my ($self) = @_;
$self->render( json => { ok => 1 } );
}
sub ping {
my ($self) = @_;
$self->render( text => 'true' );
}
1;
c;
use File::Path 'make_path', 'remove_tree';
use File::Basename 'basename';
require IO::All;
use JSON::XS;
use MIME::Base64;
our $VERSION = '1.2.1'; # VERSION
sub put_image {
my ($self) = @_;
ages", $self->param("name") );
my $image_json = File::Spec->catfile( $image_dir, "image.json" );
make_path $image_dir;
open( my $fh, ">", $image_json ) or die($!);
print $fh $self->req->body
;
close($fh);
eval {
my $ref = decode_json $self->req->body;
if ( exists $ref->{parent} ) {
symlink File::Spec->catfile( $repo_dir, "images", $ref->{parent} ),
File::Spec->c
move_tree';
use Digest::MD5 'md5_base64';
use Rex::Repositorio::Server::Docker::Helper::Auth;
use JSON::XS;
use Data::Dumper;
our $VERSION = '1.2.1'; # VERSION
# TODO: implement authentication and a
name} );
my $user_dir = File::Spec->catdir( $repo_dir, "users" );
my $ref = $self->req->json;
my $username = $ref->{username};
if ( !-d File::Spec->catdir( $user_dir, $username ) ) {
( $user_dir, $username, "user.json" ) )
or die($!);
my $ref = $self->req->json;
$ref->{password} = md5_base64( $ref->{password} );
print $fh encode_json($ref);
close($fh);
$
:Repositorio::Server::Yum::Errata;
use Mojo::Base 'Mojolicious::Controller';
use File::Spec;
use JSON::XS;
use List::MoreUtils 'firstidx';
use Data::Dumper;
require IO::All;
our $VERSION = '1.2.1';
->debug("Looking for errata: $errata_dir");
if ( !-d $errata_dir ) {
return $self->render( json => {}, status => 404 );
}
my $package = $self->param("package");
my $arch = $self->para
rch, substr( $package, 0, 1 ),
$package, "errata.json"
)
)
{
return $self->render( json => {} );
}
my $ref = decode_json(
IO::All->new(
File::Spec->catfile(
Carp;
use Params::Validate qw(:all);
use File::Spec;
use File::Path 'make_path';
use IO::All;
use JSON::XS;
our $VERSION = '1.2.1'; # VERSION
extends "Rex::Repositorio::Repository::Yum";
sub mirror
::Docker::Search;
use Mojo::Base 'Mojolicious::Controller';
use File::Spec;
require IO::All;
use JSON::XS;
use Data::Dumper;
our $VERSION = '1.2.1'; # VERSION
sub search {
my ($self) = @_;
my
Spec->catdir( $self->app->get_repo_dir( repo => $self->repo->{name} ),
"repository" );
my @json_files;
my @dirs = ($repo_dir);
for my $dir (@dirs) {
opendir( my $dh, $dir );
while (
}
if ( -f File::Spec->catfile( $dir, $entry, "repo.json" ) ) {
push @json_files, File::Spec->catfile( $dir, $entry, "repo.json" );
}
}
closedir($dh);
}
my $search =
:Validate qw(:all);
use File::Spec;
use JSON::XS;
sub register {
my ( $self, $app ) = @_;
$app->helper(
config => sub {
my $config = decode_json( $ENV{REPO_CONFIG} );
return $con
Carp;
use Params::Validate qw(:all);
use File::Spec;
use File::Path 'make_path';
use IO::All;
use JSON::XS;
use Mojo::DOM;
our $VERSION = '1.2.1'; # VERSION
extends "Rex::Repositorio::Repository::Ba
be Str/;
use JSON::MaybeXS;
use Moo::Role;
with 'Business::Giropay::Role::Network';
=head1 ATTRIBUTES
=head2 json
The json message data returned from giropay. Required.
=cut
has json => (
is
L</json> data converted to a hash reference.
=cut
has data => (
is => 'lazy',
isa => HashRef,
init_arg => undef,
);
sub _build_data {
return decode_json( shift->json );
= hmac_md5_hex( $self->json, $self->secret );
croak(
"Returned HMAC hash ", $self->hash,
" does not match expected hash ", $verify, " for json ", $self->json
) unless $verify
=> 0,
version => $VERSION,
base => 'XAS::Collector::Output::Socket::Base',
codec => 'JSON',
;
#use Data::Dumper;
# ----------------------------------------------------------------------
tr',
);
# TODO: Make this configurable from the command line, either by accepting some
# sort of JSON-as-command-line-argument-flag setting, or by having multiple
# attributes that *are* individually
icious::Plugin';
use Data::Dumper;
use File::Spec;
use File::Path 'make_path', 'remove_tree';
use JSON::XS;
require IO::All;
sub register {
my ( $self, $app ) = @_;
my $session_dir =
File::S
r, $session_id );
if ( $session_id && -f $session_file ) {
my $ref = decode_json( IO::All->new($session_file)->slurp );
$self->stash( "session_token", $sessio
n_dir;
}
open( my $fh, ">", $session_file ) or die($!);
print $fh encode_json(
{
token => $self->stash->{session_token},
user => $self->stas