Spica::Spec::Declare
package Your::Spec; use Spica::Spec::Declare; client { name 'example'; endpoint 'search' => '/examples' => [qw(access_token)]; columns ( 'access_token' => +{from => 'accessToken', no_row_accessor => 1}, 'id' => +{from => 'exampleId'}, 'name' => +{from => 'exampleName'}, 'status', ); };
client defines the specification of the API. client In Spica is a power that defines the structure of each data, not URI.
client
Spica
client { .. client's settings .. };
name defines the name of the client. name fields are required.
name
client { name 'client_name'; };
on fetch calling:
$spica->fetch('client_name', ...);
endpoint defines the path and requires param. endpoint it is possible to define more than one against client one.
endpoint
Make the request using the GET method as the initial value in this definition. If you want to specify the HTTP method, please refer to the matter.
client { name 'client_name'; endpoint 'endpoint_name' => '/path/to' => [qw(id)]; };
on fetch:
$spica->fetch('client_name', 'endpoint_name', \%param);
If you specify a string of default to $endpoint_name, you can omit the $endpoint_name when you use the Spica->fetch.
default
$endpoint_name
client { name 'client_name'; endpoint 'default' => '/path/to' => [qw(id)]; };
$spica->fetch('client_name', \%param);
endpoint defines the path and request method and requires param.
client { name 'client_name'; endpoint 'default' => +{ method => 'POST', path => '/path/to', requires => [qw(id)], }; };
Specify an Iterator class. Spica::Receiver::Iterator Is used by default.
Spica::Receiver::Iterator
client { ... receiver 'Your::Iterator'; };
Specify an Row class. Spica::Receiver::Row::* Is used by default.
Spica::Receiver::Row::*
client { ... row_class 'Your::Row::Example'; };
To install Spica, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Spica
CPAN shell
perl -MCPAN -e shell install Spica
For more information on module installation, please visit the detailed CPAN module installation guide.