NAME
WWW::Shopify - Main object representing acess to a particular Shopify store.
DISCLAIMER
WWW::Shopify is my first official CPAN module, so please bear with me as I try to sort out all the bugs, and deal with the unfamiliar CPAN infrastructure. Don't expect this to work out of the box as of yet, I'm still learning exactly how things are working. Hence some version problems I've been having.
Thanks for your understanding.
DESCRIPTION
WWW::Shopify represents a way to grab and upload data to a particular shopify store. All that's required is the access token for a particular app, its url, and the API key, or altenratively, if you have a private app, you can substitue the app password for the api key. If you want to use make a private app, use WWW::Shopify::Private. If you want to make a public app, use WWW::Shopify::Public.
EXAMPLES
In order to get a list of all products, we can do the following:
# Here we instantiate a copy of the public API object, with all the necessary fields.
my $SA = new WWW::Shopify::Public($ShopURL, $APIKey, $AccessToken);
# Here we call get_all, OO style, and specify the entity we want to get.
my @Products = $SA->get_all('Product');
In this way, we can get and modify all the different types of shopify stuffs.
If you don't want to be using a public app, and just want to make a private app, it's just as easy:
# Here we instantiate a copy of the private API object this time, which means we don't need an access token, we just need a password.
my $sa = new WWW::Shopify::Private($shop_url, $api_key, $password);
my @Products = $SA->get_all('Product');
Easy enough.
To insert a Webhook, we'd do the following.
my $webhook = new WWW::Shopify::Model::Webhook({topic => "orders/create", address => $URL, format => "json"});
$SA->create($Webhook);
And that's all there is to it. To delete all the webhooks in a store, we'd do:
my @Webhooks = $SA->get_all('Webhook');
for (@Webhooks) {
$SA->delete($_);
}
Very easy.
METHODS
api_key
Gets/sets the applciation api key to use for this particular app.
shop_url
Gets/sets the shop url that we're going to be making calls to.
calc_webhook_signature
Calculates the webhook_signature based off the shared secret and request body passed in.
verify_webhook
Shopify webhook authentication. ALMOST the same as login authentication, but, of course, because this is shopify they've got a different system. 'Cause you know, one's not good enough.
Follows this: http://wiki.shopify.com/Verifying_Webhooks.
calc_login_signature
Calculates the login signature based on the shared secret and parmaeter hash passed in.
verify_login
Shopify app dashboard verification (when someone clicks Login on the app dashboard).
This one was kinda random, 'cause they say it's like a webhook, but it's actually like legacy auth.
Also, they don't have a code parameter. For whatever reason.
calc_proxy_signature
Based on shared secret/hash of parameters passed in, calculates the proxy signature.
verify_proxy
This is SLIGHTLY different from the above two. For, as far as I can tell, no reason.
SEE ALSO
WWW::Shopify::Public, WWW::Shopify::Private, WWW::Shopify::Test, WWW::Shopify::Item, WWW::Shopify::Common::DBIx
AUTHOR
Adam Harrison (adamdharrison@gmail.com)
LICENSE
Copyright (C) 2013 Adam Harrison
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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
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.