return ( $filter, $attr );
}
sub datatable_row {
my ( $self, $c, $row ) = @_;
my $json_data = {
inventory => $row->inventory,
vendor => $row->vendor,
mod
$json_data->{workstation} = {
hostname => $wks->name,
href => $c->uri_for_action( 'workstation/view', [ $wks->id ] )->as_string,
};
}
return $json_data
=item *
If the feature 'format_suffix' is active and the path ends in a format suffix
such as C<.json>, then that suffix is removed and later used to set the
"format" attribute of the request.
=item
url = $request->generate_url( { op => 'abc/def', format => 'json', params => 'foo=1' } );
$url = $request->generate_url( "op:abc/def.json?foo=1" );
The attributes are as follows:
=over
=item no
request body, if it is in a known format. Currently, the only two formats
understood are JSON and text. A JSON body will be decoded into a Perl data structure, while a text
body will be split into a
raint::File::Size>
=item L<HTML::FormFu::Constraint::Integer>
=item L<HTML::FormFu::Constraint::JSON>
=item L<HTML::FormFu::Constraint::Length>
=item L<HTML::FormFu::Constraint::MaxLength>
=item
autoclean;
BEGIN { extends 'Catalyst::Controller'; }
use App::Manoc::Utils::Validate;
has use_json_boolean => (
is => 'ro',
isa => 'Bool',
default => 0,
);
sub begin : Priva
or API input');
}
}
sub end : Private {
my ( $self, $c ) = @_;
my $expose_stash = 'json_data';
# don't change the http status code if already set elsewhere
unless ( $c->res->st
lding API response status=200");
my $data = $c->stash->{api_response_data} || $c->stash->{json_data};
$c->stash->{$expose_stash} = $data;
}
elsif ( $c->res->status == 401 ) {
lt => 1 );
# has_field validation_json => ( type => 'Hidden', element_attr => { disabled => 'disabled' } );
# sub default_validation_json { shift->as_escaped_json }
sub html_attributes {
my (
between projects \n";
print "\n[task boxes]:\n\n";
print "\tsparrow box run /path/to/box.json # run task box \n";
print "\n[remote tasks]:\n\n";
print "\tsparrow remote task upload
';
$result->{message} = 'command not found';
}
$c->stash( json_data => $result );
$c->forward('View::JSON');
}
sub get_form_success_url {
my ( $self, $c ) = @_;
my $act
Manoc::ControllerRole::CommonCRUD" => { -excludes => ["list"] },
"App::Manoc::ControllerRole::JSONView";
use namespace::autoclean;
__PACKAGE__->config(
action => {
setup => {
=> $_->id,
name => $_->name
}, @ifaces;
$c->stash( json_data => \@data );
$c->forward('View::JSON');
}
sub view : Chained('object') : PathPart('') : Args(0) {
my ( $s
S
=over 4
=item *
App::Manoc::ControllerRole::CommonCRUD
=item *
App::Manoc::ControllerRole::JSONView
=back
=head1 ACTIONS
=head2 populate
For interfaces batch creation
=head2 list_uncabled_
::Server',
form_class => 'App::Manoc::Form::Server',
view_object_perm => undef,
json_columns => [ 'id', 'name' ],
find_object_options => { prefetch => { installed_sw_pkgs =>
server->update();
$response->{success} = 1;
}
$c->stash( json_data => $response );
$c->forward('View::JSON');
}
__PACKAGE__->meta->make_immutable;
1;
# Local Variables:
# mode:
_column('vendor')->all();
$c->log->error("data=@data");
$c->stash( json_data => \@data );
$c->forward('View::JSON');
}
sub models_js : Chained('base') : PathPart('models/js') : Args(0) {
distinct => 1
}
)->get_column('model')->all();
$c->stash( json_data => \@data );
$c->forward('View::JSON');
}
sub get_form_process_params {
my ( $self, $c, %params ) = @_;
=head2 delete
=head2 decommission
=head2 restore
=head2 vendors_js
Get a list of vendors in JSON, to be used in form autocomplete.
=head2 models_js
Get a list of models optionally filtered by
mmands::Project;
use Sparrow::Commands::Task;
use Carp;
use File::Basename;
use File::Path;
use JSON;
use Data::Dumper;
use File::Copy;
use Term::ANSIColor;
our @EXPORT = qw{
remote_task_uplo
owhub.json
open F, "$ENV{HOME}/sparrowhub.json" or confess "can't open $ENV{HOME}/sparrowhub.json to read: $!";
my $s = join "", <F>;
close F;
$cred = decode_json($s);
owhub.json
open F, "$ENV{HOME}/sparrowhub.json" or confess "can't open $ENV{HOME}/sparrowhub.json to read: $!";
my $s = join "", <F>;
close F;
$cred = decode_json($s);
arams' },
{ allow => 'other_params' },
{ content_type => 'ct', valid => ['html', 'json', 'frob=application/frobnicate'] };
get '/some/path.:ct' => sub {
my $valid
content type of the response will be set by the
URL path suffix, which may be either C<.html>, C<.json> or C<.frob>.
If the value given in a request does not occur in the list, or if no value is
foun
ome/type'. You need not specify the actual content type string for the
well-known types 'html', 'json', 'xml', 'txt' or 'csv', unless you wish to
override the default given by this module.
=head2 Ru
tings) {
return [ 200,
['Content-Type' => 'application/json'],
[ $app->encode_json($settings) ] ];
} else {
return [ 404,
[ 'Content
$file) = @_;
my $body = $class->_read_request_body($env);
my $additional = $app->decode_json($body);
local $@;
$file = eval { $app->save_settings_to_file($file, $additional) };
use Mojo::Base -strict;
use B ();
use Mojo::ByteStream;
use Mojo::Date;
use Mojo::DOM;
use Mojo::JSON;
use Mojo::Template;
use Scalar::Util ();
use Mojo::XMLRPC::Base64;
use Mojo::XMLRPC::Message::C
eturn $elem->text / 1.0;
} elsif ($tag eq 'boolean') {
return $elem->text ? Mojo::JSON::true : Mojo::JSON::false;
} elsif ($tag eq 'nil') {
return undef;
} elsif ($tag eq 'dateTime.is
m->can('TO_XMLRPC')) {
return _encode_item($item->TO_XMLRPC);
} elsif ($item->isa('JSON::PP::Boolean')) {
my $val = $item ? 1 : 0;
$ret = "<boolean>$val</boolean>";
;
my $json = $app->{json};
$app->user_requested_exit();
return sub {
my $responder = shift;
my $writer = $responder->([ 204, [ 'Content-Type' => 'application/json' ]]);
0,
[ 'Content-Type' => 'application/json',
'X-Stack-Depth' => scalar(@$frames),
],
[ $app->encode_json($frames) ],
];
}
sub stack_head {
= @_;
my $stack = $app->stack;
return [ 200,
[ 'Content-Type' => 'application/json',
'X-Stack-Depth' => $stack->depth,
],
[],
];
}
s
($frame, $base_url, $level, $req->param('exclude_sub_params'));
$rv->[2] = [ $app->encode_json($serialized_frame) ];
}
return $rv;
}
sub stack_frame_head {
my($class, $app, $env,
WWW::Yotpo;
use strict;
use 5.008_005;
our $VERSION = '0.03';
use Carp;
use LWP::UserAgent;
use JSON;
use HTTP::Request;
use vars qw/$errstr/;
sub errstr { $errstr }
sub new {
my $class = shif
uest('apps/' . $self->{client_id} . '/purchases/mass_create', 'POST', {
Content => encode_json(\%params),
utoken => $params{utoken}
});
}
sub purchases {
my $self = shift;
ontent_type('application/json');
}
my $res = $self->{ua}->request($req);
# print Dumper(\$res); use Data::Dumper;
if (not $res->header('Content-Type') =~ /json/) {
$errstr = $r
ns Web::DataService::Plugin::JSON and
# Web::DataService::Plugin::Text.
$ds->define_format(
{ name => 'json', doc_node => 'formats/json', title => 'JSON' },
"The JSON format is intended primaril
ath => '/',
title => 'Main Documentation',
public_access => 1,
default_format => 'json',
doc_default_template => 'doc_not_found.tt',
doc_default_op_template => 'operation.tt'
{ path => 'single',
title => 'Single state',
place => 1,
usage => [ "single.json?state=wi",
"single.txt?state=tx&show=hist&header=no" ],
output => 'basic',
optiona
$app, $env) = @_;
my $body = $class->_read_request_body($env);
my $params = $app->decode_json($body);
my $eval_string = Devel::hdb::Utils::_fixup_expr_for_eval($params->{code});
retu
:encode($value);
return [ 200,
[ 'Content-Type' => 'application/json' ],
[ $app->encode_json($result) ]
];
}
sub _eval_plumbing_closure {
my($app, $env, $eval_
200,
[ 'Content-Type' => 'application/json' ],
[ $app->encode_json($result) ]]);
}
);
};
}
1;
=pod
=head1 NAM
$app, $env) = @_;
my $body = $class->_read_request_body($env);
my $params = $app->decode_json( $body );
if (my $error = $class->is_file_or_line_invalid($app, @$params{'filename','line'})
$app, $params);
return [ 200,
[ 'Content-Type' => 'application/json' ],
[ $app->encode_json($resp_data) ],
];
}
sub change {
my($class, $app, $env, $id) = @
_;
my $body = $class->_read_request_body($env);
my $params = $app->decode_json( $body );
foreach my $prop (qw( filename line )) {
if (exists($params->{$prop})) {
retu