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.

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('WWW::Shopify::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('WWW::Shopify::Model::Product');

Easy enough.

To insert a Webhook, we'd do the following.

my $webhook = new WWW::Shopify::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('WWW::Shopify::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.

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.

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.

verify_proxy

Same as verify_login.

update_item

Simple convenience method; updates a DB object with the data contained with a JSON-esque object.

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

MIT License