NAME
WWW::Giraffi::API::Request - Giraffi API Access Request Base Module
VERSION
0.13_04
SYNOPSIS
use strict;
use warnings;
use WWW::Giraffi::API::Request;
my $apikey = "ilovenirvana_ilovekurtcobain";
my $g = WWW::Giraffi::API->new(apikey => $apikey);
# get all media data
my $arrayref = $g->media->all;
foreach $ref(@{$arrayref}) {
## anything to do...
}
DESCRIPTION
WWW::Giraffi::API::Request is Giraffi API Access Request Base Module
Axion/Item/Media/Service/Trigger Base Module
GLOBAL VARIABLE
%REQUEST_HEADERS
request headers hash
(
"Accept" => "application/json",
"Content-Type" => "application/json"
)
$CLIENT_TIMEOUT_DELAY
2;
$CLIENT_TIMEOUT_CODE
408;
ACCESSOR METHOD
apikey
agent
ssl_verify_hostname
use_time_piece
timeout
default_endpoint
applogs_endpoint
monitoringdata_endpoint
last_request
last_response
verbose
METHOD
get
Request GET method. request method wrapper
Example:
# $ref is hash or array reference
my $path_or_uri = "media.json";
my $queryref = { name => "Alert Email" };
my $ref = $req->get($path_or_uri, $queryref);
post
Request POST method. request method wrapper
Example:
# $ref is hash or array reference
my $path_or_uri = "media.json";
my $queryref = {};
my $contentref = {
options' => { address => "me@domain" },
mediumtype => 'email',
name => 'Alert Email',
};
my $ref = $req->post($path_or_uri, $queryref, $contentref);
put
Request PUT method. request method wrapper
Example:
# $ref is hash or array reference
my $path_or_uri = "media/1.json";
my $queryref = {};
my $contentref = {
mediumtype => 'twitter',
name => 'Emergency Email',
};
my $ref = $req->put($path_or_uri, $queryref, $contentref);
delete
Request DELETE method. request method wrapper
Example:
# $ref is hash or array reference
my $path_or_uri = "media/1.json";
my $queryref = {};
my $contentref = {};
my $ref = $req->delete($path_or_uri, $queryref, $contentref);
request
GET/POST/PUT/DELETE low layer request method
Example:
my $path_or_uri = "media/1.json";
my $queryref = {};
my $contentref = {
mediumtype => 'twitter',
name => 'Emergency Email',
};
# $res is HTTP::Response Object
my $res = $req->request("PUT", $path_or_uri, $queryref, $contentref);
make_request
Create HTTP::Request Object. using internal request method
Example:
my $path_or_uri = "media.json";
my $queryref = { name => "Alert Email" };
my $contentref = {};
# $req is HTTP::Request Object
my $res = $req->make_request("GET", $path_or_uri, $queryref, $contentref);
make_response
Create HTTP::Response Object. using internal request method
Example:
# $res is HTTP::Response Object
my $code = 500;
my $message = "internal server error";
my $json = JSON::Any->new->encode({ error => $message });
my $res = $req->make_response($code, $message, $json);
AUTHOR
Akira Horimoto <emperor@gmail.com>
SEE ALSO
Class::XSAccessor Crypt::SSLeay JSON::Any LWP::Protocol::https
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.