: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::
warnings;
use base 'Armadito::Agent::Task';
use Armadito::Agent::Storage;
use Data::Dumper;
use JSON;
sub new {
my ( $class, %params ) = @_;
my $self = $class->SUPER::new(%params);
if ( $param
= @_;
$self->{logger}->info( "Successful Response : " . $response->content() );
my $obj = from_json( $response->content(), { utf8 => 1 } );
if ( defined( $obj->{jobs} ) && ref( $obj->{jobs} ) eq
se ) = @_;
$self->{logger}->info( "Error Response : " . $response->content() );
my $obj = from_json( $response->content(), { utf8 => 1 } );
$self->{logger}->error( Dumper($obj) );
return $self;
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->{
g2($url) if $self->{logger};
my $headers = HTTP::Headers->new(
'Content-Type' => 'application/json',
'Referer' => $url
);
my $request = HTTP::Request->new(
$params{method} => $url,
$
eURL method. If this is a POST request, a message must be given in params. This should be a valid JSON message.
The following parameters are allowed, as keys of the %params hash :
=over
=item I<url
e Armadito::Agent::Task::Alerts;
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;
my $json_text = to_json( $self->{jobj} );
$self->{logger}->debug($json_text);
my $response = $self->{glpi_client}->sendRequest(
"url" => $self->{glpi_url} . "/api/alerts",
message => $json_te
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 $
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}
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
*CreateGeometryFromGML = *Geo::OGRc::CreateGeometryFromGML;
*CreateGeometryFromJson = *Geo::OGRc::CreateGeometryFromJson;
*BuildPolygonFromEdges = *Geo::OGRc::BuildPolygonFromEdges;
*ApproximateArcAn
}
}
my $gml = $param{GML} // $param{gml};
my $json = $param{GeoJSON} // $param{geojson} // $param{JSON} // $param{json};
my $points = $param{Points} // $param{points};
my $ar
self = Geo::OGRc::CreateGeometryFromGML($gml);
} elsif (defined $json) {
$self = Geo::OGRc::CreateGeometryFromJson($json);
} elsif (defined $type) {
$type = Geo::GDAL::string2i
$buff}) || return;
foreach (@{$buff}) {
$data .= join $/, '{"index":{}}', $self->_to_json($_), '';
}
if (_INTERNAL_DEBUG) {
require Data::Dumper;
print Data::Dump
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
This task inherits from L<Armadito::Agent::Task:State>. Get Antivirus state and then send it in a json formatted POST request to Armadito plugin for GLPI.
=head1 FUNCTIONS
=head2 run ( $self, %param
This task inherits from L<Armadito::Agent::Task:Alerts>. Get Antivirus' alerts and send them as json messages to armadito glpi plugin.
=head1 FUNCTIONS
=head2 run ( $self, %params )
Run the task.
s;
no if $] >= 5.017011, warnings => 'experimental::smartmatch';
use utf8;
use Data::Dumper;
use JSON qw();
our $VERSION = '0.20';
sub MAX_RECURSION () {300}
{
my $inc = caller() ? $INC{ __PAC
read_next_json_file () {
local $/;
local $SIG{__WARN__} = \&warn_without_line;
while (<>) {
utf8::encode($_) if utf8::is_utf8($_);
$_ = eval { JSON::decode_json($_) };
hift;
state $supported = {
'ddp' => 'App::yajg::Output::DDP',
'json' => 'App::yajg::Output::Json',
'perl' => 'App::yajg::Output::Perl',
'yaml' => 'App::yajg::Outpu
;
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 //
our @ISA = qw(Log::Log4perl::Appender);
use Carp;
use HTTP::Headers();
use HTTP::Request();
use JSON;
use LWP::UserAgent();
use Log::Log4perl;
use MIME::Base64;
use URI;
=head1 NAME
Log::Log4perl:
_type};
} ## end sub type
sub log {
my ($self, %p) = @_;
$self->_send_request($self->_to_json($self->_prepare_body(%p)));
}
sub _init {
my ($self, %p) = @_;
defined($p{nodes})
, $uri) = @_;
my $h = $self->{_headers}->clone;
$h->header('Content-Type' => 'application/json');
my $ui = $uri->userinfo;
if ($ui) {
my $auth = MIME::Base64::encode_base64($u
vent;
use strict;
use warnings;
use base 'Armadito::Agent::HTTP::Client::ArmaditoAV::Event';
use JSON;
sub new {
my ( $class, %params ) = @_;
my $self = $class->SUPER::new(%params);
return $sel
>{jobj}->{task}->{obj} = $obj;
my $json_text = to_json( $self->{taskobj}->{jobj} );
print "JSON formatted str : \n" . $json_text . "\n";
$self->_sendToGLPI($json_text);
$self->{end_polling} = 1;
Armadito::Agent::Task:Scan>. Launch an Antivirus on-demand scan and then send a brief report in a json formatted POST request to Armadito plugin for GLPI.
=head1 FUNCTIONS
=head2 run ( $self, %param
This task inherits from L<Armadito::Agent::Task:Alerts>. Get Antivirus' alerts and send them as json messages to armadito glpi plugin.
=head1 FUNCTIONS
=head2 run ( $self, %params )
Run the task.
ent;
use strict;
use warnings;
use base 'Armadito::Agent::HTTP::Client::ArmaditoAV::Event';
use JSON;
use Armadito::Agent::Tools::Security qw(isANumber);
sub new {
my ( $class, %params ) = @_;
m
y ( $self, %params ) = @_;
$self->{taskobj}->{jobj}->{task}->{obj} = $self->{jobj};
my $json_text = to_json( $self->{taskobj}->{jobj} );
my $response = $self->{taskobj}->{glpi_client}->sendReques
t(
"url" => $self->{taskobj}->{agent}->{config}->{server}[0] . "/api/scans",
message => $json_text,
method => "POST"
);
if ( $response->is_success() ) {
$self->{taskobj}->{logger}->info(