NAME
Net::API::Stripe::Generic - A Stripe Generic Module
VERSION
v0.101.1
DESCRIPTION
This is a module inherited by all other Net::API::Stripe modules. Its purpose is to provide some shared methods and special object instantiation procedure with some key properties set such as _parent and _field.
CONSTRUCTOR
new( %ARG )
Creates a new Net::API::Stripe::Fraud object. It may also take an hash like arguments, that also are method of the same name.
Possible parameters are:
- _parent The parent calling object
- _field The field or property name this object is associated with
- _error
- debug Integer. A debug level.
- _dbh A Database handler, if any
- _init_strict_use_sub Boolean set for method init in Module::Generic. When set to true, only parameters that have a corresponding method will be accepted.
METHODS
field
Set/get the field to which this object is associated
parent
Set/get the parent (caller) of this object.
TO_JSON
Returns a stringified version of this object if the method as_string exists or is inherited, otherwise it just returns the object itself.
_address_populate
Provided with an Net::API::Stripe::Address object, and this will set the fields line, line2, city, postal_code, state and country to address_line, address_line2, address_city, address_zip, address_state and address_country.
This is used in Net::API::Stripe::Payment::Source and Net::API::Stripe::Connect::ExternalAccount::Card
_get_base_class
Get the base class of the object
_instantiate_object( field, class )
Provided with a field aka property name and a class name and this method creates an object.
If the object is already instantiated, it returns it.
Otherwise, it will attempt to load the given class using _load_class from Module::Generic or return undef and set an error if an error occurred.
_object_type_to_class( type )
Provided with a Stripe object type such as charge or invoice or customer, this method will return the equivalent Net::API::Stripe module package name.
_set_get_hash( field, hash )
Provided with a field (aka property) name and a hash reference, and this method will call method _set_get_hash_as_object from Module::Generic to create an hash whose properties can be accessed as methods of an object. So:
$o->name
instead of:
$o->{name}
_set_get_number( field, number )
Provided with a field (aka property) and a number, this will create a new Module::Generic::Number object for the associated field field
_set_get_object_array( field, class, array reference )
Provided with a field (aka property) name, a class (package name) and an array reference, and this method will instantiate an object for each array entry.
It returns an array reference for this field
_set_get_object_variant( field, hash or array reference )
Provided with a field (aka property) name and an hash or array reference and this method will instantiate an object if the data provided is an hash reference or it will instantiate an array of objects if the data provided is an array reference.
_set_get_scalar_or_object_variant( field, scalar, hash or array reference )
Provided with a scalar, an hash reference or an array reference and this will set the value for this field accordingly.
If this is just a scalar, the scalar value will be set for the field. If the data is an hash reference or an array reference, the same operation is done as in method _set_get_object_variant
_set_get_uri( field, uri )
Provided with a field (aka a property) and an uri and this will create an URI object for this field
_will
Calls will from the module Module::Generic
HISTORY
v0.100.0
Initial version
AUTHOR
Jacques Deguest <jack@deguest.jp>
SEE ALSO
Net::API::Stripe, Module::Generic, Module::Generic::Number, JSON, URI
COPYRIGHT & LICENSE
Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.