NAME
JSON::RPC::LWP - Use any version of JSON RPC over any libwww supported transport protocols.
VERSION
version 0.007
SYNOPSIS
use JSON::RPC::LWP;
my $rpc = JSON::RPC::LWP->new(
from => 'name@address.com',
agent => 'Example ',
);
my $login = $rpc->call(
'https://us1.lacunaexpanse.com/empire', # uri
'login', # service
[$empire,$password,$api_key] # JSON container
);
METHODS
call( $uri, $method )call( $uri, $method, {...} )call( $uri, $method, [...] )call( $uri, $method, param1, param2, ... )-
Initiate a JSON::RPC::Common::Procedure::Call
Uses LWP::UserAgent for transport.
Then returns a JSON::RPC::Common::Procedure::Return
To check for an error use the
has_errormethod of the returned object. notify( $uri, $method )notify( $uri, $method, {...} )notify( $uri, $method, [...] )notify( $uri, $method, param1, param2, ... )-
Initiate a JSON::RPC::Common::Procedure::Call
Uses LWP::UserAgent for transport.
Basically this is the same as a call, except without the
idkey, and doesn't expect a JSON RPC result.Returns the HTTP::Response from
ua.To check for an error use the
is_errormethod of the returned response object.
ATTRIBUTES
previous_id-
This attribute is deprecated, and will always return
1immediately after a call. has_previous_id-
Returns true if the
previous_idhas any value associated with it.This method is deprecated.
clear_previous_id-
This method is deprecated.
Clears the previous id, useful for generators that do something different the first time they are used.
id_generator-
This attribute is deprecated, and is no longer used.
If you modified it in a subclass:
has '+id_generator' => ( default => sub{sub{1}}, );You should change it to only be modified on older versions of this module.
unless( eval{ JSON::RPC::LWP->VERSION(0.007); 1 } ){ # was always called with ( id => "1" ) has '+id_generator' => ( default => sub{sub{1}}, ); }If anyone was actually relying on this feature it might get added back in.
version-
The JSON RPC version to use. one of 1.0 1.1 or 2.0
agent-
Get/set the product token that is used to identify the user agent on the network. The agent value is sent as the "User-Agent" header in the requests. The default is the string returned by the
_agentattribute (see below).If the agent ends with space then the
_agentstring is appended to it.The user agent string should be one or more simple product identifiers with an optional version number separated by the "/" character.
Setting this will also set
ua->agentandmarshal->user_agent. _agent-
Returns the default agent identifier. This is a string of the form "JSON-RPC-LWP/#.###", where "#.###" is substituted with the version number of this library.
marshal-
An instance of JSON::RPC::Common::Marshal::HTTP. This is used to convert from a JSON::RPC::Common::Procedure::Call to a HTTP::Request, and from an HTTP::Response to a JSON::RPC::Common::Procedure::Return.
Attributes delegated to
marshalprefer_getrest_style_methodsprefer_encoded_get
ua-
An instance of LWP::UserAgent. This is used for the transport layer.
Attributes delegated to
uatimeoutproxyno_proxyenv_proxyfromcredentials
AUTHOR
Brad Gilbert <b2gills@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Brad Gilbert.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.