Created
May 3, 2013 09:46
-
-
Save hjblok/5508251 to your computer and use it in GitHub Desktop.
A rudimentary Shopify App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We'll use the Ruby library provided by Shopify. You can install this as a gem. | |
# More info on: https://github.com/shopify/shopify_api | |
require "shopify_api" | |
# Next we need some authentication to be able to access our Shop. Lets use a private App for the moment: | |
# 1. follow the instructions on http://docs.shopify.com/api/tutorials/creating-a-private-app to create one, | |
# 2. insert the API-KEY and PASSWORD in the url below, | |
# 3. also change MY-SHOP into your shops subdomain. | |
ShopifyAPI::Base.site = "https://API-KEY:[email protected]/admin" | |
# Now we'll be using the Shopify API to interact with our Shop. | |
# Our App needs a list of Products. According to the API documentation, this should be possible, | |
# see http://docs.shopify.com/api/product#index | |
my_products = ShopifyAPI::Product.all # this will start a HTTP GET request to /admin/products.json | |
# Yet we can do whatever our App needs to do with our Products, this App just displays our Products | |
puts my_products.inspect |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Without using a library provided by Shopify, an even more rudimentary App would be: | |
curl "https://API-KEY:[email protected]/admin/products.json" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment