shopify_api 12.3.0 → 12.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/BUG_REPORT.md +40 -0
  3. data/.github/ISSUE_TEMPLATE/ENHANCEMENT.md +9 -0
  4. data/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md +9 -0
  5. data/.github/api_update_reminder.md +25 -0
  6. data/.github/api_update_reminder_on_release.md +19 -0
  7. data/.github/workflows/api_update_reminder.yml +16 -0
  8. data/.github/workflows/api_update_reminder_on_release.yml +16 -0
  9. data/.github/workflows/build.yml +0 -3
  10. data/.github/workflows/stale.yml +21 -10
  11. data/CHANGELOG.md +19 -5
  12. data/CONTRIBUTING.md +2 -2
  13. data/Gemfile.lock +13 -13
  14. data/README.md +10 -10
  15. data/docs/getting_started.md +2 -2
  16. data/docs/usage/graphql.md +6 -0
  17. data/docs/usage/graphql_storefront.md +8 -2
  18. data/docs/usage/oauth.md +1 -1
  19. data/docs/usage/rest.md +9 -2
  20. data/docs/usage/webhooks.md +1 -1
  21. data/lib/shopify_api/admin_versions.rb +3 -1
  22. data/lib/shopify_api/clients/graphql/admin.rb +3 -3
  23. data/lib/shopify_api/clients/graphql/client.rb +13 -3
  24. data/lib/shopify_api/clients/graphql/storefront.rb +3 -3
  25. data/lib/shopify_api/clients/http_client.rb +8 -1
  26. data/lib/shopify_api/clients/rest/admin.rb +14 -3
  27. data/lib/shopify_api/rest/base.rb +14 -5
  28. data/lib/shopify_api/rest/resources/2022_07/application_charge.rb +6 -1
  29. data/lib/shopify_api/rest/resources/2022_07/application_credit.rb +6 -1
  30. data/lib/shopify_api/rest/resources/2022_07/assigned_fulfillment_order.rb +7 -0
  31. data/lib/shopify_api/rest/resources/2022_07/customer.rb +9 -1
  32. data/lib/shopify_api/rest/resources/2022_07/fulfillment.rb +5 -1
  33. data/lib/shopify_api/rest/resources/2022_07/fulfillment_order.rb +3 -3
  34. data/lib/shopify_api/rest/resources/2022_07/gift_card.rb +4 -4
  35. data/lib/shopify_api/rest/resources/2022_07/metafield.rb +7 -5
  36. data/lib/shopify_api/rest/resources/2022_07/order.rb +2 -2
  37. data/lib/shopify_api/rest/resources/2022_07/recurring_application_charge.rb +6 -1
  38. data/lib/shopify_api/rest/resources/2022_07/shipping_zone.rb +6 -6
  39. data/lib/shopify_api/rest/resources/2022_07/usage_charge.rb +6 -1
  40. data/lib/shopify_api/rest/resources/2022_10/application_charge.rb +6 -1
  41. data/lib/shopify_api/rest/resources/2022_10/application_credit.rb +6 -1
  42. data/lib/shopify_api/rest/resources/2022_10/assigned_fulfillment_order.rb +7 -0
  43. data/lib/shopify_api/rest/resources/2022_10/customer.rb +9 -1
  44. data/lib/shopify_api/rest/resources/2022_10/fulfillment.rb +5 -1
  45. data/lib/shopify_api/rest/resources/2022_10/fulfillment_order.rb +3 -3
  46. data/lib/shopify_api/rest/resources/2022_10/gift_card.rb +4 -4
  47. data/lib/shopify_api/rest/resources/2022_10/metafield.rb +7 -5
  48. data/lib/shopify_api/rest/resources/2022_10/order.rb +2 -2
  49. data/lib/shopify_api/rest/resources/2022_10/recurring_application_charge.rb +6 -1
  50. data/lib/shopify_api/rest/resources/2022_10/shipping_zone.rb +6 -6
  51. data/lib/shopify_api/rest/resources/2022_10/usage_charge.rb +6 -1
  52. data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/application_charge.rb +6 -1
  53. data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/application_credit.rb +6 -1
  54. data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/assigned_fulfillment_order.rb +7 -0
  55. data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/carrier_service.rb +0 -3
  56. data/lib/shopify_api/rest/resources/{2022_04 → 2023_01}/customer.rb +9 -1
  57. data/lib/shopify_api/rest/resources/2023_01/dispute_evidence.rb +117 -0
  58. data/lib/shopify_api/rest/resources/{2022_04/android_pay_key.rb → 2023_01/dispute_file_upload.rb} +29 -25
  59. data/lib/shopify_api/rest/resources/{2022_04 → 2023_01}/fulfillment.rb +7 -50
  60. data/lib/shopify_api/rest/resources/{2022_04 → 2023_01}/fulfillment_order.rb +36 -4
  61. data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/fulfillment_service.rb +3 -3
  62. data/lib/shopify_api/rest/resources/{2022_04 → 2023_01}/gift_card.rb +4 -4
  63. data/lib/shopify_api/rest/resources/{2022_04 → 2023_01}/metafield.rb +7 -5
  64. data/lib/shopify_api/rest/resources/{2022_04 → 2023_01}/order.rb +8 -2
  65. data/lib/shopify_api/rest/resources/{2022_04 → 2023_01}/recurring_application_charge.rb +6 -1
  66. data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/shipping_zone.rb +6 -6
  67. data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/shop.rb +3 -0
  68. data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/usage_charge.rb +6 -1
  69. data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/application_charge.rb +6 -1
  70. data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/application_credit.rb +6 -1
  71. data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/assigned_fulfillment_order.rb +7 -0
  72. data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/carrier_service.rb +0 -3
  73. data/lib/shopify_api/rest/resources/{2022_01 → 2023_04}/customer.rb +12 -1
  74. data/lib/shopify_api/rest/resources/2023_04/dispute_evidence.rb +117 -0
  75. data/lib/shopify_api/rest/resources/{2022_01/android_pay_key.rb → 2023_04/dispute_file_upload.rb} +29 -25
  76. data/lib/shopify_api/rest/resources/{2022_01 → 2023_04}/fulfillment.rb +7 -50
  77. data/lib/shopify_api/rest/resources/{2022_01 → 2023_04}/fulfillment_order.rb +42 -11
  78. data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/fulfillment_service.rb +3 -3
  79. data/lib/shopify_api/rest/resources/{2022_01 → 2023_04}/gift_card.rb +4 -4
  80. data/lib/shopify_api/rest/resources/{2022_01 → 2023_04}/metafield.rb +8 -13
  81. data/lib/shopify_api/rest/resources/{2022_01 → 2023_04}/order.rb +14 -2
  82. data/lib/shopify_api/rest/resources/{2022_01 → 2023_04}/price_rule.rb +3 -3
  83. data/lib/shopify_api/rest/resources/{2022_01 → 2023_04}/recurring_application_charge.rb +6 -1
  84. data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/shipping_zone.rb +6 -6
  85. data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/shop.rb +3 -0
  86. data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/transaction.rb +3 -0
  87. data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/usage_charge.rb +6 -1
  88. data/lib/shopify_api/version.rb +1 -1
  89. data/shopify_api.gemspec +1 -1
  90. metadata +161 -153
  91. data/.github/ISSUE_TEMPLATE.md +0 -35
  92. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/abandoned_checkout.rb +0 -0
  93. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/access_scope.rb +0 -0
  94. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/apple_pay_certificate.rb +0 -0
  95. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/article.rb +0 -0
  96. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/asset.rb +0 -0
  97. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/balance.rb +0 -0
  98. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/blog.rb +0 -0
  99. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/cancellation_request.rb +0 -0
  100. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/checkout.rb +0 -0
  101. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/collect.rb +0 -0
  102. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/collection.rb +0 -0
  103. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/collection_listing.rb +0 -0
  104. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/comment.rb +0 -0
  105. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/country.rb +0 -0
  106. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/currency.rb +0 -0
  107. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/custom_collection.rb +0 -0
  108. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/customer_address.rb +0 -0
  109. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/customer_saved_search.rb +0 -0
  110. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/deprecated_api_call.rb +0 -0
  111. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/discount_code.rb +0 -0
  112. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/dispute.rb +0 -0
  113. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/draft_order.rb +0 -0
  114. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/event.rb +0 -0
  115. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/fulfillment_event.rb +0 -0
  116. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/fulfillment_request.rb +0 -0
  117. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/gift_card_adjustment.rb +0 -0
  118. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/image.rb +0 -0
  119. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/inventory_item.rb +0 -0
  120. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/inventory_level.rb +0 -0
  121. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/location.rb +0 -0
  122. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/locations_for_move.rb +0 -0
  123. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/marketing_event.rb +0 -0
  124. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/mobile_platform_application.rb +0 -0
  125. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/order_risk.rb +0 -0
  126. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/page.rb +0 -0
  127. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/payment.rb +0 -0
  128. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/payment_gateway.rb +0 -0
  129. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/payment_transaction.rb +0 -0
  130. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/payout.rb +0 -0
  131. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/policy.rb +0 -0
  132. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_01}/price_rule.rb +0 -0
  133. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/product.rb +0 -0
  134. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/product_listing.rb +0 -0
  135. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/product_resource_feedback.rb +0 -0
  136. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/province.rb +0 -0
  137. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/redirect.rb +0 -0
  138. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/refund.rb +0 -0
  139. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/report.rb +0 -0
  140. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/resource_feedback.rb +0 -0
  141. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/script_tag.rb +0 -0
  142. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/smart_collection.rb +0 -0
  143. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/storefront_access_token.rb +0 -0
  144. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/tender_transaction.rb +0 -0
  145. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/theme.rb +0 -0
  146. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/transaction.rb +0 -0
  147. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/user.rb +0 -0
  148. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/variant.rb +0 -0
  149. /data/lib/shopify_api/rest/resources/{2022_01 → 2023_01}/webhook.rb +0 -0
  150. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/abandoned_checkout.rb +0 -0
  151. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/access_scope.rb +0 -0
  152. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/apple_pay_certificate.rb +0 -0
  153. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/article.rb +0 -0
  154. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/asset.rb +0 -0
  155. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/balance.rb +0 -0
  156. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/blog.rb +0 -0
  157. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/cancellation_request.rb +0 -0
  158. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/checkout.rb +0 -0
  159. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/collect.rb +0 -0
  160. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/collection.rb +0 -0
  161. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/collection_listing.rb +0 -0
  162. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/comment.rb +0 -0
  163. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/country.rb +0 -0
  164. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/currency.rb +0 -0
  165. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/custom_collection.rb +0 -0
  166. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/customer_address.rb +0 -0
  167. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/customer_saved_search.rb +0 -0
  168. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/deprecated_api_call.rb +0 -0
  169. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/discount_code.rb +0 -0
  170. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/dispute.rb +0 -0
  171. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/draft_order.rb +0 -0
  172. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/event.rb +0 -0
  173. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/fulfillment_event.rb +0 -0
  174. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/fulfillment_request.rb +0 -0
  175. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/gift_card_adjustment.rb +0 -0
  176. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/image.rb +0 -0
  177. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/inventory_item.rb +0 -0
  178. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/inventory_level.rb +0 -0
  179. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/location.rb +0 -0
  180. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/locations_for_move.rb +0 -0
  181. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/marketing_event.rb +0 -0
  182. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/mobile_platform_application.rb +0 -0
  183. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/order_risk.rb +0 -0
  184. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/page.rb +0 -0
  185. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/payment.rb +0 -0
  186. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/payment_gateway.rb +0 -0
  187. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/payment_transaction.rb +0 -0
  188. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/payout.rb +0 -0
  189. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/policy.rb +0 -0
  190. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/product.rb +0 -0
  191. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/product_listing.rb +0 -0
  192. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/product_resource_feedback.rb +0 -0
  193. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/province.rb +0 -0
  194. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/redirect.rb +0 -0
  195. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/refund.rb +0 -0
  196. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/report.rb +0 -0
  197. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/resource_feedback.rb +0 -0
  198. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/script_tag.rb +0 -0
  199. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/smart_collection.rb +0 -0
  200. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/storefront_access_token.rb +0 -0
  201. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/tender_transaction.rb +0 -0
  202. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/theme.rb +0 -0
  203. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/user.rb +0 -0
  204. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/variant.rb +0 -0
  205. /data/lib/shopify_api/rest/resources/{2022_04 → 2023_04}/webhook.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60567c4e9da3da8eb19c903b704297d4cb194a3f63d0644e3273357554e86321
4
- data.tar.gz: 19ec21a447be21e2f88ca5e4d3bb2978c587857f63976264bcaf998f7dddce47
3
+ metadata.gz: 7fee0ac74bfc70897541951eb87b46e750e0ed650c11b77d3a1c582451c3f4c0
4
+ data.tar.gz: 2e935108619f59022b9101a838582311bb5824a268fe2c1034b629339613dce3
5
5
  SHA512:
6
- metadata.gz: a09451f3182e19d125d662dad337b737377622079e23c03de6949999812bfdbee83fb319bc6ada35d202343a535536b7dc0622fe9d28a66a04465dca0074187a
7
- data.tar.gz: 5c1ad7e58afebc440aa712f881c60823c070603b171d1eb80fcb2b3c703b2f0730c1a942d5e3a237cca1adef1d997d087bad716244baca716fd131e4ce8c935b
6
+ metadata.gz: f5830157e403f197fedd154dbd5b69653026fc8ec9cce3d4427764b8e1e189ff303e1104b82faf124e7093f92979003b33be5061db81d825e2219fd7a70e8bef
7
+ data.tar.gz: e8fac7416a292ade97b591fa86e91034ae04a50e1d0f870b1f5289dcf40df0b1ccada6210b4255aae8c4e1d57e263bd38a8d0b990da0fa3e3383ef83a1333c60
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: "🐛 Bug Report"
3
+ about: Something isn't working
4
+ labels: "Type: Bug 🐛"
5
+ ---
6
+
7
+ # Issue summary
8
+
9
+ <!--
10
+
11
+ Write a short description of the issue here. Please provide any details or logs that
12
+ can help us debug it.
13
+
14
+ Increase the logs as described in the README by setting log_level to :debug, and paste the relevant portion here.
15
+
16
+ Learn more: https://github.com/Shopify/shopify-api-ruby#setup-shopify-context
17
+
18
+ -->
19
+
20
+ - `shopify_api` version:
21
+ - Ruby version:
22
+ - Operating system:
23
+
24
+ ```
25
+ // Paste any relevant logs here
26
+ ```
27
+
28
+ ## Expected behavior
29
+
30
+ <!-- What do you think should happen? -->
31
+
32
+ ## Actual behavior
33
+
34
+ <!-- What actually happens? -->
35
+
36
+ ## Steps to reproduce the problem
37
+
38
+ 1.
39
+ 1.
40
+ 1.
@@ -0,0 +1,9 @@
1
+ ---
2
+ name: '📈 Enhancement'
3
+ about: Enhancement to our codebase that isn't a adding or changing a feature
4
+ labels: 'Type: Enhancement 📈'
5
+ ---
6
+
7
+ ## Overview/summary
8
+
9
+ <!-- Write a short description of the enhancement here ↓ -->
@@ -0,0 +1,9 @@
1
+ ---
2
+ name: "🙌 Feature Request"
3
+ about: Suggest a new feature, or changes to an existing one
4
+ labels: "Type: Feature Request :raised_hands:"
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ <!-- Write a short description of the request here ↓ -->
@@ -0,0 +1,25 @@
1
+ ---
2
+ title: A new release of the Shopify API is due soon
3
+ labels: automated
4
+ ---
5
+
6
+ This is an automated reminder for the maintainers that a new Stable release of the Shopify API is due soon, so the library needs to be updated.
7
+
8
+ A new library release should be prepared to:
9
+ * add the upcoming Stable release
10
+ * remove the oldest Stable release which will no longer be supported.
11
+
12
+ The PR should be created as a **draft** but not yet be merged.
13
+
14
+ The release schedule can be found at https://shopify.dev/concepts/about-apis/versioning
15
+
16
+ Review the changelog and consider if anything in the library needs to change:
17
+
18
+ https://shopify.dev/changelog
19
+
20
+ Test against the upcoming release by using the Release Candidate.
21
+
22
+ Another reminder issue will be created on the date of the next release.
23
+ When that happens, test again using the now Stable API version, and aim to release an update of the library within one week.
24
+
25
+ Thank you!
@@ -0,0 +1,19 @@
1
+ ---
2
+ title: A new release of the Shopify API occurred
3
+ labels: automated
4
+ ---
5
+
6
+ This is an automated reminder for the maintainers that a new Stable release of the Shopify API is scheduled for today
7
+ at 12pm Eastern Time, so a new release of the library is now due.
8
+
9
+ A draft PR should already exist for this.
10
+
11
+ Review the changelog again and consider if anything in the library needs to change:
12
+
13
+ https://shopify.dev/changelog
14
+
15
+ Test against the new release by using the Stable version just released.
16
+
17
+ Aim to release an update of the library within one week.
18
+
19
+ Thank you!
@@ -0,0 +1,16 @@
1
+ on:
2
+ workflow_dispatch: ~
3
+ schedule:
4
+ - cron: "0 0 1 3,6,9,12 *" # At 00:00 on 1st of March, June, September, and December
5
+
6
+ name: API update reminder
7
+ jobs:
8
+ reminder:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - uses: JasonEtco/create-an-issue@v2.4.0
13
+ env:
14
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15
+ with:
16
+ filename: .github/api_update_reminder.md
@@ -0,0 +1,16 @@
1
+ on:
2
+ workflow_dispatch: ~
3
+ schedule:
4
+ - cron: "0 0 1 1,4,7,10 *" # At 00:00 on 1st of January, April, July, and October
5
+
6
+ name: API update reminder on release
7
+ jobs:
8
+ reminder:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - uses: JasonEtco/create-an-issue@v2.4.0
13
+ env:
14
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15
+ with:
16
+ filename: .github/api_update_reminder_on_release.md
@@ -16,9 +16,6 @@ jobs:
16
16
  - 3.1
17
17
  steps:
18
18
  - uses: actions/checkout@v2
19
- - name: Remove Gemfile.lock
20
- run: |
21
- rm -f ${GITHUB_WORKSPACE}/Gemfile.lock
22
19
  - name: Set up Ruby ${{ matrix.version }}
23
20
  uses: ruby/setup-ruby@v1
24
21
  with:
@@ -1,32 +1,43 @@
1
- name: Close inactive issues
1
+ name: Close inactive issues / prs
2
2
  on:
3
3
  schedule:
4
4
  - cron: "30 1 * * *"
5
5
 
6
6
  jobs:
7
- close-issues:
7
+ stale:
8
8
  runs-on: ubuntu-latest
9
9
  permissions:
10
10
  issues: write
11
11
  pull-requests: write
12
12
  steps:
13
- - uses: actions/stale@v5
13
+ - uses: actions/stale@v7
14
14
  with:
15
15
  days-before-issue-stale: 60
16
16
  days-before-issue-close: 14
17
+ days-before-pr-stale: 60
18
+ days-before-pr-close: 14
17
19
  operations-per-run: 1000
18
20
  stale-issue-label: "Stale"
21
+ stale-pr-label: "Stale"
19
22
  stale-issue-message: >
20
- This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days.
23
+ This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days.
21
24
  close-issue-message: |
22
- We are closing this issue because it has been inactive for a few months.
23
- This probably means that it is not reproducible or it has been fixed in a newer version.
25
+ We are closing this issue because it has been inactive for a few months.
26
+ This probably means that it is not reproducible or it has been fixed in a newer version.
24
27
  If it’s an enhancement and hasn’t been taken on since it was submitted, then it seems other issues have taken priority.
25
28
 
26
29
  If you still encounter this issue with the latest stable version, please reopen using the issue template. You can also contribute directly by submitting a pull request– see the [CONTRIBUTING.md](https://github.com/Shopify/shopify-api-ruby/blob/main/CONTRIBUTING.md) file for guidelines
27
30
 
28
31
  Thank you!
29
- days-before-pr-stale: -1
30
- days-before-pr-close: -1
31
- repo-token: ${{ secrets.GITHUB_TOKEN }}
32
- exempt-issue-labels: "feature request"
32
+ stale-pr-message: >
33
+ This pull request is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days.
34
+ close-pr-message: |
35
+ We are closing this pull request because it has been inactive for a few months.
36
+ This probably means that it is not reproducible or it has been fixed in a newer version.
37
+ If it’s an enhancement and hasn’t been taken on since it was submitted, then it seems other issues have taken priority.
38
+
39
+ If you still encounter this pull request with the latest stable version, please reopen using the pull request template. You can also contribute directly by submitting a pull request– see the [CONTRIBUTING.md](https://github.com/Shopify/shopify-api-ruby/blob/main/CONTRIBUTING.md) file for guidelines
40
+
41
+ Thank you!
42
+ repo-token: ${{ github.token }}
43
+ close-issue-reason: "not_planned"
data/CHANGELOG.md CHANGED
@@ -3,14 +3,28 @@
3
3
  Note: For changes to the API, see https://shopify.dev/changelog?filter=api
4
4
 
5
5
  ## Unreleased
6
+
7
+ ## 12.5.0
8
+
9
+ - [#1113](https://github.com/Shopify/shopify-api-ruby/pull/1113) Handle JSON::ParserError when http response is HTML and raise ShopifyAPI::Errors::HttpResponseError
10
+ - [#1098](https://github.com/Shopify/shopify-api-ruby/pull/1098) Gracefully handle HTTP 204 repsonse bodies
11
+ - [#1104](https://github.com/Shopify/shopify-api-ruby/pull/1104) Allow api version overrides.
12
+ - [#1137](https://github.com/Shopify/shopify-api-ruby/pull/1137) Support for 2023_04 API version. Fix reported typing bugs.
13
+
14
+ ## Version 12.4.0
15
+
16
+ - [#1092](https://github.com/Shopify/shopify-api-ruby/pull/1092) Add support for 2023-01 API version.
17
+ - [#1081](https://github.com/Shopify/shopify-api-ruby/pull/1081) Fixed an error when parsing the JSON response body for the AssignedFulfillmentOrder resource.
18
+
6
19
  ## Version 12.3.0
7
20
 
8
21
  - [#1040](https://github.com/Shopify/shopify-api-ruby/pull/1040) `ShopifyAPI::Clients::HttpResponse` as argument for `ShopifyAPI::Errors::HttpResponseError`
9
- - [#1055](https://github.com/Shopify/shopify-api-ruby/pull/1055) Makes session_storage optional. Configuring the API with session_storage is now deprecated. Session persistence is handled by the [shopify_app gem](https://github.com/Shopify/shopify_app) if using Rails.
22
+ - [#1055](https://github.com/Shopify/shopify-api-ruby/pull/1055) Makes session_storage optional. Configuring the API with session_storage is now deprecated. Session persistence is handled by the [shopify_app gem](https://github.com/Shopify/shopify_app) if using Rails.
10
23
  - [#1063](https://github.com/Shopify/shopify-api-ruby/pull/1063) Fix ActiveSupport inflector dependency
11
24
  - [#1069](https://github.com/Shopify/shopify-api-ruby/pull/1069) Adds a custom Logger to help write uniform logs across the api and the [shopify_app gem](https://github.com/Shopify/shopify_app)
12
25
 
13
26
  ## Version 12.2.1
27
+
14
28
  - [#1045](https://github.com/Shopify/shopify-api-ruby/pull/1045) Fixes bug with host/host_name requirement.
15
29
 
16
30
  ## Version 12.2.0
@@ -122,13 +136,13 @@ Note: For changes to the API, see https://shopify.dev/changelog?filter=api
122
136
  ## Version 9.0.3
123
137
 
124
138
  - 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-ruby/pull/655) Deprecation and migration information can be found in the following documents:
125
- - [Product Variant REST API Reference](https://shopify.dev/docs/admin-api/rest/reference/products/product-variant)
139
+ - [Product Variant REST API Reference](https://shopify.dev/docs/api/admin-rest/reference/resources/product-variant)
126
140
  - [Migrate your app to support multiple locations](https://shopify.dev/tutorials/migrate-your-app-to-support-multiple-locations)
127
141
  - [Manage product inventory with the Admin API](https://shopify.dev/tutorials/manage-product-inventory-with-admin-api)
128
142
  - Added support for the Discount Code API batch endpoints [#701](https://github.com/Shopify/shopify-api-ruby/pull/701)
129
- - [Create](https://shopify.dev/docs/admin-api/rest/reference/discounts/discountcode#batch_create-2020-01)
130
- - [Show](https://shopify.dev/docs/admin-api/rest/reference/discounts/discountcode#batch_show-2020-01)
131
- - [List](https://shopify.dev/docs/admin-api/rest/reference/discounts/discountcode#batch_discount_codes_index-2020-01)
143
+ - [Create](https://shopify.dev/docs/api/admin-rest/reference/resources/discountcode#batch_create-2020-01)
144
+ - [Show](https://shopify.dev/docs/api/admin-rest/reference/resources/discountcode#batch_show-2020-01)
145
+ - [List](https://shopify.dev/docs/api/admin-rest/reference/resources/discountcode#batch_discount_codes_index-2020-01)
132
146
  - Fix issue in the README to explicitly say clients need to require the `shopify_api` gem [#700](https://github.com/Shopify/shopify-api-ruby/pull/700)
133
147
 
134
148
  ## Version 9.0.2
data/CONTRIBUTING.md CHANGED
@@ -2,8 +2,8 @@
2
2
  Submitting Issues
3
3
  -----------------
4
4
 
5
- Please open an issue here if you encounter a specific bug with this API client library or if something is documented here https://shopify.dev/apps but is missing from this package.
5
+ Please open an issue here if you encounter a specific bug with this API client library or if something is documented here https://shopify.dev/docs/apps but is missing from this package.
6
6
 
7
7
  General questions about the Shopify API and usage of this package (not necessarily a bug) should be posted on the [Shopify forums](https://community.shopify.com/c/partners-and-developers/ct-p/appdev).
8
8
 
9
- 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.
9
+ 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.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify_api (12.3.0)
4
+ shopify_api (12.5.0)
5
5
  activesupport
6
6
  concurrent-ruby
7
7
  hash_diff
@@ -16,7 +16,7 @@ PATH
16
16
  GEM
17
17
  remote: https://rubygems.org/
18
18
  specs:
19
- activesupport (7.0.4)
19
+ activesupport (7.0.4.3)
20
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
21
  i18n (>= 1.6, < 2)
22
22
  minitest (>= 5.1)
@@ -26,31 +26,29 @@ GEM
26
26
  ast (2.4.2)
27
27
  byebug (11.1.3)
28
28
  coderay (1.1.3)
29
- concurrent-ruby (1.1.10)
29
+ concurrent-ruby (1.2.2)
30
30
  crack (0.4.5)
31
31
  rexml
32
32
  diff-lcs (1.5.0)
33
33
  fakefs (1.4.1)
34
34
  hash_diff (1.1.1)
35
35
  hashdiff (1.0.1)
36
- httparty (0.20.0)
37
- mime-types (~> 3.0)
36
+ httparty (0.21.0)
37
+ mini_mime (>= 1.0.0)
38
38
  multi_xml (>= 0.5.2)
39
39
  i18n (1.12.0)
40
40
  concurrent-ruby (~> 1.0)
41
41
  json (2.6.2)
42
- jwt (2.5.0)
42
+ jwt (2.7.0)
43
43
  language_server-protocol (3.17.0.1)
44
44
  method_source (1.0.0)
45
- mime-types (3.4.1)
46
- mime-types-data (~> 3.2015)
47
- mime-types-data (3.2022.0105)
45
+ mini_mime (1.1.2)
48
46
  minitest (5.15.0)
49
47
  mocha (1.13.0)
50
48
  multi_xml (0.6.0)
51
49
  netrc (0.11.0)
52
- oj (3.13.23)
53
- openssl (3.0.1)
50
+ oj (3.14.3)
51
+ openssl (3.1.0)
54
52
  parallel (1.22.1)
55
53
  parser (3.1.2.1)
56
54
  ast (~> 2.4.1)
@@ -92,11 +90,12 @@ GEM
92
90
  sorbet-runtime
93
91
  syntax_tree (>= 3.4)
94
92
  ruby-progressbar (1.11.0)
95
- securerandom (0.2.1)
93
+ securerandom (0.2.2)
96
94
  sorbet (0.5.10438)
97
95
  sorbet-static (= 0.5.10438)
98
96
  sorbet-runtime (0.5.10438)
99
97
  sorbet-static (0.5.10438-universal-darwin-21)
98
+ sorbet-static (0.5.10438-universal-darwin-22)
100
99
  sorbet-static (0.5.10438-x86_64-linux)
101
100
  sorbet-static-and-runtime (0.5.10438)
102
101
  sorbet (= 0.5.10438)
@@ -118,7 +117,7 @@ GEM
118
117
  thor (>= 1.2.0)
119
118
  yard-sorbet
120
119
  thor (1.2.1)
121
- tzinfo (2.0.5)
120
+ tzinfo (2.0.6)
122
121
  concurrent-ruby (~> 1.0)
123
122
  unicode-display_width (2.3.0)
124
123
  unparser (0.6.5)
@@ -138,6 +137,7 @@ GEM
138
137
 
139
138
  PLATFORMS
140
139
  arm64-darwin-21
140
+ universal-darwin-22
141
141
  x86_64-linux
142
142
 
143
143
  DEPENDENCIES
data/README.md CHANGED
@@ -4,14 +4,14 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
5
5
  ![Build Status](https://github.com/Shopify/shopify-api-ruby/workflows/CI/badge.svg?branch=main)
6
6
 
7
- This library provides support for Ruby [Shopify apps](https://apps.shopify.com/) to access the [Shopify Admin API](https://shopify.dev/api/admin), by making it easier to perform the following actions:
7
+ This library provides support for Ruby [Shopify apps](https://apps.shopify.com/) to access the [Shopify Admin API](https://shopify.dev/docs/api/admin), by making it easier to perform the following actions:
8
8
 
9
- - Creating [online](https://shopify.dev/apps/auth/oauth/access-modes#online-access) or [offline](https://shopify.dev/apps/auth/oauth/access-modes#offline-access) access tokens for the Admin API via OAuth
10
- - Making requests to the [REST API](https://shopify.dev/api/admin-rest)
11
- - Making requests to the [GraphQL API](https://shopify.dev/api/admin-graphql)
9
+ - Creating [online](https://shopify.dev/docs/apps/auth/oauth/access-modes#online-access) or [offline](https://shopify.dev/docs/apps/auth/oauth/access-modes#offline-access) access tokens for the Admin API via OAuth
10
+ - Making requests to the [REST API](https://shopify.dev/docs/api/admin-rest)
11
+ - Making requests to the [GraphQL API](https://shopify.dev/docs/api/admin-graphql)
12
12
  - Registering/processing webhooks
13
13
 
14
- In addition to the Admin API, this library also allows querying the [Storefront API](https://shopify.dev/docs/storefront-api).
14
+ In addition to the Admin API, this library also allows querying the [Storefront API](https://shopify.dev/docs/api/storefront).
15
15
 
16
16
  You can use this library in any application that has a Ruby backend, since it doesn't rely on any specific framework — you can include it alongside your preferred stack and use the features that you need to build your app.
17
17
 
@@ -54,7 +54,7 @@ ShopifyAPI::Context.setup(
54
54
  scope: "read_orders,read_products,etc",
55
55
  session_storage: ShopifyAPI::Auth::FileSessionStorage.new, # See more details below
56
56
  is_embedded: true, # Set to true if you are building an embedded app
57
- api_version: "2022-01" # The version of the API you would like to use
57
+ api_version: "2022-01", # The version of the API you would like to use
58
58
  is_private: false, # Set to true if you have an existing private app
59
59
  )
60
60
  ```
@@ -63,11 +63,11 @@ ShopifyAPI::Context.setup(
63
63
 
64
64
  In order for the Shopify API gem to properly store sessions it needs an implementation of `ShopifyAPI::Auth::SessionStorage`. We provide one implementation in the gem, `ShopifyAPI::Auth::FileSessionStorage`, which is suitable for testing/development, but isn't intended for production apps. See the [Session Storage doc](docs/usage/session_storage.md) for instructions on how to create a custom session store for a production application.
65
65
 
66
- Session information would is typically stored in cookies on the browser. However, due to restrictions with modern browsers we highly discourage using cookies for embedded apps. For this reason, an app needs to define a storage implementation that the library can use to store and retrieve a session given its ID. In a non-embedded app this ID will come from a cookie, whereas in an embedded app this ID will come from [App Bridge](https://shopify.dev/apps/tools/app-bridge).
66
+ Session information would is typically stored in cookies on the browser. However, due to restrictions with modern browsers we highly discourage using cookies for embedded apps. For this reason, an app needs to define a storage implementation that the library can use to store and retrieve a session given its ID. In a non-embedded app this ID will come from a cookie, whereas in an embedded app this ID will come from [App Bridge](https://shopify.dev/docs/apps/tools/app-bridge).
67
67
 
68
68
  ### Performing OAuth
69
69
 
70
- You need to go through OAuth as described [here](https://shopify.dev/apps/auth/oauth) to create sessions for shops using your app.
70
+ You need to go through OAuth as described [here](https://shopify.dev/docs/apps/auth/oauth) to create sessions for shops using your app.
71
71
  The Shopify API gem tries to make this easy by providing functions to begin and complete the OAuth process. See the [Oauth doc](docs/usage/oauth.md) for instructions on how to use these.
72
72
 
73
73
  ### Register Webhooks and a Webhook Handler
@@ -90,7 +90,7 @@ Here are the main features it provides:
90
90
  - Full, transparent support for JWT sessions for embedded apps and cookies for non-embedded ones.
91
91
  - Removal of support for 3rd party cookies which are increasingly more difficult to use with modern browsers.
92
92
  - Admin API support
93
- - Auto-generated, version-specific REST resources which are similar to `ActiveResource` (though not identical), that provide methods for all endpoints defined in our [REST API reference](https://shopify.dev/api/admin-rest), as well as direct definition of known attributes.
93
+ - Auto-generated, version-specific REST resources which are similar to `ActiveResource` (though not identical), that provide methods for all endpoints defined in our [REST API reference](https://shopify.dev/docs/api/admin-rest), as well as direct definition of known attributes.
94
94
  - A GraphQL client that doesn't rely on the ActiveResource implementation for REST.
95
95
  - Webhook management, with features for adding handlers and registering them with Shopify.
96
96
  - Storefront GraphQL API support
@@ -102,7 +102,7 @@ With this, a lot changed in how apps access the library. Here are the updates yo
102
102
  - Call `ShopifyAPI::Context.setup` when setting up your app. This class holds global configurations for your app and defines how the library behaves.
103
103
  - If not using the `shopify_app` gem, your app needs to provide an implementation of `ShopifyAPI::Auth::SessionStorage` for production. Read more about this [in our documentation](docs/usage/session_storage.md).
104
104
  - To change the `User-Agent` header, use `user_agent_prefix` in `ShopifyAPI::Context.setup`.
105
- - Usages of the `ActiveResource` classes for REST API requests need to be refactored into the new format. You can find detailed examples on how each of the endpoints work in our [reference documentation](https://shopify.dev/api/admin-rest).
105
+ - Usages of the `ActiveResource` classes for REST API requests need to be refactored into the new format. You can find detailed examples on how each of the endpoints work in our [reference documentation](https://shopify.dev/docs/api/admin-rest).
106
106
 
107
107
  Please see below a (non-exhaustive) list of common replacements to guide you in your updates, using the `Order` resource as an example.
108
108
 
@@ -37,11 +37,11 @@ ShopifyAPI::Context.setup(
37
37
 
38
38
  In order for the Shopify API gem to properly store sessions it needs an implementation of `ShopifyAPI::Auth::SessionStorage`. There is one provided in the gem, `ShopifyAPI::Auth::FileSessionStorage`, this is suitable for testing, however it is not intended for production apps. See the [Session Storage doc](usage/session_storage.md) for instructions on how to create a custom session store for a production application.
39
39
 
40
- Normally session information would be stored in cookies on the browser. However, due to restrictions with modern browsers we highly discourage using cookies for embedded apps. For this reason, an app needs to define a storage implementation that can be used to store and retrieve a session given an ID. In a non embedded app this ID will come from a cookie however, in an embedded app this ID will come from [App Bridge](https://shopify.dev/apps/tools/app-bridge)
40
+ Normally session information would be stored in cookies on the browser. However, due to restrictions with modern browsers we highly discourage using cookies for embedded apps. For this reason, an app needs to define a storage implementation that can be used to store and retrieve a session given an ID. In a non embedded app this ID will come from a cookie however, in an embedded app this ID will come from [App Bridge](https://shopify.dev/docs/apps/tools/app-bridge)
41
41
 
42
42
  ### Performing OAuth
43
43
 
44
- Next, unless you are making a private app, you need to go through OAuth as described [here](https://shopify.dev/apps/auth/oauth) to create sessions for shops using your app.
44
+ Next, unless you are making a private app, you need to go through OAuth as described [here](https://shopify.dev/docs/apps/auth/oauth) to create sessions for shops using your app.
45
45
  The Shopify API gem tries to make this easy by providing functions to begin and complete the OAuth process. See the [Oauth doc](usage/oauth.md) for instructions on how to use these.
46
46
 
47
47
  ### Register Webhooks and a Webhook Handler
@@ -88,6 +88,12 @@ response = client.query(query: query, variables: variables)
88
88
  # do something with the reponse
89
89
  ```
90
90
 
91
+ By default, the client uses the API version configured in `ShopifyAPI`. To use a different API version, set the optional `api_version` parameter. To experiment with prerelease API features, use `"unstable"` for the API version.
92
+
93
+ ```ruby
94
+ client = ShopifyAPI::Clients::Graphql::Admin.new(session: session, api_version: "unstable")
95
+ ```
96
+
91
97
  Want to make calls to the Storefront API? Click [here](graphql_storefront.md)
92
98
 
93
99
  # Proxy a GraphQL Query
@@ -1,8 +1,8 @@
1
1
  # Make a Storefront API call
2
2
 
3
- The library also allows you to send GraphQL requests to the [Shopify Storefront API](https://shopify.dev/docs/storefront-api). To do that, you can use `ShopifyAPI::Clients::Graphql::Storefront` with the current session and a `storefrontAccessToken`.
3
+ The library also allows you to send GraphQL requests to the [Shopify Storefront API](https://shopify.dev/docs/api/storefront). To do that, you can use `ShopifyAPI::Clients::Graphql::Storefront` with the current session and a `storefrontAccessToken`.
4
4
 
5
- You can obtain Storefront API access tokens for both private apps and sales channels. Please read [our documentation](https://shopify.dev/docs/storefront-api/getting-started) to learn more about Storefront Access Tokens.
5
+ You can obtain Storefront API access tokens for both private apps and sales channels. Please read [our documentation](https://shopify.dev/docs/custom-storefronts/building-with-the-storefront-api/getting-started) to learn more about Storefront Access Tokens.
6
6
 
7
7
  Below is an example of how you may query the Storefront API:
8
8
 
@@ -39,4 +39,10 @@ response = client.query(query: query)
39
39
  # do something with the returned data
40
40
  ```
41
41
 
42
+ By default, the client uses the API version configured in `ShopifyAPI`. To use a different API version, set the optional `api_version` parameter. To experiment with prerelease API features, use `"unstable"` for the API version.
43
+
44
+ ```ruby
45
+ client = ShopifyAPI::Clients::Graphql::Storefront.new(shop_url, storefront_access_token, api_version: "unstable")
46
+ ```
47
+
42
48
  Want to make calls to the Admin API? Click [here](graphql.md)
data/docs/usage/oauth.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Once the library is set up for your project, you'll be able to use it to start adding functionality to your app. The first thing your app will need to do is to obtain an access token to the Admin API by performing the OAuth process.
4
4
 
5
5
  To do this, you can follow the steps below.
6
- For more information on authenticating a Shopify app please see the [Types of Authentication](https://shopify.dev/apps/auth#types-of-authentication) page.
6
+ For more information on authenticating a Shopify app please see the [Types of Authentication](https://shopify.dev/docs/apps/auth#types-of-authentication) page.
7
7
 
8
8
  ## Add a route to start OAuth
9
9
 
data/docs/usage/rest.md CHANGED
@@ -60,11 +60,18 @@ client.post({
60
60
  });
61
61
  ```
62
62
 
63
- _for more information on the `products` endpoint, [check out our API reference guide](https://shopify.dev/api/admin-rest/unstable/resources/product)._
63
+ _for more information on the `products` endpoint, [check out our API reference guide](https://shopify.dev/docs/api/admin-rest/unstable/resources/product)._
64
+
65
+ ### Override the `api_version`:
66
+
67
+ ```ruby
68
+ # To experiment with prerelease features, pass the api_version "unstable".
69
+ client = ShopifyAPI::Clients::Rest::Admin.new(session: session, api_version: "unstable")
70
+ ```
64
71
 
65
72
  ## Pagination
66
73
 
67
- This library also supports cursor-based pagination for REST Admin API requests. [Learn more about REST request pagination](https://shopify.dev/api/usage/pagination-rest).
74
+ This library also supports cursor-based pagination for REST Admin API requests. [Learn more about REST request pagination](https://shopify.dev/docs/api/usage/pagination-rest).
68
75
 
69
76
  After making a request, the `next_page_info` and `prev_page_info` can be found on the response object and passed as the page_info query param in other requests.
70
77
 
@@ -90,7 +90,7 @@ To process an http webhook, you need to listen on the route(s) you provided duri
90
90
  class WebhookController < ApplicationController
91
91
  def webhook
92
92
  ShopifyAPI::Webhooks::Registry.process(
93
- ShopifyAPI::Webhooks::WebhookRequest.new(raw_body: request.raw_post, headers: request.headers.to_h)
93
+ ShopifyAPI::Webhooks::Request.new(raw_body: request.raw_post, headers: request.headers.to_h)
94
94
  )
95
95
  render json: {success: true}.to_json
96
96
  end
@@ -5,13 +5,15 @@ module ShopifyAPI
5
5
  module AdminVersions
6
6
  SUPPORTED_ADMIN_VERSIONS = T.let([
7
7
  "unstable",
8
+ "2023-04",
9
+ "2023-01",
8
10
  "2022-10",
9
11
  "2022-07",
10
12
  "2022-04",
11
13
  "2022-01",
12
14
  ], T::Array[String])
13
15
 
14
- LATEST_SUPPORTED_ADMIN_VERSION = T.let("2022-10", String)
16
+ LATEST_SUPPORTED_ADMIN_VERSION = T.let("2023-04", String)
15
17
  end
16
18
 
17
19
  SUPPORTED_ADMIN_VERSIONS = ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS
@@ -5,9 +5,9 @@ module ShopifyAPI
5
5
  module Clients
6
6
  module Graphql
7
7
  class Admin < Client
8
- sig { params(session: T.nilable(Auth::Session)).void }
9
- def initialize(session:)
10
- super(session: session, base_path: "/admin/api")
8
+ sig { params(session: T.nilable(Auth::Session), api_version: T.nilable(String)).void }
9
+ def initialize(session:, api_version: nil)
10
+ super(session: session, base_path: "/admin/api", api_version: api_version)
11
11
  end
12
12
  end
13
13
  end
@@ -7,9 +7,19 @@ module ShopifyAPI
7
7
  class Client
8
8
  extend T::Sig
9
9
 
10
- sig { params(session: T.nilable(Auth::Session), base_path: String).void }
11
- def initialize(session:, base_path:)
10
+ sig { params(session: T.nilable(Auth::Session), base_path: String, api_version: T.nilable(String)).void }
11
+ def initialize(session:, base_path:, api_version: nil)
12
12
  @http_client = T.let(HttpClient.new(session: session, base_path: base_path), HttpClient)
13
+ @api_version = T.let(api_version || Context.api_version, String)
14
+ if api_version
15
+ if api_version == Context.api_version
16
+ Context.logger.debug("Graphql client has a redundant API version override "\
17
+ "to the default #{Context.api_version}")
18
+ else
19
+ Context.logger.debug("Graphql client overriding default API version "\
20
+ "#{Context.api_version} with #{api_version}")
21
+ end
22
+ end
13
23
  end
14
24
 
15
25
  sig do
@@ -25,7 +35,7 @@ module ShopifyAPI
25
35
  @http_client.request(
26
36
  HttpRequest.new(
27
37
  http_method: :post,
28
- path: "#{Context.api_version}/graphql.json",
38
+ path: "#{@api_version}/graphql.json",
29
39
  body: body,
30
40
  query: nil,
31
41
  extra_headers: headers,
@@ -5,15 +5,15 @@ module ShopifyAPI
5
5
  module Clients
6
6
  module Graphql
7
7
  class Storefront < Client
8
- sig { params(shop: String, storefront_access_token: String).void }
9
- def initialize(shop, storefront_access_token)
8
+ sig { params(shop: String, storefront_access_token: String, api_version: T.nilable(String)).void }
9
+ def initialize(shop, storefront_access_token, api_version: nil)
10
10
  session = Auth::Session.new(
11
11
  id: shop,
12
12
  shop: shop,
13
13
  access_token: "",
14
14
  is_online: false,
15
15
  )
16
- super(session: session, base_path: "/api")
16
+ super(session: session, base_path: "/api", api_version: api_version)
17
17
  @storefront_access_token = storefront_access_token
18
18
  end
19
19
 
@@ -48,7 +48,14 @@ module ShopifyAPI
48
48
  body: request.body.class == Hash ? T.unsafe(request.body).to_json : request.body,
49
49
  ), HTTParty::Response)
50
50
 
51
- body = res.body.empty? ? {} : JSON.parse(res.body)
51
+ begin
52
+ body = res.body.nil? || res.body.empty? ? {} : JSON.parse(res.body)
53
+ rescue JSON::ParserError
54
+ raise if res.code.to_i < 500
55
+
56
+ body = res.body
57
+ end
58
+
52
59
  response = HttpResponse.new(code: res.code.to_i, headers: res.headers.to_h, body: body)
53
60
 
54
61
  if response.headers["x-shopify-api-deprecated-reason"]