shopify_api.gemspec 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. # -*- encoding: utf-8 -*-
  2. Gem::Specification.new do |s|
  3. s.name = %q{shopify_api}
  4. s.version = "1.2.1"
  5. s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
  6. s.authors = ["Tobias L\303\274tke", "Cody Fauser", "Dennis Theisen"]
  7. s.date = %q{2010-10-05}
  8. s.description = %q{= Shopify API
  9. The Shopify API gem allows Ruby developers to programmatically access the admin section of Shopify stores.
  10. The API is implemented as XML over HTTP using all four verbs (GET/POST/PUT/DELETE). Each resource, like Order, Product, or Collection, has its own URL and is manipulated in isolation. In other words, we’ve tried to make the API follow the REST principles as much as possible.
  11. == Usage
  12. === Requirements
  13. All API usage happens through Shopify applications, created by either shop owners for their own shops, or by Shopify Partners for use by other shop owners:
  14. * Shop owners can create applications for themselves through their own admin (under the Preferences > Applications tab).
  15. * Shopify Partners create applications through their admin: http://app.shopify.com/services/partners
  16. For more information and detailed documentation about the API visit http://api.shopify.com
  17. === Getting Started
  18. ShopifyAPI uses ActiveResource to communicate with the REST web service. ActiveResource has to be configured with a fully authorized URL of a particular store first. To obtain that URL you can follow these steps:
  19. 1. First create a new application in either the partners admin or your store admin and write down your API_KEY and SHARED_SECRET.
  20. 2. You will need to supply two parameters to the Session class before you instantiate it:
  21. ShopifyAPI::Session.setup({:api_key => API_KEY, :secret => SHARED_SECRET})
  22. 3. Create a new Session for a specific shop. That session is not fully valid yet, but it can be used to create a URL that you will redirect your users to:
  23. session = ShopifyAPI::Session.new("yourshopname.myshopify.com")
  24. session.valid? # returns false
  25. 4. To access the API shop owners need a "token" from that specific shop. In order to get this token they need to authorize with that shop first. The URL to redirect your user to can be generated via:
  26. url = session.create_permission_url
  27. 5. After visiting this URL, the shop redirects the owner to a custom URL of your application where the "token" gets sent to (it's param name is just "t"). Use that token to instantiate a "valid" session, that is ready to make calls to that particular shop.
  28. token = params[:t]
  29. session = ShopifyAPI::Session.new("yourshopname.myshopify.com", token)
  30. session.valid? # returns true
  31. 6. Now you can finally get the fully authorized URL for that shop. Use that URL to configure ActiveResource and you're set:
  32. ActiveResource::Base.site = session.site
  33. 7. Get data from that shop (returns ActiveResource instances):
  34. shop = ShopifyAPI::Shop.current
  35. latest_orders = ShopifyAPI::Order.find(:all)
  36. == Copyright
  37. Copyright (c) 2009 "JadedPixel inc.". See LICENSE for details.
  38. }
  39. s.email = %q{developers@jadedpixel.com}
  40. s.extra_rdoc_files = [
  41. "LICENSE",
  42. "README.rdoc"
  43. ]
  44. s.files = [
  45. ".document",
  46. ".gitignore",
  47. "CHANGELOG",
  48. "LICENSE",
  49. "README.rdoc",
  50. "Rakefile",
  51. "lib/shopify_api.rb",
  52. "lib/shopify_api/cli.rb",
  53. "shopify_api.gemspec",
  54. "test/order_test.rb",
  55. "test/shopify_api_test.rb",
  56. "test/test_helper.rb"
  57. ]
  58. s.homepage = %q{http://github.com/Shopify/shopify_api}
  59. s.rdoc_options = ["--charset=UTF-8"]
  60. s.require_paths = ["lib"]
  61. s.rubyforge_project = %q{shopify-api}
  62. s.rubygems_version = %q{1.3.7}
  63. s.summary = %q{ShopifyAPI is a lightweight gem for accessing the Shopify admin REST web services}
  64. s.test_files = [
  65. "test/order_test.rb",
  66. "test/shopify_api_test.rb",
  67. "test/test_helper.rb"
  68. ]
  69. s.executables = ['shopify']
  70. if s.respond_to? :specification_version
  71. current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
  72. s.specification_version = 3
  73. end
  74. s.add_dependency("activeresource", [">= 2.2.2"])
  75. s.add_dependency("thor", [">= 0.14.4"])
  76. if s.respond_to?(:add_development_dependency)
  77. s.add_development_dependency("mocha", ">= 0.9.8")
  78. else
  79. s.add_dependency("mocha", ">= 0.9.8")
  80. end
  81. end