NAME
WWW::BigDoor::Resource - provides a perl OO interface for BigDoor's REST API.
VERSION
This document describes BigDoor version 0.1.1
SYNOPSIS
use WWW::BigDoor;
use WWW::BigDoor::Resource;
my $client = new WWW::BigDoor( $APP_SECRET, $APP_KEY );
my $currency_types = WWW::BigDoor::CurrencyType->all( $client );
my $currency_type1 = WWW::BigDoor::CurrencyType->load( $client, 1 );
my $currencies = WWW::BigDoor::Currency->all( $client );
my $currency_obj = new WWW::BigDoor::Currency(
{
pub_title => 'Coins',
pub_description => 'an example of the Purchase currency type',
end_user_title => 'Coins',
end_user_description => 'can only be purchased',
currency_type_id => '1',
currency_type_title => 'Purchase',
exchange_rate => 900.00,
relative_weight => 2,
}
);
$currency_obj->save( $client );
printf "currency id = %d\n", $currency->get_id;
$currency_obj->remove( $client );
DESCRIPTION
There are following objects available and their corresponding API end points:
- Attribute /attribute
- Award /end_user/{id}/award
- CurrencyBalance /end_user/{id}/currency_balance
- Currency /currency
- CurrencyType /currency_type
- EndUser /end_user
- Good /end_user/{id}/good
- Leaderboard /leaderboard/
- Level /end_user/
- NamedAwardCollection /named_award_collection
- NamedAward /named_award
- NamedGoodCollection /named_good_collection
- NamedGood /named_collection
- NamedLevelCollection /named_level_collection
- NamedLevel /named_level
- NamedTransactionGroup /named_transaction_group
- NamedTransaction /named_transaction
- Profile /end_user/{id}/profile
- URL /url
For their attributes see online documentation http://publisher.bigdoor.com/docs/
INTERFACE
new( $args )
Constructs a new BigDoor Resource object
- args
-
Reference to hash of Resource object attributes
all( $client )
Loads all Resource objects of this type.
- client
-
WWW::BigDoor client object
load( $client, [$id] )
Loads single Resource object identified by id or reloads existing object if id omitted.
- client
-
WWW::BigDoor client object
- id
-
BigDoor Resource object ID. If calling object has id attribute defined, $id parameter is optional
save( $client )
Saves Resource object. If object has id
attribute defined than PUT method is used, otherwise POST is used.
- client
-
WWW::BigDoor client object
remove( $client, [$id] )
- client
-
WWW::BigDoor client object
- id
-
BigDoor Resource object ID. If calling object has id attribute defined, $id parameter is optional.
end_point()
Returns corresponding end_point URL for this particular object.
DIAGNOSTICS
In case of HTTP errors check HTTP response code returned by $client->get_response_code()
or response body returned by $client->get_response_content()
.
For debugging purpose there is result object returned by REST::Client c<request()> call which could be accessed through get_request()
and this result object contains HTTP::Response object.
CONFIGURATION AND ENVIRONMENT
WWW::BigDoor::Resource requires no configuration files or environment variables.
DEPENDENCIES
The module requires WWW::BigDoor module and all its dependecies.
DIFFERENCES FROM PYTHON BIGDOORKIT
Method name get()
was changed to load()
to avoid conflict with get()
method inherited from Class::Accessor. Method name delete
was changed to remove()
to avoid conflict with Perl internal method delete
.
INCOMPATIBILITIES
None reported.
BUGS AND LIMITATIONS
Code is not fully covered by tests and there are not much tests for failures and, as consequence, not much parameters validation or checking for error conditions. Don't expect too much diagnosticts in case of errors.
Objects correspondig to following end points are not currently implemented:
http://api.bigdoor.com/api/publisher/{application_key}/auth
http://api.bigdoor.com/api/publisher/{application_key}/proxy
http://api.bigdoor.com/api/publisher/{application_key}/transaction_summary
http://api.bigdoor.com/api/publisher/{application_key}/award_summary
http://api.bigdoor.com/api/publisher/{application_key}/level_summary
http://api.bigdoor.com/api/publisher/{application_key}/good_summary
No bugs have been reported.
Please report any bugs or feature requests to bug-bigdoor@rt.cpan.org
, or through the web interface at http://rt.cpan.org.
SEE ALSO
WWW::BigDoor for procedural interface to BigDoor REST API
AUTHOR
Alex L. Demidov <alexeydemidov@gmail.com>
LICENCE AND COPYRIGHT
BigDoor Open License Copyright (c) 2010 BigDoor Media, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- This copyright notice and all listed conditions and disclaimers shall be included in all copies and portions of the Software including any redistributions in binary form.
- The Software connects with the BigDoor API (api.bigdoor.com) and all uses, copies, modifications, derivative works, mergers, publications, distributions, sublicenses and sales shall also connect to the BigDoor API and shall not be used to connect with any API, software or service that competes with BigDoor's API, software and services.
- Except as contained in this notice, this license does not grant you rights to use BigDoor Media, Inc. or any contributors; name, logo, or trademarks.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.