..',
user_agent => $ua
});
=item schemas_file
Optional path to a file containing the JSON for all of the schemas for this web
service (from the schemas collection). If you would like to
$c = WWW::GoDaddy::REST->new({
url => '...',
schemas_file => '/my/app/schema.json'
});
See the GDAPI Specification for more information about schemas and collections.
L<https:/
Perform the HTTP request and return a hashref of the decoded JSON response.
If this is called in list context, it returns the decoded JSON response and
the associated L<HTTP::Response> object.
This
WW::GoDaddy::REST::Shell::Util qw(get_resource_by_schema_or_uri);
use WWW::GoDaddy::REST::Util qw(json_encode);
sub run_docs {
my $self = shift;
my $usage = "Usage:\n docs [schema] [id]\n do
[ map {" $_"} keys %fields ],
[ map {
if ( ref($_) ) { json_encode($_) }
else {$_}
} values %fields
Moose;
use URI;
use URI::QueryParam;
use WWW::GoDaddy::REST::Util qw( abs_url json_instance json_encode json_decode is_json );
use constant DEFAULT_IMPL_CLASS => 'WWW::GoDaddy::REST::Resource';
use o
rt ) ) || DEFAULT_IMPL_CLASS;
eval "require $impl;";
}
else {
# hmm, the json response didn't seem to be a hashref...
# well in this case, there are not really any fie
# content
$params->{fields} = {};
}
return $impl->new($params);
}
sub TO_JSON {
my $self = shift;
return $self->data;
}
sub data {
my $self = shift;
my %fiel
ngs;
use JSON qw();
use Sub::Exporter -setup => {
exports => [
qw( abs_url
add_filters_to_url
build_complex_query_url
is_json
json_decode
json_encode
json_instance
)
]
};
use URI;
use URI::QueryParam;
sub is_json {
my $json = shift;
my $handler = json_instance(@_);
eval { my $perl = json_d
ecode($json); };
if ($@) {
return 0;
}
else {
return 1;
}
}
sub json_encode {
my $perl = shift;
my $handler = json_instance(@_);
return $handler->encode
ST::Util qw(abs_url json_encode json_decode is_json );
subtype 'PositiveInt', as 'Int', where { $_ > 0 };
no Moose::Util::TypeConstraints;
my $JSON_MIME_TYPE = 'application/json';
has 'url' => (
=> 'Str',
required => 0,
documentation => 'Optional, cached copy of the schemas JSON to avoid HTTP round trip'
);
has 'schemas' => (
is => 'rw',
isa => 'ArrayRef[
( 'schemas/%s', $specific_name );
return abs_url( $base, $path );
}
sub http_request_schemas_json {
my $self = shift;
my $request = $self->build_http_request( 'GET', $self->schemas_url