NAME
Net::Async::SPORE::Loader - loads SPORE API definitions
VERSION
Version 0.001
SYNOPSIS
my $api = Net::Async::SPORE::Loader->new_from_file(
'sample.json',
transport => 'Net::Async::HTTP',
class => 'Sample::API',
);
$api->some_request(x => 123, y => 456)->get;
DESCRIPTION
This is the API loader class. It'll read in definitions and create classes in memory.
METHODS
new_from_file
Instantiate a new API object from the given file.
my $api = Net::Async::SPORE::Loader->new_from_file(
'sample.json',
transport => 'Net::Async::HTTP',
class => 'Sample::API',
);
$api->some_request(x => 123, y => 456)->get;
new
Instantiates an API object from a definition provided as a hashref.
my $api = Net::Async::SPORE::Loader->new(
{ ... },
transport => 'Net::Async::HTTP',
class => 'Sample::API',
);
$api->some_request(x => 123, y => 456)->get;
METHODS - Internal
You're welcome to use these, but you probably don't need them.
apply_methods
Applies the API methods to the target class.
FUNCTIONS
inject_method
Helper function for adding a method to the given class.
inject_method($target_class, $method_name, $code);
Will raise an exception if the method is already there.
_next_api_class
Returns an autogenerated class name.
AUTHOR
Tom Molesworth <cpan@perlsite.co.uk>
LICENSE
Copyright Tom Molesworth 2012-2014. Licensed under the same terms as Perl itself.