string);
=head1 DESCRIPTION
=cut
package JS::SourceMap::Decoder;
use strict;
use warnings;
use JSON;
use JS::SourceMap::Token;
use JS::SourceMap::Index qw/token_index/;
use vars qw($B64chrs @B64);
ce. Options:
=over 8
=item * json_options => $options_as_arrayref
Specify an array of options to pass to the L<JSON> constructor when
parsing JSON. We use the JSON defaults unless this option is
y $json = JSON->new($self->opt('json_options'))->decode($string);
my @sources = @{$json->{'sources'}};
my $sourceRoot = $json->{'sourceRoot'} if exists $json->{'sourceRoot'};
my @names = @{$json->{
n qw{ POST };
use UNIVERSAL::require;
use URI;
use Encode;
use Data::Dumper;
use URI::Escape;
use JSON;
use Armadito::Agent::HTTP::Client::ArmaditoAV::Event;
use Armadito::Agent::HTTP::Client::Armadi
rmadito-agent',
'Referer' => $url
);
$headers->header( 'Content-Type' => 'application/json' ) if ( $params{method} eq 'POST' );
$headers->header( 'X-Armadito-Token' => $self->{token} )
{
my ( $self, $response ) = @_;
$self->{logger}->info( $response->content() );
my $obj = from_json( $response->content(), { utf8 => 1 } );
# Update armadito agent_id
if ( defined( $obj->{token}
:Task::State;
use strict;
use warnings;
use base 'Armadito::Agent::Task';
use Data::Dumper;
use JSON;
sub new {
my ( $class, %params ) = @_;
my $self = $class->SUPER::new(%params);
if ( $param
teobj;
my $json_text = to_json( $self->{jobj} );
my $response = $self->{glpi_client}->sendRequest(
"url" => $self->{agent}->{config}->{server}[0] . "/api/states",
message => $json_text,
met
se ) = @_;
$self->{logger}->info( "Error Response : " . $response->content() );
my $obj = from_json( $response->content(), { utf8 => 1 } );
$self->{logger}->error( Dumper($obj) );
return $self;
Armadito Antivirus on-demand scan using AV's API REST protocol and then send a brief report in a json formatted POST request to Armadito plugin for GLPI.
=head1 FUNCTIONS
=head2 run ( $self, %param
;
use JSON qw();
sub boolean_to_scalar_ref {
return unless JSON::is_bool($_[0]);
$_[0] = $_[0]
? \(my $t = 1)
: \(my $f = 0);
}
sub boolean_to_int {
return unless JSON::is_b
ool($_[0]);
$_[0] = int(!!$_[0]);
}
sub boolean_to_str {
return unless JSON::is_bool($_[0]);
$_[0] = $_[0]
? 'true'
: 'false';
}
sub _decode_uri ($) {
local $_ = shift //
Armadito::Agent::Task::AVConfig;
use strict;
use warnings;
use base 'Armadito::Agent::Task';
use JSON;
use Data::Dumper;
sub new {
my ( $class, %params ) = @_;
my $self = $class->SUPER::new(%para
se ) = @_;
$self->{logger}->info( "Error Response : " . $response->content() );
my $obj = from_json( $response->content(), { utf8 => 1 } );
$self->{logger}->error( Dumper($obj) );
return $self;
$json_text = to_json( $self->{jobj} );
$self->{logger}->debug($json_text);
my $response = $self->{glpi_client}->sendRequest(
"url" => $self->{glpi_url} . "/api/avconfigs",
message => $json_t
strict;
use warnings;
use base 'Armadito::Agent::Task';
use MIME::Base64;
use Data::Dumper;
use JSON;
sub new {
my ( $class, %params ) = @_;
my $self = $class->SUPER::new(%params);
if ( $param
se ) = @_;
$self->{logger}->info( "Error Response : " . $response->content() );
my $obj = from_json( $response->content(), { utf8 => 1 } );
$self->{logger}->error( Dumper($obj) );
return $self;
fos;
my $json_text = to_json( $self->{jobj} );
my $response = $self->{glpi_client}->sendRequest(
"url" => $self->{agent}->{config}->{server}[0] . "/api/schedulers",
message => $json_text,
m
e 'Armadito::Agent::Task';
use Armadito::Agent::Tools::File qw( readFile );
use Data::Dumper;
use JSON;
sub new {
my ( $class, %params ) = @_;
my $self = $class->SUPER::new(%params);
if ( $param
$self = $self->SUPER::run(%params);
$self->_setEnrollmentKey();
my $json_text = to_json( $self->{jobj} );
print $json_text. "\n";
my $response = $self->{glpi_client}->sendRequest(
"url"
: " . $response->content() . "\n" );
if ( $response->content() =~ /^\s*\{/ ) {
my $obj = from_json( $response->content(), { utf8 => 1 } );
$self->{logger}->error( $obj->{message} );
}
return $
ent::Task';
use Armadito::Agent::Storage;
use Data::Dumper;
use MIME::Base64;
use Try::Tiny;
use JSON;
sub new {
my ( $class, %params ) = @_;
my $self = $class->SUPER::new(%params);
if ( $param
se ) = @_;
$self->{logger}->info( "Error Response : " . $response->content() );
my $obj = from_json( $response->content(), { utf8 => 1 } );
$self->{logger}->error( Dumper($obj) );
return $self;
= @_;
my $json_text = to_json( $self->{jobj} );
my $response = $self->{glpi_client}->sendRequest(
"url" => $self->{agent}->{config}->{server}[0] . "/api/jobs",
message => $json_text,
meth
strict;
use warnings;
use base 'Armadito::Agent::Task';
use MIME::Base64;
use Data::Dumper;
use JSON;
sub new {
my ( $class, %params ) = @_;
my $self = $class->SUPER::new(%params);
if ( $param
se ) = @_;
$self->{logger}->info( "Error Response : " . $response->content() );
my $obj = from_json( $response->content(), { utf8 => 1 } );
$self->{logger}->error( Dumper($obj) );
return $self;
esults;
my $json_text = to_json( $self->{jobj} );
my $response = $self->{glpi_client}->sendRequest(
"url" => $self->{agent}->{config}->{server}[0] . "/api/scans",
message => $json_text,
met
rmadito module. Set task's default logger.
=head2 getJobj ( $self )
Return unblessed object for json ecnapsulation.
=head2 getVersion ( $self )
Return Antivirus Version by using RESTful API /versi
a_fields = $self->db->users_extra_fields->get_all(
fields => [qw(user_id key value is_json)],
filter => {user_id => array_uniq(map {$_->{'id'}} @$result)}
);
f
ields->{'__EXTRA_FIELDS__'}{$rec->{'user_id'}}{$rec->{'key'}}},
$rec->{'is_json'} ? from_json($rec->{'value'}) : $rec->{'value'}
);
}
}
}
sub add {
my ($se
ta,
map {{user_id => $id, key => $key, value => $_->{'value'}, is_json => $_->{'is_json'}}}
@{$extra_fields->{$key}});
}
anciate module. Set task's default logger.
=head2 getJobj ( $self )
Return unblessed object for json encapsulation.
=head2 getVersion ( $self )
Return Antivirus' Version.
=head2 getProgramPath (
anciate module. Set task's default logger.
=head2 getJobj ( $self )
Return unblessed object for json encapsulation.
=head2 getVersion ( $self )
Return Antivirus' Version.
=head2 getScanCliPath (
:Task:State>. Ask for Armadito Antivirus state using AV's API REST protocol and then send it in a json formatted POST request to Armadito plugin for GLPI.
=head1 FUNCTIONS
=head2 run ( $self, %param
ask inherits from L<Armadito::Agent::Task:Alerts>. Get Armadito Antivirus alerts and send them as json messages to armadito glpi plugin.
=head1 FUNCTIONS
=head2 run ( $self, %params )
Run the task.
:Reddit::Response;
$WebService::Reddit::Response::VERSION = '0.000003';
use Moo;
use JSON::MaybeXS qw( decode_json );
use Types::Standard qw( Bool InstanceOf Maybe HashRef );
has content => (
is
my $self = shift;
my $content = $self->raw->decoded_content;
return $content ? decode_json($content) : undef;
}
sub _build_success {
my $self = shift;
return $self->raw->is_succes
item raw
An L<HTTP::Response> object.
=back
=head1 METHODS
=head2 content
This is the parsed JSON body of the response. Generally this will be a C<HashRef>.
=head2 raw
Returns the raw L<HTTP::
a => 'Int';
has 'nb_fan', is => 'rw', isa => 'Int';
has 'radio' => (
is => 'ro',
isa => 'JSONBoolean',
coerce => 1
);
around BUILDARGS => sub { # allow create Artist object with single a
$self = WWW::Deezer->new->artist($_[0]);
}
else {
# 2DO: deal with Bool and JSON::XS::Boolean=\1 in 'radio' argument
$self = $class->$orig(@_);
}
return $self;
};
package Swagger2::POD;
use Mojo::Base -base;
use Mojo::JSON 'encode_json';
use Mojo::Message::Response;
use Scalar::Util 'blessed';
use constant NO_DESCRIPTION => 'No description.';
require Swagger2;
obj->{$k} and $obj->{$k} eq Mojo::JSON->true;
return "$k=false" if blessed $obj->{$k} and $obj->{$k} eq Mojo::JSON->false;
return sprintf '%s=%s', $k, encode_json $obj->{$k} if ref $obj->{$k};
r
Moves;
use File::ShareDir qw(dist_file);
use File::Slurper qw(read_text);
use Cpanel::JSON::XS qw(decode_json);
require Exporter;
my ( $hECO, $hNIC, $hOpening );
my %hash = (
ECO =>
_GetPaths('Chess-PGN-EPD');
$hECO = decode_json read_text($ECO_path);
$hNIC = decode_json read_text($NIC_path);
$hOpening = decode_json read_text($Opening_path);
sub _GetPaths {
on three database files installed along with
the module. On demand other formats (the current is JSON) may be implemented. The 'ToDo' list
also mentions the possibility of extending the databases, a