shopify_api 9.0.2 → 9.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +36 -0
  3. data/.github/workflows/build.yml +41 -0
  4. data/.gitignore +2 -1
  5. data/.rubocop.yml +23 -3
  6. data/.rubocop_todo.yml +75 -0
  7. data/CHANGELOG.md +43 -0
  8. data/CONTRIBUTING.md +1 -1
  9. data/Gemfile +5 -0
  10. data/Gemfile.lock +151 -0
  11. data/Gemfile_ar51 +1 -1
  12. data/README.md +47 -31
  13. data/RELEASING +10 -6
  14. data/Rakefile +16 -5
  15. data/SECURITY.md +59 -0
  16. data/docs/_config.yml +1 -0
  17. data/docs/_includes/footer.html +28 -0
  18. data/docs/_includes/head.html +28 -0
  19. data/docs/_layouts/index.html +57 -0
  20. data/docs/graphql.md +47 -2
  21. data/docs/index.md +639 -0
  22. data/lib/active_resource/connection_ext.rb +1 -0
  23. data/lib/active_resource/detailed_log_subscriber.rb +6 -7
  24. data/lib/active_resource/json_errors.rb +8 -2
  25. data/lib/shopify_api.rb +8 -1
  26. data/lib/shopify_api/api_access.rb +57 -0
  27. data/lib/shopify_api/api_version.rb +6 -5
  28. data/lib/shopify_api/connection.rb +1 -0
  29. data/lib/shopify_api/countable.rb +3 -2
  30. data/lib/shopify_api/disable_prefix_check.rb +2 -2
  31. data/lib/shopify_api/events.rb +2 -1
  32. data/lib/shopify_api/graphql.rb +28 -8
  33. data/lib/shopify_api/limits.rb +3 -2
  34. data/lib/shopify_api/message_enricher.rb +11 -9
  35. data/lib/shopify_api/meta.rb +0 -1
  36. data/lib/shopify_api/metafields.rb +5 -4
  37. data/lib/shopify_api/pagination_link_headers.rb +5 -4
  38. data/lib/shopify_api/resources.rb +1 -0
  39. data/lib/shopify_api/resources/access_scope.rb +1 -1
  40. data/lib/shopify_api/resources/access_token.rb +1 -0
  41. data/lib/shopify_api/resources/address.rb +1 -0
  42. data/lib/shopify_api/resources/announcement.rb +2 -1
  43. data/lib/shopify_api/resources/application_charge.rb +1 -0
  44. data/lib/shopify_api/resources/application_credit.rb +1 -0
  45. data/lib/shopify_api/resources/article.rb +3 -2
  46. data/lib/shopify_api/resources/asset.rb +6 -5
  47. data/lib/shopify_api/resources/assigned_fulfillment_order.rb +1 -1
  48. data/lib/shopify_api/resources/base.rb +12 -8
  49. data/lib/shopify_api/resources/billing_address.rb +1 -0
  50. data/lib/shopify_api/resources/blog.rb +2 -1
  51. data/lib/shopify_api/resources/carrier_service.rb +1 -0
  52. data/lib/shopify_api/resources/cart.rb +2 -1
  53. data/lib/shopify_api/resources/collect.rb +1 -0
  54. data/lib/shopify_api/resources/collection_listing.rb +1 -0
  55. data/lib/shopify_api/resources/comment.rb +20 -5
  56. data/lib/shopify_api/resources/country.rb +1 -0
  57. data/lib/shopify_api/resources/custom_collection.rb +4 -3
  58. data/lib/shopify_api/resources/customer.rb +2 -1
  59. data/lib/shopify_api/resources/customer_group.rb +1 -0
  60. data/lib/shopify_api/resources/customer_invite.rb +1 -0
  61. data/lib/shopify_api/resources/customer_saved_search.rb +2 -1
  62. data/lib/shopify_api/resources/discount_code.rb +1 -0
  63. data/lib/shopify_api/resources/discount_code_batch.rb +34 -0
  64. data/lib/shopify_api/resources/draft_order.rb +1 -0
  65. data/lib/shopify_api/resources/draft_order_invoice.rb +1 -0
  66. data/lib/shopify_api/resources/event.rb +1 -0
  67. data/lib/shopify_api/resources/fulfillment.rb +12 -3
  68. data/lib/shopify_api/resources/fulfillment_event.rb +1 -0
  69. data/lib/shopify_api/resources/fulfillment_order.rb +30 -16
  70. data/lib/shopify_api/resources/fulfillment_order_locations_for_move.rb +1 -0
  71. data/lib/shopify_api/resources/fulfillment_request.rb +1 -0
  72. data/lib/shopify_api/resources/fulfillment_service.rb +1 -0
  73. data/lib/shopify_api/resources/fulfillment_v2.rb +3 -2
  74. data/lib/shopify_api/resources/gift_card.rb +1 -0
  75. data/lib/shopify_api/resources/image.rb +2 -1
  76. data/lib/shopify_api/resources/inventory_level.rb +3 -4
  77. data/lib/shopify_api/resources/line_item.rb +4 -3
  78. data/lib/shopify_api/resources/location.rb +1 -1
  79. data/lib/shopify_api/resources/marketing_event.rb +1 -0
  80. data/lib/shopify_api/resources/metafield.rb +1 -0
  81. data/lib/shopify_api/resources/note_attribute.rb +1 -0
  82. data/lib/shopify_api/resources/option.rb +1 -0
  83. data/lib/shopify_api/resources/order.rb +2 -1
  84. data/lib/shopify_api/resources/order_risk.rb +1 -0
  85. data/lib/shopify_api/resources/page.rb +1 -0
  86. data/lib/shopify_api/resources/payment_details.rb +1 -0
  87. data/lib/shopify_api/resources/policy.rb +1 -0
  88. data/lib/shopify_api/resources/price_rule.rb +1 -1
  89. data/lib/shopify_api/resources/product.rb +27 -3
  90. data/lib/shopify_api/resources/product_listing.rb +1 -0
  91. data/lib/shopify_api/resources/province.rb +1 -0
  92. data/lib/shopify_api/resources/receipt.rb +1 -0
  93. data/lib/shopify_api/resources/recurring_application_charge.rb +4 -1
  94. data/lib/shopify_api/resources/redirect.rb +1 -0
  95. data/lib/shopify_api/resources/refund.rb +2 -1
  96. data/lib/shopify_api/resources/report.rb +1 -0
  97. data/lib/shopify_api/resources/resource_feedback.rb +1 -1
  98. data/lib/shopify_api/resources/rule.rb +1 -0
  99. data/lib/shopify_api/resources/script_tag.rb +1 -0
  100. data/lib/shopify_api/resources/shipping_address.rb +1 -0
  101. data/lib/shopify_api/resources/shipping_line.rb +1 -0
  102. data/lib/shopify_api/resources/shipping_zone.rb +1 -0
  103. data/lib/shopify_api/resources/shop.rb +2 -1
  104. data/lib/shopify_api/resources/smart_collection.rb +4 -8
  105. data/lib/shopify_api/resources/storefront_access_token.rb +1 -0
  106. data/lib/shopify_api/resources/tax_line.rb +1 -0
  107. data/lib/shopify_api/resources/tax_service.rb +1 -0
  108. data/lib/shopify_api/resources/theme.rb +1 -0
  109. data/lib/shopify_api/resources/transaction.rb +1 -0
  110. data/lib/shopify_api/resources/usage_charge.rb +1 -0
  111. data/lib/shopify_api/resources/user.rb +1 -0
  112. data/lib/shopify_api/resources/variant.rb +35 -0
  113. data/lib/shopify_api/resources/webhook.rb +1 -0
  114. data/lib/shopify_api/session.rb +43 -14
  115. data/lib/shopify_api/version.rb +2 -1
  116. data/lib/verify_docs.rb +8 -0
  117. data/service.yml +1 -1
  118. data/shopify_api.gemspec +13 -6
  119. data/test/access_token_test.rb +6 -5
  120. data/test/active_resource/json_errors_test.rb +6 -6
  121. data/test/api_access_test.rb +153 -0
  122. data/test/api_version_test.rb +3 -3
  123. data/test/application_charge_test.rb +30 -27
  124. data/test/application_credit_test.rb +10 -9
  125. data/test/article_test.rb +34 -35
  126. data/test/asset_test.rb +14 -6
  127. data/test/assigned_fulfillment_order_test.rb +5 -4
  128. data/test/base_test.rb +64 -49
  129. data/test/blog_test.rb +4 -3
  130. data/test/carrier_service_test.rb +7 -6
  131. data/test/cart_test.rb +2 -1
  132. data/test/collect_test.rb +4 -3
  133. data/test/collection_listing_test.rb +21 -16
  134. data/test/collection_publication_test.rb +8 -8
  135. data/test/collection_test.rb +20 -19
  136. data/test/countable_test.rb +3 -2
  137. data/test/currency_test.rb +5 -5
  138. data/test/custom_collection_test.rb +4 -3
  139. data/test/customer_saved_search_test.rb +18 -8
  140. data/test/customer_test.rb +22 -14
  141. data/test/detailed_log_subscriber_test.rb +15 -11
  142. data/test/discount_code_batch_test.rb +41 -0
  143. data/test/discount_code_test.rb +21 -15
  144. data/test/draft_order_test.rb +68 -52
  145. data/test/fixtures/assigned_fulfillment_orders.json +2 -0
  146. data/test/fixtures/discount_code_batch.json +14 -0
  147. data/test/fixtures/discount_code_batch_discount_codes.json +21 -0
  148. data/test/fixtures/fulfillment_order.json +1 -0
  149. data/test/fixtures/fulfillment_orders.json +2 -0
  150. data/test/fulfillment_event_test.rb +31 -26
  151. data/test/fulfillment_order_test.rb +215 -147
  152. data/test/fulfillment_order_test_helper.rb +1 -0
  153. data/test/fulfillment_request_test.rb +10 -8
  154. data/test/fulfillment_service_test.rb +13 -12
  155. data/test/fulfillment_test.rb +81 -66
  156. data/test/fulfillment_v2_test.rb +16 -12
  157. data/test/gift_card_test.rb +6 -4
  158. data/test/graphql_test.rb +55 -23
  159. data/test/image_test.rb +19 -17
  160. data/test/inventory_level_test.rb +24 -15
  161. data/test/lib/webmock_extensions/last_request.rb +1 -1
  162. data/test/limits_test.rb +2 -1
  163. data/test/location_test.rb +2 -1
  164. data/test/marketing_event_test.rb +20 -20
  165. data/test/message_enricher_test.rb +6 -6
  166. data/test/meta_test.rb +7 -9
  167. data/test/metafield_test.rb +30 -20
  168. data/test/order_risk_test.rb +17 -16
  169. data/test/order_test.rb +43 -28
  170. data/test/pagination_test.rb +89 -56
  171. data/test/policy_test.rb +6 -5
  172. data/test/price_rule_test.rb +20 -15
  173. data/test/product_listing_test.rb +20 -20
  174. data/test/product_publication_test.rb +8 -8
  175. data/test/product_test.rb +71 -20
  176. data/test/publication_test.rb +3 -3
  177. data/test/recurring_application_charge_test.rb +104 -42
  178. data/test/redirect_test.rb +4 -3
  179. data/test/refund_test.rb +22 -17
  180. data/test/report_test.rb +12 -10
  181. data/test/resource_feedback_test.rb +14 -13
  182. data/test/script_tag_test.rb +10 -9
  183. data/test/session_test.rb +234 -43
  184. data/test/shipping_zone_test.rb +4 -3
  185. data/test/shop_test.rb +47 -33
  186. data/test/smart_collection_test.rb +5 -29
  187. data/test/storefront_access_token_test.rb +13 -15
  188. data/test/tax_service_test.rb +7 -4
  189. data/test/tender_transaction_test.rb +3 -3
  190. data/test/test_helper.rb +14 -12
  191. data/test/transaction_test.rb +4 -3
  192. data/test/usage_charge_test.rb +12 -8
  193. data/test/user_test.rb +4 -3
  194. data/test/variant_test.rb +50 -23
  195. data/test/webhook_test.rb +10 -7
  196. metadata +30 -15
  197. data/.rubocop-https---shopify-github-io-ruby-style-guide-rubocop-yml +0 -1027
  198. data/.travis.yml +0 -23
  199. data/bin/shopify +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecdf64046f5d81646d89f356cab1bbf7ca3aefddbba51a28901b723f0dec8e4b
4
- data.tar.gz: a64041593db78180893580ec8b3581b7927c39452b2ad5004575aa0a7afc209d
3
+ metadata.gz: 73854704f72bca959d915cec44e6c54f794d3d5d60dc97f343f4993a88e08a55
4
+ data.tar.gz: a85ee03d769fddbbb6f5df673cffedbd5b6f2706c3f3a27ba2096fbde622585e
5
5
  SHA512:
6
- metadata.gz: 267a96c8839314b7bb195e0e1288d3bad23a9a5e4a524190e59a2ed2e9ffc2ba9f6f78e0a5d93d4edf56dbcbff15f387c2217893b62839c4faa6e969f2ff4fa3
7
- data.tar.gz: 42d7b26d80dba411512c86e2be195899527ce106f8450a1b8b4fe6e073a363160431a72771ada837d8f0f008523fa5871b10e5da46c9ebffb3e67d04d724197e
6
+ metadata.gz: d98a3b0c0c57787436e557aa66f3f5d7de4f2373ae7e97eb0dd3283da7935f0c30d561ed690b132c54a7336ad040d25e2be66888892b05e1ca8844ad0eb6266f
7
+ data.tar.gz: 6d11786b5b42c116370c5696ae8cf43b3ee111a6ab344b3d0d0e7c738510323b74f7d7df6441c9c83dba6286d53218185c41ef211eb5f61b64a95c807ea1c9c9
@@ -0,0 +1,36 @@
1
+ # Issue summary
2
+
3
+ Write a short description of the issue here ↓
4
+
5
+
6
+
7
+ ## Expected behavior
8
+
9
+ What do you think should happen?
10
+
11
+
12
+
13
+ ## Actual behavior
14
+
15
+ What actually happens?
16
+
17
+ Tip: include an error message (in a `<details></details>` tag) if your issue is related to an error
18
+
19
+
20
+
21
+ ## Steps to reproduce the problem
22
+
23
+ 1.
24
+ 1.
25
+ 1.
26
+
27
+ ## Logs
28
+ If applicable, enable the logs as described in the README, and paste the relevant portion here.
29
+
30
+
31
+
32
+ ## Specifications
33
+
34
+ - `shopify_api` version:
35
+ - `activeresource` version:
36
+ - Shopify API version used (example: `2020-07`):
@@ -0,0 +1,41 @@
1
+ name: CI
2
+
3
+ on:
4
+ - push
5
+
6
+ jobs:
7
+ build:
8
+ name: Ruby ${{ matrix.version }} ${{ matrix.gemfile }}
9
+ runs-on: ubuntu-latest
10
+ env:
11
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
12
+ strategy:
13
+ matrix:
14
+ version:
15
+ - 2.4
16
+ - 2.5
17
+ - 2.6
18
+ - 2.7
19
+ gemfile:
20
+ - Gemfile_ar41
21
+ - Gemfile_ar50
22
+ - Gemfile_ar51
23
+ - Gemfile_ar_master
24
+ exclude:
25
+ - version: 2.7
26
+ gemfile: Gemfile_ar41
27
+ steps:
28
+ - uses: actions/checkout@v2
29
+ - name: Remove Gemfile.lock
30
+ run: |
31
+ rm -f ${GITHUB_WORKSPACE}/Gemfile.lock
32
+ - name: Set up Ruby ${{ matrix.version }}
33
+ uses: ruby/setup-ruby@v1
34
+ with:
35
+ ruby-version: ${{ matrix.version }}
36
+ - name: Run Tests
37
+ run: |
38
+ bundle config set --with docs
39
+ bundle config set ignore_messages true
40
+ bundle
41
+ bundle exec rake test
data/.gitignore CHANGED
@@ -5,9 +5,10 @@ rdoc
5
5
  doc
6
6
  pkg
7
7
  .ruby-version
8
- *.lock
9
8
  *.gem
10
9
  .idea
11
10
  .dev/
12
11
  .bundle/
13
12
  vendor/
13
+ _site/
14
+ docs/.jekyll-cache/
@@ -1,8 +1,28 @@
1
+ inherit_gem:
2
+ rubocop-shopify: rubocop.yml
3
+
1
4
  inherit_from:
2
- - https://shopify.github.io/ruby-style-guide/rubocop.yml
5
+ - .rubocop_todo.yml
3
6
 
4
7
  AllCops:
5
8
  TargetRubyVersion: 2.4
6
9
 
7
- Rails:
8
- Enabled: false
10
+ Lint/SuppressedException:
11
+ Exclude:
12
+ # Warning on test setup, the exception is expected
13
+ - 'test/test_helper.rb'
14
+
15
+ Lint/MissingSuper:
16
+ Exclude:
17
+ # We explicitly do not want to call super here
18
+ - 'lib/shopify_api/graphql/http_client.rb'
19
+
20
+ Lint/UnderscorePrefixedVariableName:
21
+ Exclude:
22
+ # This is an internal attribute and we want to make sure it's called _headers
23
+ - 'lib/shopify_api/resources/base.rb'
24
+
25
+ Naming/AccessorMethodName:
26
+ Exclude:
27
+ # This comes from activesupport, so we can't rename it
28
+ - 'test/detailed_log_subscriber_test.rb'
@@ -0,0 +1,75 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-10-15 20:32:09 UTC using RuboCop version 0.93.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 6
10
+ # Configuration parameters: EnforcedStyle.
11
+ # SupportedStyles: snake_case, camelCase
12
+ Naming/VariableName:
13
+ Exclude:
14
+ - 'lib/shopify_api/resources/fulfillment.rb'
15
+
16
+ # Offense count: 2
17
+ # Cop supports --auto-correct.
18
+ Style/ColonMethodCall:
19
+ Exclude:
20
+ - 'test/base_test.rb'
21
+
22
+ # Offense count: 2
23
+ # Cop supports --auto-correct.
24
+ # Configuration parameters: EnforcedStyle, AllowInnerBackticks.
25
+ # SupportedStyles: backticks, percent_x, mixed
26
+ Style/CommandLiteral:
27
+ Exclude:
28
+ - 'shopify_api.gemspec'
29
+
30
+ # Offense count: 1
31
+ Style/MissingRespondToMissing:
32
+ Exclude:
33
+ - 'lib/shopify_api/resources/asset.rb'
34
+
35
+ # Offense count: 5
36
+ # Cop supports --auto-correct.
37
+ Style/RedundantPercentQ:
38
+ Exclude:
39
+ - 'shopify_api.gemspec'
40
+
41
+ # Offense count: 12
42
+ # Cop supports --auto-correct.
43
+ Style/RedundantSelf:
44
+ Exclude:
45
+ - 'lib/shopify_api/resources/base.rb'
46
+ - 'lib/shopify_api/resources/custom_collection.rb'
47
+ - 'lib/shopify_api/resources/customer.rb'
48
+ - 'lib/shopify_api/resources/customer_saved_search.rb'
49
+ - 'lib/shopify_api/resources/product.rb'
50
+ - 'lib/shopify_api/resources/recurring_application_charge.rb'
51
+
52
+ # Offense count: 1
53
+ # Cop supports --auto-correct.
54
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
55
+ # AllowedMethods: present?, blank?, presence, try, try!
56
+ Style/SafeNavigation:
57
+ Exclude:
58
+ - 'lib/shopify_api/resources/custom_collection.rb'
59
+
60
+ # Offense count: 2
61
+ # Cop supports --auto-correct.
62
+ # Configuration parameters: EnforcedStyle.
63
+ # SupportedStyles: use_perl_names, use_english_names
64
+ Style/SpecialGlobalVars:
65
+ Exclude:
66
+ - 'lib/shopify_api.rb'
67
+ - 'shopify_api.gemspec'
68
+
69
+ # Offense count: 2
70
+ # Cop supports --auto-correct.
71
+ # Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, AllowedMethods.
72
+ # AllowedMethods: to_ary, to_a, to_c, to_enum, to_h, to_hash, to_i, to_int, to_io, to_open, to_path, to_proc, to_r, to_regexp, to_str, to_s, to_sym
73
+ Style/TrivialAccessors:
74
+ Exclude:
75
+ - 'lib/shopify_api/graphql.rb'
@@ -1,3 +1,46 @@
1
+ ## Version 9.3.0
2
+
3
+ * [#797](https://github.com/Shopify/shopify_api/pull/797) Release new Endpoint `fulfillment_order.open` and `fulfillment_order.reschedule`.
4
+
5
+ * [#818](https://github.com/Shopify/shopify_api/pull/818) Avoid depending on ActiveSupport in Sesssion class.
6
+
7
+ * Freeze all string literals. This should have no impact unless your application is modifying ('monkeypatching') the internals of the library in an unusual way.
8
+
9
+ * [#802](https://github.com/Shopify/shopify_api/pull/802) Made `inventory_quantity` a read-only field in Variant
10
+
11
+ * [#821](https://github.com/Shopify/shopify_api/pull/821) Add logging based on environment variable, move log subscriber out of `detailed_log_subscriber`.
12
+ The `ActiveResource::DetailedLogSubscriber` no longer automatically attaches when the class is loaded. If you were previously relying on that behaviour, you'll now need to call `ActiveResource::DetailedLogSubscriber.attach_to(:active_resource_detailed)`. (If using the new `SHOPIFY_LOG_PATH` environment setting then this is handled for you).
13
+
14
+ * Provide `ApiAccess` value object to encapsulate scope operations [#829](https://github.com/Shopify/shopify_api/pull/829)
15
+
16
+ ## Version 9.2.0
17
+
18
+ * Removes the `shopify` binary which will be used by the Shopify CLI
19
+
20
+ ## Version 9.1.1
21
+
22
+ * Make cursor based pagination return relative uri's when fetching next and previous pages. [#726](https://github.com/Shopify/shopify_api/pull/726)
23
+
24
+ ## Version 9.1.0
25
+
26
+ * Implements equality operator on `Session` [#714](https://github.com/Shopify/shopify_api/pull/714)
27
+
28
+ ## Version 9.0.4
29
+
30
+ * Contains [#708](https://github.com/Shopify/shopify_api/pull/708) which is a revert for [#655](https://github.com/shopify/shopify_api/pull/655) due to the deprecated inventory parameters not being removed correctly in some cases
31
+
32
+ ## Version 9.0.3
33
+
34
+ * We now raise a `ShopifyAPI::ValidationException` exception when clients try to use `Product` and `Variant` with deprecated inventory-related fields in API version `2019-10` or later. [#655](https://github.com/shopify/shopify_api/pull/655) Deprecation and migration information can be found in the following documents:
35
+ * [Product Variant REST API Reference](https://shopify.dev/docs/admin-api/rest/reference/products/product-variant)
36
+ * [Migrate your app to support multiple locations](https://shopify.dev/tutorials/migrate-your-app-to-support-multiple-locations)
37
+ * [Manage product inventory with the Admin API](https://shopify.dev/tutorials/manage-product-inventory-with-admin-api)
38
+ * Added support for the Discount Code API batch endpoints [#701](https://github.com/shopify/shopify_api/pull/701)
39
+ * [Create](https://shopify.dev/docs/admin-api/rest/reference/discounts/discountcode#batch_create-2020-01)
40
+ * [Show](https://shopify.dev/docs/admin-api/rest/reference/discounts/discountcode#batch_show-2020-01)
41
+ * [List](https://shopify.dev/docs/admin-api/rest/reference/discounts/discountcode#batch_discount_codes_index-2020-01)
42
+ * Fix issue in the README to explicitly say clients need to require the `shopify_api` gem [#700](https://github.com/Shopify/shopify_api/pull/700)
43
+
1
44
  ## Version 9.0.2
2
45
 
3
46
  * Added optional flag passed to `initialize_clients` to prevent from raising the `InvalidSchema` exception [#693](https://github.com/Shopify/shopify_api/pull/693)
@@ -3,6 +3,6 @@ Submitting Issues
3
3
 
4
4
  Please open an issue here if you encounter a specific bug with this API client library or if something is documented here https://docs.shopify.com/api but is missing from this package.
5
5
 
6
- General questions about the Shopify API and usage of this package (not neccessarily a bug) should be posted on the [Shopify forums](https://ecommerce.shopify.com/c/shopify-apis-and-technology).
6
+ General questions about the Shopify API and usage of this package (not necessarily a bug) should be posted on the [Shopify forums](https://ecommerce.shopify.com/c/shopify-apis-and-technology).
7
7
 
8
8
  When in doubt, post on the forum first. You'll likely have your questions answered more quickly if you post there; more people monitor the forum than Github.
data/Gemfile CHANGED
@@ -1,5 +1,10 @@
1
+ # frozen_string_literal: true
1
2
  source "https://rubygems.org"
2
3
 
3
4
  gemspec
4
5
 
5
6
  gem "activeresource", "~> 5.1"
7
+
8
+ group :docs, optional: true do
9
+ gem "jekyll"
10
+ end
@@ -0,0 +1,151 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ shopify_api (9.3.0)
5
+ activeresource (>= 4.1.0, < 6.0.0)
6
+ graphql-client
7
+ rack
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activemodel (6.0.3.1)
13
+ activesupport (= 6.0.3.1)
14
+ activemodel-serializers-xml (1.0.2)
15
+ activemodel (> 5.x)
16
+ activesupport (> 5.x)
17
+ builder (~> 3.1)
18
+ activeresource (5.1.1)
19
+ activemodel (>= 5.0, < 7)
20
+ activemodel-serializers-xml (~> 1.0)
21
+ activesupport (>= 5.0, < 7)
22
+ activesupport (6.0.3.1)
23
+ concurrent-ruby (~> 1.0, >= 1.0.2)
24
+ i18n (>= 0.7, < 2)
25
+ minitest (~> 5.1)
26
+ tzinfo (~> 1.1)
27
+ zeitwerk (~> 2.2, >= 2.2.2)
28
+ addressable (2.7.0)
29
+ public_suffix (>= 2.0.2, < 5.0)
30
+ ast (2.4.1)
31
+ builder (3.2.4)
32
+ byebug (11.1.3)
33
+ coderay (1.1.2)
34
+ colorator (1.1.0)
35
+ concurrent-ruby (1.1.6)
36
+ crack (0.4.3)
37
+ safe_yaml (~> 1.0.0)
38
+ em-websocket (0.5.1)
39
+ eventmachine (>= 0.12.9)
40
+ http_parser.rb (~> 0.6.0)
41
+ eventmachine (1.2.7)
42
+ ffi (1.12.2)
43
+ forwardable-extended (2.6.0)
44
+ graphql (1.12.3)
45
+ graphql-client (0.16.0)
46
+ activesupport (>= 3.0)
47
+ graphql (~> 1.8)
48
+ hashdiff (1.0.1)
49
+ http_parser.rb (0.6.0)
50
+ i18n (1.8.2)
51
+ concurrent-ruby (~> 1.0)
52
+ jekyll (4.1.0)
53
+ addressable (~> 2.4)
54
+ colorator (~> 1.0)
55
+ em-websocket (~> 0.5)
56
+ i18n (~> 1.0)
57
+ jekyll-sass-converter (~> 2.0)
58
+ jekyll-watch (~> 2.0)
59
+ kramdown (~> 2.1)
60
+ kramdown-parser-gfm (~> 1.0)
61
+ liquid (~> 4.0)
62
+ mercenary (~> 0.4.0)
63
+ pathutil (~> 0.9)
64
+ rouge (~> 3.0)
65
+ safe_yaml (~> 1.0)
66
+ terminal-table (~> 1.8)
67
+ jekyll-sass-converter (2.1.0)
68
+ sassc (> 2.0.1, < 3.0)
69
+ jekyll-watch (2.2.1)
70
+ listen (~> 3.0)
71
+ kramdown (2.3.0)
72
+ rexml
73
+ kramdown-parser-gfm (1.1.0)
74
+ kramdown (~> 2.0)
75
+ liquid (4.0.3)
76
+ listen (3.2.1)
77
+ rb-fsevent (~> 0.10, >= 0.10.3)
78
+ rb-inotify (~> 0.9, >= 0.9.10)
79
+ mercenary (0.4.0)
80
+ method_source (1.0.0)
81
+ minitest (5.14.1)
82
+ mocha (1.11.2)
83
+ parallel (1.19.2)
84
+ parser (2.7.2.0)
85
+ ast (~> 2.4.1)
86
+ pathutil (0.16.2)
87
+ forwardable-extended (~> 2.6)
88
+ pry (0.13.1)
89
+ coderay (~> 1.1)
90
+ method_source (~> 1.0)
91
+ pry-byebug (3.9.0)
92
+ byebug (~> 11.0)
93
+ pry (~> 0.13.0)
94
+ public_suffix (4.0.5)
95
+ rack (2.2.3)
96
+ rainbow (3.0.0)
97
+ rake (13.0.1)
98
+ rb-fsevent (0.10.4)
99
+ rb-inotify (0.10.1)
100
+ ffi (~> 1.0)
101
+ regexp_parser (1.8.2)
102
+ rexml (3.2.4)
103
+ rouge (3.19.0)
104
+ rubocop (0.93.1)
105
+ parallel (~> 1.10)
106
+ parser (>= 2.7.1.5)
107
+ rainbow (>= 2.2.2, < 4.0)
108
+ regexp_parser (>= 1.8)
109
+ rexml
110
+ rubocop-ast (>= 0.6.0)
111
+ ruby-progressbar (~> 1.7)
112
+ unicode-display_width (>= 1.4.0, < 2.0)
113
+ rubocop-ast (0.8.0)
114
+ parser (>= 2.7.1.5)
115
+ rubocop-shopify (1.0.6)
116
+ rubocop (>= 0.92, < 0.94)
117
+ ruby-progressbar (1.10.1)
118
+ safe_yaml (1.0.5)
119
+ sassc (2.3.0)
120
+ ffi (~> 1.9)
121
+ terminal-table (1.8.0)
122
+ unicode-display_width (~> 1.1, >= 1.1.1)
123
+ thread_safe (0.3.6)
124
+ timecop (0.9.1)
125
+ tzinfo (1.2.7)
126
+ thread_safe (~> 0.1)
127
+ unicode-display_width (1.7.0)
128
+ webmock (3.8.3)
129
+ addressable (>= 2.3.6)
130
+ crack (>= 0.3.2)
131
+ hashdiff (>= 0.4.0, < 2.0.0)
132
+ zeitwerk (2.3.0)
133
+
134
+ PLATFORMS
135
+ ruby
136
+
137
+ DEPENDENCIES
138
+ activeresource (~> 5.1)
139
+ jekyll
140
+ minitest (>= 4.0)
141
+ mocha (>= 1.4.0)
142
+ pry
143
+ pry-byebug
144
+ rake
145
+ rubocop-shopify
146
+ shopify_api!
147
+ timecop
148
+ webmock
149
+
150
+ BUNDLED WITH
151
+ 2.1.4
@@ -2,4 +2,4 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "activeresource", "5.1.0"
5
+ gem "activeresource", "~> 5.1"
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  Shopify API
2
2
  ===========
3
- [![Version][gem]][gem_url] [![Build Status](https://travis-ci.org/Shopify/shopify_api.svg?branch=master)](https://travis-ci.org/Shopify/shopify_api)
3
+ [![Version][gem]][gem_url] [![Build Status](https://github.com/Shopify/shopify_api/workflows/CI/badge.svg?branch=master)](https://github.com/Shopify/shopify_api/actions)
4
4
 
5
5
  [gem]: https://img.shields.io/gem/v/shopify_api.svg
6
6
  [gem_url]: https://rubygems.org/gems/shopify_api
@@ -13,34 +13,36 @@ The REST API is implemented as JSON over HTTP using all four verbs (GET/POST/PUT
13
13
 
14
14
  - [Shopify API](#shopify-api)
15
15
  - [Usage](#usage)
16
- * [Requirements](#requirements)
17
- + [Ruby version](#ruby-version)
18
- * [Installation](#installation)
19
- * [Getting Started](#getting-started)
20
- + [1) Create an app](#1-create-an-app)
21
- + [2A) Private Apps](#2a-private-apps)
22
- + [2B) Public and Custom Apps](#2b-public-and-custom-apps)
23
- + [3) Requesting access from a shop](#3-requesting-access-from-a-shop)
24
- + [4) Trading your `code` for an access token.](#4-trading-your--code--for-an-access-token)
25
- + [5) Activating the session](#5-activating-the-session)
26
- + [6A) Making requests to the GraphQL API](#6a-making-requests-to-the-graphql-api)
27
- + [6B) Making requests to the REST API](#6b-making-requests-to-the-rest-api)
28
- * [Console](#console)
29
- * [Thread safety](#thread-safety)
30
- * [Bulk Operations](#bulk-operations)
31
- + [Example](#example)
16
+ - [Requirements](#requirements)
17
+ - [Ruby version](#ruby-version)
18
+ - [Installation](#installation)
19
+ - [Getting Started](#getting-started)
20
+ - [1) Create an app](#1-create-an-app)
21
+ - [2A) Private Apps](#2a-private-apps)
22
+ - [2B) Public and Custom Apps](#2b-public-and-custom-apps)
23
+ - [3) Requesting access from a shop](#3-requesting-access-from-a-shop)
24
+ - [4) Trading your `code` for an access token.](#4-trading-your-code-for-an-access-token)
25
+ - [5) Activating the session](#5-activating-the-session)
26
+ - [6A) Making requests to the GraphQL API](#6a-making-requests-to-the-graphql-api)
27
+ - [Note: the GraphQL client has improved and changed in version 9.0. See the client documentation for full usage details and a [migration guide](docs/graphql.md#migration-guide).](#note-the-graphql-client-has-improved-and-changed-in-version-90-see-the-client-documentation-for-full-usage-details-and-a-migration-guide)
28
+ - [6B) Making requests to the REST API](#6b-making-requests-to-the-rest-api)
29
+ - [Console](#console)
30
+ - [Thread safety](#thread-safety)
31
+ - [Bulk Operations](#bulk-operations)
32
+ - [Example](#example)
32
33
  - [1) Start the bulk operation](#1-start-the-bulk-operation)
33
- - [2) Poll the status of the bulk operation](#2-poll-the-status-of-the-bulk-operation)
34
- - [3) Retrieve your data](#3-retrieve-your-data)
35
- * [Pagination](#pagination)
34
+ - [Step 2) Poll the status of the bulk operation](#step-2-poll-the-status-of-the-bulk-operation)
35
+ - [Step 3) Retrieve your data](#step-3-retrieve-your-data)
36
+ - [Pagination](#pagination)
36
37
  - [Breaking Change Notices](#breaking-change-notices)
37
- * [Breaking change notice for version 8.0.0](#breaking-change-notice-for-version-800)
38
- * [Breaking change notice for version 7.0.0](#breaking-change-notice-for-version-700)
39
- + [Changes to ShopifyAPI::Session](#changes-to-shopifyapi--session)
40
- + [Changes to how to define resources](#changes-to-how-to-define-resources)
41
- + [URL construction](#url-construction)
42
- + [URLs that have not changed](#urls-that-have-not-changed)
38
+ - [Breaking change notice for version 8.0.0](#breaking-change-notice-for-version-800)
39
+ - [Breaking change notice for version 7.0.0](#breaking-change-notice-for-version-700)
40
+ - [Changes to ShopifyAPI::Session](#changes-to-shopifyapisession)
41
+ - [Changes to how to define resources](#changes-to-how-to-define-resources)
42
+ - [URL construction](#url-construction)
43
+ - [URLs that have not changed](#urls-that-have-not-changed)
43
44
  - [Using Development Version](#using-development-version)
45
+ - [Logging](#logging)
44
46
  - [Additional Resources](#additional-resources)
45
47
  - [Copyright](#copyright)
46
48
 
@@ -73,6 +75,12 @@ Or install via [gem](http://rubygems.org/)
73
75
  gem install shopify_api
74
76
  ```
75
77
 
78
+ Once the gem is installed, it must be added to your project by placing the following line in your app :
79
+
80
+ ```ruby
81
+ require 'shopify_api'
82
+ ```
83
+
76
84
  ## Getting Started
77
85
 
78
86
  ShopifyAPI sessions need to be configured with a fully authorized URL of a particular store before they can start making API calls. To obtain that URL, you can follow these steps:
@@ -98,7 +106,7 @@ For a private App you just need to set the base site url as follows:
98
106
  ```ruby
99
107
  shop_url = "https://#{API_KEY}:#{PASSWORD}@#{SHOP_NAME}.myshopify.com"
100
108
  ShopifyAPI::Base.site = shop_url
101
- ShopifyAPI::Base.api_version = '<version_name>' # find the latest stable api_version [here](https://shopify.dev/concepts/about-apis/versioning)
109
+ ShopifyAPI::Base.api_version = '<version_name>' # find the latest stable api_version here: https://shopify.dev/concepts/about-apis/versioning
102
110
  ```
103
111
 
104
112
  That's it; you're done! Next, skip to step 6 and start using the API!
@@ -121,7 +129,7 @@ Public and Custom apps need an access token from each shop to access that shop's
121
129
 
122
130
  ```ruby
123
131
  # We need to instantiate the session object before using it
124
- shopify_session = ShopifyAPI::Session.new(domain: "SHOP_NAME.myshopify.com", api_version: api_version, token: nil)
132
+ shopify_session = ShopifyAPI::Session.new(domain: "#{SHOP_NAME}.myshopify.com", api_version: api_version, token: nil)
125
133
 
126
134
  # Then, create a permission URL with the session
127
135
  permission_url = shopify_session.create_permission_url(scope, "https://my_redirect_uri.com", { state: "My Nonce" })
@@ -196,7 +204,7 @@ Once authorized, the shop redirects the owner to the return URL of your applicat
196
204
  Once you have a token, simply pass in the `token` and `extra` hash (optional) when creating the session object:
197
205
 
198
206
  ```ruby
199
- shopify_session = ShopifyAPI::Session.new(domain: "SHOP_NAME.myshopify.com", token: token, api_version: api_version, extra: extra)
207
+ shopify_session = ShopifyAPI::Session.new(domain: "#{SHOP_NAME}.myshopify.com", token: token, api_version: api_version, extra: extra)
200
208
  ```
201
209
 
202
210
  The session must be activated before use:
@@ -260,7 +268,7 @@ Responses to REST requests are returned as ActiveResource instances:
260
268
  Alternatively, you can use #temp to initialize a Session and execute a command which also handles temporarily setting ActiveResource::Base.site:
261
269
 
262
270
  ```ruby
263
- products = ShopifyAPI::Session.temp(domain: "SHOP_NAME.myshopify.com", token: token, api_version: api_version) do
271
+ products = ShopifyAPI::Session.temp(domain: "#{SHOP_NAME}.myshopify.com", token: token, api_version: api_version) do
264
272
  ShopifyAPI::Product.find(:all)
265
273
  end
266
274
  ```
@@ -268,7 +276,7 @@ Responses to REST requests are returned as ActiveResource instances:
268
276
  If you would like to run a small number of calls against a different API version you can use this block syntax:
269
277
 
270
278
  ```ruby
271
- ShopifyAPI::Session.temp(domain: "SHOP_NAME.myshopify.com", token: token, api_version: '2019-04') do
279
+ ShopifyAPI::Session.temp(domain: "#{SHOP_NAME}.myshopify.com", token: token, api_version: '2019-04') do
272
280
  ShopifyAPI::Product.find(:all) # find call against version `2019-04`
273
281
 
274
282
  ShopifyAPI::Session.with_version(:unstable) do
@@ -620,6 +628,14 @@ or you can even use our automated rake task for docker:
620
628
  bundle exec rake docker
621
629
  ```
622
630
 
631
+ # Logging
632
+
633
+ Enable ActiveResource's logger with
634
+
635
+ `export SHOPIFY_LOG_PATH={your_log_path}`
636
+
637
+ This will log to a file at the given path, relative to the current project directory.
638
+
623
639
  # Additional Resources
624
640
 
625
641
  * [GraphQL API Reference](https://shopify.dev/docs/admin-api/graphql/reference)