NAME
OAuthomatic::Types - few helper types to make code more readable and less error-prone
DESCRIPTION
Types below are defined to make code a bit more readable and less error prone.
OAuthomatic::Types::StructBase
Role composed into types defined below. Handles a few common conventions.
METHODS
new
Adds two conventions to usual parameter handling:
Any empty or undef'ed values given to the constructor are dropped as if they were not specified at all.
If args
data
andremap
are given to the constructor, they are used to translate field names, for example:Something->new(data=>{aaa=>'x', bbb=>'y'}, remap=>{aaa=>'token', 'bbb'=>'secret');
is equivalent to:
Something->new(token=>'x', secret=>'y');
Partial replacements are possible too:
Something->new(data=>{token=>'x', bbb=>'y'}, remap=>{'bbb'=>'secret');
Class->of_my_type(obj)
Checks whether given object is of given structure type. Returns 1 if so, 0 if it is undef, throws if it is of another type.
Class->equal(obj1, obj2)
Compares two objects, allowing undef-s but raises on wrong type.
OAuthomatic::Types::ClientCred
Client (application) credentials. Fixed key and secret allocated manually using server web interface (usually after filling some form with various details) which identify the application.
ATTRIBUTES
- key
-
Client key - the application identifier.
- secret
-
Client secret - confidential value used to sign requests, to prove key is valid.
OAuthomatic::Types::TemporaryCred
Temporary (request) credentials. Used during process of allocating token credentials.
ATTRIBUTES
- token
-
Actual token - identifier quoted in requests.
- secret
-
Associated secret - confidential value used to sign requests, to prove they are valid.
-
Full URL of the page end user should use to spend this temporary credential and generate access token. Already contains the token.
OAuthomatic::Types::TokenCred
Token (access) credentials. Those are used to sign actual API calls.
OAuthomatic::Types::Verifier
Verifier info, returned from authorization.