shopify_api 10.0.3 → 11.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (317) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +0 -1
  3. data/.rubocop.yml +1 -1
  4. data/BREAKING_CHANGES_FOR_OLDER_VERSIONS.md +110 -0
  5. data/CHANGELOG.md +20 -0
  6. data/Gemfile.lock +23 -20
  7. data/README.md +3 -106
  8. data/RELEASING.md +2 -1
  9. data/docs/usage/graphql.md +1 -1
  10. data/lib/shopify_api/admin_versions.rb +2 -3
  11. data/lib/shopify_api/auth/jwt_payload.rb +16 -5
  12. data/lib/shopify_api/context.rb +6 -2
  13. data/lib/shopify_api/rest/base.rb +33 -6
  14. data/lib/shopify_api/rest/resources/2021_10/abandoned_checkout.rb +4 -0
  15. data/lib/shopify_api/rest/resources/2021_10/access_scope.rb +4 -0
  16. data/lib/shopify_api/rest/resources/2021_10/android_pay_key.rb +4 -0
  17. data/lib/shopify_api/rest/resources/2021_10/apple_pay_certificate.rb +4 -0
  18. data/lib/shopify_api/rest/resources/2021_10/application_charge.rb +4 -0
  19. data/lib/shopify_api/rest/resources/2021_10/application_credit.rb +4 -0
  20. data/lib/shopify_api/rest/resources/2021_10/article.rb +4 -0
  21. data/lib/shopify_api/rest/resources/2021_10/asset.rb +4 -0
  22. data/lib/shopify_api/rest/resources/2021_10/assigned_fulfillment_order.rb +4 -0
  23. data/lib/shopify_api/rest/resources/2021_10/balance.rb +4 -0
  24. data/lib/shopify_api/rest/resources/2021_10/blog.rb +4 -0
  25. data/lib/shopify_api/rest/resources/2021_10/cancellation_request.rb +4 -0
  26. data/lib/shopify_api/rest/resources/2021_10/carrier_service.rb +4 -0
  27. data/lib/shopify_api/rest/resources/2021_10/checkout.rb +4 -0
  28. data/lib/shopify_api/rest/resources/2021_10/collect.rb +4 -0
  29. data/lib/shopify_api/rest/resources/2021_10/collection.rb +4 -0
  30. data/lib/shopify_api/rest/resources/2021_10/collection_listing.rb +4 -0
  31. data/lib/shopify_api/rest/resources/2021_10/comment.rb +4 -0
  32. data/lib/shopify_api/rest/resources/2021_10/country.rb +4 -0
  33. data/lib/shopify_api/rest/resources/2021_10/currency.rb +4 -0
  34. data/lib/shopify_api/rest/resources/2021_10/custom_collection.rb +4 -0
  35. data/lib/shopify_api/rest/resources/2021_10/customer.rb +4 -0
  36. data/lib/shopify_api/rest/resources/2021_10/customer_address.rb +4 -0
  37. data/lib/shopify_api/rest/resources/2021_10/customer_saved_search.rb +4 -0
  38. data/lib/shopify_api/rest/resources/2021_10/deprecated_api_call.rb +4 -0
  39. data/lib/shopify_api/rest/resources/2021_10/discount_code.rb +4 -0
  40. data/lib/shopify_api/rest/resources/2021_10/dispute.rb +4 -0
  41. data/lib/shopify_api/rest/resources/2021_10/draft_order.rb +4 -0
  42. data/lib/shopify_api/rest/resources/2021_10/event.rb +4 -0
  43. data/lib/shopify_api/rest/resources/2021_10/fulfillment.rb +75 -1
  44. data/lib/shopify_api/rest/resources/2021_10/fulfillment_event.rb +4 -0
  45. data/lib/shopify_api/rest/resources/2021_10/fulfillment_order.rb +4 -0
  46. data/lib/shopify_api/rest/resources/2021_10/fulfillment_request.rb +4 -0
  47. data/lib/shopify_api/rest/resources/2021_10/fulfillment_service.rb +4 -0
  48. data/lib/shopify_api/rest/resources/2021_10/gift_card.rb +4 -0
  49. data/lib/shopify_api/rest/resources/2021_10/gift_card_adjustment.rb +4 -0
  50. data/lib/shopify_api/rest/resources/2021_10/image.rb +4 -0
  51. data/lib/shopify_api/rest/resources/2021_10/inventory_item.rb +4 -0
  52. data/lib/shopify_api/rest/resources/2021_10/inventory_level.rb +4 -0
  53. data/lib/shopify_api/rest/resources/2021_10/location.rb +4 -0
  54. data/lib/shopify_api/rest/resources/2021_10/locations_for_move.rb +4 -0
  55. data/lib/shopify_api/rest/resources/2021_10/marketing_event.rb +4 -0
  56. data/lib/shopify_api/rest/resources/2021_10/metafield.rb +4 -0
  57. data/lib/shopify_api/rest/resources/2021_10/mobile_platform_application.rb +4 -0
  58. data/lib/shopify_api/rest/resources/2021_10/order.rb +4 -0
  59. data/lib/shopify_api/rest/resources/2021_10/order_risk.rb +4 -0
  60. data/lib/shopify_api/rest/resources/2021_10/page.rb +4 -0
  61. data/lib/shopify_api/rest/resources/2021_10/payment.rb +4 -0
  62. data/lib/shopify_api/rest/resources/2021_10/payment_gateway.rb +4 -0
  63. data/lib/shopify_api/rest/resources/2021_10/payment_transaction.rb +4 -0
  64. data/lib/shopify_api/rest/resources/2021_10/payout.rb +4 -0
  65. data/lib/shopify_api/rest/resources/2021_10/policy.rb +4 -0
  66. data/lib/shopify_api/rest/resources/2021_10/price_rule.rb +4 -0
  67. data/lib/shopify_api/rest/resources/2021_10/product.rb +4 -0
  68. data/lib/shopify_api/rest/resources/2021_10/product_listing.rb +4 -0
  69. data/lib/shopify_api/rest/resources/2021_10/product_resource_feedback.rb +4 -0
  70. data/lib/shopify_api/rest/resources/2021_10/province.rb +4 -0
  71. data/lib/shopify_api/rest/resources/2021_10/recurring_application_charge.rb +4 -0
  72. data/lib/shopify_api/rest/resources/2021_10/redirect.rb +4 -0
  73. data/lib/shopify_api/rest/resources/2021_10/refund.rb +4 -0
  74. data/lib/shopify_api/rest/resources/2021_10/report.rb +4 -0
  75. data/lib/shopify_api/rest/resources/2021_10/resource_feedback.rb +4 -0
  76. data/lib/shopify_api/rest/resources/2021_10/script_tag.rb +4 -0
  77. data/lib/shopify_api/rest/resources/2021_10/shipping_zone.rb +4 -0
  78. data/lib/shopify_api/rest/resources/2021_10/shop.rb +4 -0
  79. data/lib/shopify_api/rest/resources/2021_10/smart_collection.rb +4 -0
  80. data/lib/shopify_api/rest/resources/2021_10/storefront_access_token.rb +4 -0
  81. data/lib/shopify_api/rest/resources/2021_10/tender_transaction.rb +4 -0
  82. data/lib/shopify_api/rest/resources/2021_10/theme.rb +4 -0
  83. data/lib/shopify_api/rest/resources/2021_10/transaction.rb +4 -0
  84. data/lib/shopify_api/rest/resources/2021_10/usage_charge.rb +4 -0
  85. data/lib/shopify_api/rest/resources/2021_10/user.rb +4 -0
  86. data/lib/shopify_api/rest/resources/2021_10/variant.rb +4 -0
  87. data/lib/shopify_api/rest/resources/2021_10/webhook.rb +4 -0
  88. data/lib/shopify_api/rest/resources/2022_01/abandoned_checkout.rb +4 -0
  89. data/lib/shopify_api/rest/resources/2022_01/access_scope.rb +4 -0
  90. data/lib/shopify_api/rest/resources/2022_01/android_pay_key.rb +4 -0
  91. data/lib/shopify_api/rest/resources/2022_01/apple_pay_certificate.rb +4 -0
  92. data/lib/shopify_api/rest/resources/2022_01/application_charge.rb +4 -0
  93. data/lib/shopify_api/rest/resources/2022_01/application_credit.rb +4 -0
  94. data/lib/shopify_api/rest/resources/2022_01/article.rb +4 -0
  95. data/lib/shopify_api/rest/resources/2022_01/asset.rb +4 -0
  96. data/lib/shopify_api/rest/resources/2022_01/assigned_fulfillment_order.rb +4 -0
  97. data/lib/shopify_api/rest/resources/2022_01/balance.rb +4 -0
  98. data/lib/shopify_api/rest/resources/2022_01/blog.rb +4 -0
  99. data/lib/shopify_api/rest/resources/2022_01/cancellation_request.rb +4 -0
  100. data/lib/shopify_api/rest/resources/2022_01/carrier_service.rb +4 -0
  101. data/lib/shopify_api/rest/resources/2022_01/checkout.rb +4 -0
  102. data/lib/shopify_api/rest/resources/2022_01/collect.rb +4 -0
  103. data/lib/shopify_api/rest/resources/2022_01/collection.rb +4 -0
  104. data/lib/shopify_api/rest/resources/2022_01/collection_listing.rb +4 -0
  105. data/lib/shopify_api/rest/resources/2022_01/comment.rb +4 -0
  106. data/lib/shopify_api/rest/resources/2022_01/country.rb +4 -0
  107. data/lib/shopify_api/rest/resources/2022_01/currency.rb +4 -0
  108. data/lib/shopify_api/rest/resources/2022_01/custom_collection.rb +4 -0
  109. data/lib/shopify_api/rest/resources/2022_01/customer.rb +4 -0
  110. data/lib/shopify_api/rest/resources/2022_01/customer_address.rb +4 -0
  111. data/lib/shopify_api/rest/resources/2022_01/customer_saved_search.rb +4 -0
  112. data/lib/shopify_api/rest/resources/2022_01/deprecated_api_call.rb +4 -0
  113. data/lib/shopify_api/rest/resources/2022_01/discount_code.rb +4 -0
  114. data/lib/shopify_api/rest/resources/2022_01/dispute.rb +4 -0
  115. data/lib/shopify_api/rest/resources/2022_01/draft_order.rb +4 -0
  116. data/lib/shopify_api/rest/resources/2022_01/event.rb +4 -0
  117. data/lib/shopify_api/rest/resources/2022_01/fulfillment.rb +75 -1
  118. data/lib/shopify_api/rest/resources/2022_01/fulfillment_event.rb +4 -0
  119. data/lib/shopify_api/rest/resources/2022_01/fulfillment_order.rb +4 -0
  120. data/lib/shopify_api/rest/resources/2022_01/fulfillment_request.rb +4 -0
  121. data/lib/shopify_api/rest/resources/2022_01/fulfillment_service.rb +4 -0
  122. data/lib/shopify_api/rest/resources/2022_01/gift_card.rb +4 -0
  123. data/lib/shopify_api/rest/resources/2022_01/gift_card_adjustment.rb +4 -0
  124. data/lib/shopify_api/rest/resources/2022_01/image.rb +4 -0
  125. data/lib/shopify_api/rest/resources/2022_01/inventory_item.rb +4 -0
  126. data/lib/shopify_api/rest/resources/2022_01/inventory_level.rb +4 -0
  127. data/lib/shopify_api/rest/resources/2022_01/location.rb +4 -0
  128. data/lib/shopify_api/rest/resources/2022_01/locations_for_move.rb +4 -0
  129. data/lib/shopify_api/rest/resources/2022_01/marketing_event.rb +4 -0
  130. data/lib/shopify_api/rest/resources/2022_01/metafield.rb +4 -0
  131. data/lib/shopify_api/rest/resources/2022_01/mobile_platform_application.rb +4 -0
  132. data/lib/shopify_api/rest/resources/2022_01/order.rb +4 -0
  133. data/lib/shopify_api/rest/resources/2022_01/order_risk.rb +4 -0
  134. data/lib/shopify_api/rest/resources/2022_01/page.rb +4 -0
  135. data/lib/shopify_api/rest/resources/2022_01/payment.rb +4 -0
  136. data/lib/shopify_api/rest/resources/2022_01/payment_gateway.rb +4 -0
  137. data/lib/shopify_api/rest/resources/2022_01/payment_transaction.rb +4 -0
  138. data/lib/shopify_api/rest/resources/2022_01/payout.rb +4 -0
  139. data/lib/shopify_api/rest/resources/2022_01/policy.rb +4 -0
  140. data/lib/shopify_api/rest/resources/2022_01/price_rule.rb +4 -0
  141. data/lib/shopify_api/rest/resources/2022_01/product.rb +4 -0
  142. data/lib/shopify_api/rest/resources/2022_01/product_listing.rb +4 -0
  143. data/lib/shopify_api/rest/resources/2022_01/product_resource_feedback.rb +4 -0
  144. data/lib/shopify_api/rest/resources/2022_01/province.rb +4 -0
  145. data/lib/shopify_api/rest/resources/2022_01/recurring_application_charge.rb +4 -0
  146. data/lib/shopify_api/rest/resources/2022_01/redirect.rb +4 -0
  147. data/lib/shopify_api/rest/resources/2022_01/refund.rb +4 -0
  148. data/lib/shopify_api/rest/resources/2022_01/report.rb +4 -0
  149. data/lib/shopify_api/rest/resources/2022_01/resource_feedback.rb +4 -0
  150. data/lib/shopify_api/rest/resources/2022_01/script_tag.rb +4 -0
  151. data/lib/shopify_api/rest/resources/2022_01/shipping_zone.rb +4 -0
  152. data/lib/shopify_api/rest/resources/2022_01/shop.rb +4 -0
  153. data/lib/shopify_api/rest/resources/2022_01/smart_collection.rb +4 -0
  154. data/lib/shopify_api/rest/resources/2022_01/storefront_access_token.rb +4 -0
  155. data/lib/shopify_api/rest/resources/2022_01/tender_transaction.rb +4 -0
  156. data/lib/shopify_api/rest/resources/2022_01/theme.rb +4 -0
  157. data/lib/shopify_api/rest/resources/2022_01/transaction.rb +4 -0
  158. data/lib/shopify_api/rest/resources/2022_01/usage_charge.rb +4 -0
  159. data/lib/shopify_api/rest/resources/2022_01/user.rb +4 -0
  160. data/lib/shopify_api/rest/resources/2022_01/variant.rb +4 -0
  161. data/lib/shopify_api/rest/resources/2022_01/webhook.rb +4 -0
  162. data/lib/shopify_api/rest/resources/2022_04/abandoned_checkout.rb +4 -0
  163. data/lib/shopify_api/rest/resources/2022_04/access_scope.rb +4 -0
  164. data/lib/shopify_api/rest/resources/2022_04/android_pay_key.rb +4 -0
  165. data/lib/shopify_api/rest/resources/2022_04/apple_pay_certificate.rb +4 -0
  166. data/lib/shopify_api/rest/resources/2022_04/application_charge.rb +4 -0
  167. data/lib/shopify_api/rest/resources/2022_04/application_credit.rb +4 -0
  168. data/lib/shopify_api/rest/resources/2022_04/article.rb +4 -0
  169. data/lib/shopify_api/rest/resources/2022_04/asset.rb +4 -0
  170. data/lib/shopify_api/rest/resources/2022_04/assigned_fulfillment_order.rb +4 -0
  171. data/lib/shopify_api/rest/resources/2022_04/balance.rb +4 -0
  172. data/lib/shopify_api/rest/resources/2022_04/blog.rb +4 -0
  173. data/lib/shopify_api/rest/resources/2022_04/cancellation_request.rb +4 -0
  174. data/lib/shopify_api/rest/resources/2022_04/carrier_service.rb +4 -0
  175. data/lib/shopify_api/rest/resources/2022_04/checkout.rb +4 -0
  176. data/lib/shopify_api/rest/resources/2022_04/collect.rb +4 -0
  177. data/lib/shopify_api/rest/resources/2022_04/collection.rb +4 -0
  178. data/lib/shopify_api/rest/resources/2022_04/collection_listing.rb +4 -0
  179. data/lib/shopify_api/rest/resources/2022_04/comment.rb +4 -0
  180. data/lib/shopify_api/rest/resources/2022_04/country.rb +4 -0
  181. data/lib/shopify_api/rest/resources/2022_04/currency.rb +4 -0
  182. data/lib/shopify_api/rest/resources/2022_04/custom_collection.rb +4 -0
  183. data/lib/shopify_api/rest/resources/2022_04/customer.rb +4 -0
  184. data/lib/shopify_api/rest/resources/2022_04/customer_address.rb +4 -0
  185. data/lib/shopify_api/rest/resources/2022_04/customer_saved_search.rb +4 -0
  186. data/lib/shopify_api/rest/resources/2022_04/deprecated_api_call.rb +4 -0
  187. data/lib/shopify_api/rest/resources/2022_04/discount_code.rb +4 -0
  188. data/lib/shopify_api/rest/resources/2022_04/dispute.rb +4 -0
  189. data/lib/shopify_api/rest/resources/2022_04/draft_order.rb +4 -0
  190. data/lib/shopify_api/rest/resources/2022_04/event.rb +4 -0
  191. data/lib/shopify_api/rest/resources/2022_04/fulfillment.rb +75 -1
  192. data/lib/shopify_api/rest/resources/2022_04/fulfillment_event.rb +4 -0
  193. data/lib/shopify_api/rest/resources/2022_04/fulfillment_order.rb +7 -0
  194. data/lib/shopify_api/rest/resources/2022_04/fulfillment_request.rb +4 -0
  195. data/lib/shopify_api/rest/resources/2022_04/fulfillment_service.rb +4 -0
  196. data/lib/shopify_api/rest/resources/2022_04/gift_card.rb +4 -0
  197. data/lib/shopify_api/rest/resources/2022_04/gift_card_adjustment.rb +4 -0
  198. data/lib/shopify_api/rest/resources/2022_04/image.rb +4 -0
  199. data/lib/shopify_api/rest/resources/2022_04/inventory_item.rb +4 -0
  200. data/lib/shopify_api/rest/resources/2022_04/inventory_level.rb +4 -0
  201. data/lib/shopify_api/rest/resources/2022_04/location.rb +4 -0
  202. data/lib/shopify_api/rest/resources/2022_04/locations_for_move.rb +4 -0
  203. data/lib/shopify_api/rest/resources/2022_04/marketing_event.rb +4 -0
  204. data/lib/shopify_api/rest/resources/2022_04/metafield.rb +4 -0
  205. data/lib/shopify_api/rest/resources/2022_04/mobile_platform_application.rb +4 -0
  206. data/lib/shopify_api/rest/resources/2022_04/order.rb +4 -0
  207. data/lib/shopify_api/rest/resources/2022_04/order_risk.rb +4 -0
  208. data/lib/shopify_api/rest/resources/2022_04/page.rb +4 -0
  209. data/lib/shopify_api/rest/resources/2022_04/payment.rb +4 -0
  210. data/lib/shopify_api/rest/resources/2022_04/payment_gateway.rb +4 -0
  211. data/lib/shopify_api/rest/resources/2022_04/payment_transaction.rb +4 -0
  212. data/lib/shopify_api/rest/resources/2022_04/payout.rb +4 -0
  213. data/lib/shopify_api/rest/resources/2022_04/policy.rb +4 -0
  214. data/lib/shopify_api/rest/resources/2022_04/price_rule.rb +4 -0
  215. data/lib/shopify_api/rest/resources/2022_04/product.rb +4 -0
  216. data/lib/shopify_api/rest/resources/2022_04/product_listing.rb +4 -0
  217. data/lib/shopify_api/rest/resources/2022_04/product_resource_feedback.rb +4 -0
  218. data/lib/shopify_api/rest/resources/2022_04/province.rb +4 -0
  219. data/lib/shopify_api/rest/resources/2022_04/recurring_application_charge.rb +4 -0
  220. data/lib/shopify_api/rest/resources/2022_04/redirect.rb +4 -0
  221. data/lib/shopify_api/rest/resources/2022_04/refund.rb +4 -0
  222. data/lib/shopify_api/rest/resources/2022_04/report.rb +4 -0
  223. data/lib/shopify_api/rest/resources/2022_04/resource_feedback.rb +4 -0
  224. data/lib/shopify_api/rest/resources/2022_04/script_tag.rb +4 -0
  225. data/lib/shopify_api/rest/resources/2022_04/shipping_zone.rb +4 -0
  226. data/lib/shopify_api/rest/resources/2022_04/shop.rb +4 -0
  227. data/lib/shopify_api/rest/resources/2022_04/smart_collection.rb +4 -0
  228. data/lib/shopify_api/rest/resources/2022_04/storefront_access_token.rb +4 -0
  229. data/lib/shopify_api/rest/resources/2022_04/tender_transaction.rb +4 -0
  230. data/lib/shopify_api/rest/resources/2022_04/theme.rb +4 -0
  231. data/lib/shopify_api/rest/resources/2022_04/transaction.rb +4 -0
  232. data/lib/shopify_api/rest/resources/2022_04/usage_charge.rb +4 -0
  233. data/lib/shopify_api/rest/resources/2022_04/user.rb +4 -0
  234. data/lib/shopify_api/rest/resources/2022_04/variant.rb +4 -0
  235. data/lib/shopify_api/rest/resources/2022_04/webhook.rb +4 -0
  236. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/abandoned_checkout.rb +4 -0
  237. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/access_scope.rb +4 -0
  238. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/android_pay_key.rb +4 -0
  239. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/apple_pay_certificate.rb +4 -0
  240. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/application_charge.rb +4 -0
  241. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/application_credit.rb +4 -0
  242. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/article.rb +4 -0
  243. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/asset.rb +4 -0
  244. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/assigned_fulfillment_order.rb +4 -0
  245. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/balance.rb +4 -0
  246. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/blog.rb +4 -0
  247. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/cancellation_request.rb +4 -0
  248. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/carrier_service.rb +4 -3
  249. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/checkout.rb +4 -0
  250. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/collect.rb +4 -0
  251. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/collection.rb +4 -0
  252. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/collection_listing.rb +4 -0
  253. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/comment.rb +4 -0
  254. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/country.rb +4 -0
  255. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/currency.rb +4 -0
  256. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/custom_collection.rb +4 -0
  257. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/customer.rb +16 -0
  258. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/customer_address.rb +4 -0
  259. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/customer_saved_search.rb +4 -0
  260. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/deprecated_api_call.rb +4 -0
  261. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/discount_code.rb +4 -0
  262. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/dispute.rb +4 -0
  263. data/lib/shopify_api/rest/resources/2022_07/dispute_evidence.rb +117 -0
  264. data/lib/shopify_api/rest/resources/2022_07/dispute_file_upload.rb +81 -0
  265. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/draft_order.rb +10 -1
  266. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/event.rb +4 -0
  267. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/fulfillment.rb +30 -0
  268. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/fulfillment_event.rb +4 -0
  269. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/fulfillment_order.rb +87 -1
  270. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/fulfillment_request.rb +9 -1
  271. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/fulfillment_service.rb +7 -3
  272. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/gift_card.rb +4 -0
  273. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/gift_card_adjustment.rb +4 -0
  274. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/image.rb +4 -0
  275. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/inventory_item.rb +4 -0
  276. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/inventory_level.rb +4 -0
  277. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/location.rb +4 -0
  278. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/locations_for_move.rb +4 -0
  279. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/marketing_event.rb +4 -0
  280. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/metafield.rb +4 -0
  281. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/mobile_platform_application.rb +4 -0
  282. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/order.rb +7 -0
  283. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/order_risk.rb +4 -0
  284. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/page.rb +4 -0
  285. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/payment.rb +4 -0
  286. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/payment_gateway.rb +4 -0
  287. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/payment_transaction.rb +4 -0
  288. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/payout.rb +4 -0
  289. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/policy.rb +4 -0
  290. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/price_rule.rb +7 -3
  291. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/product.rb +4 -0
  292. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/product_listing.rb +4 -0
  293. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/product_resource_feedback.rb +4 -0
  294. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/province.rb +4 -0
  295. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/recurring_application_charge.rb +4 -0
  296. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/redirect.rb +4 -0
  297. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/refund.rb +4 -0
  298. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/report.rb +4 -0
  299. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/resource_feedback.rb +4 -0
  300. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/script_tag.rb +4 -0
  301. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/shipping_zone.rb +4 -0
  302. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/shop.rb +4 -0
  303. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/smart_collection.rb +4 -0
  304. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/storefront_access_token.rb +4 -0
  305. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/tender_transaction.rb +4 -0
  306. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/theme.rb +4 -0
  307. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/transaction.rb +7 -0
  308. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/usage_charge.rb +4 -0
  309. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/user.rb +4 -0
  310. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/variant.rb +4 -0
  311. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/webhook.rb +4 -0
  312. data/lib/shopify_api/utils/hmac_validator.rb +16 -6
  313. data/lib/shopify_api/version.rb +1 -1
  314. data/lib/shopify_api/webhooks/registry.rb +0 -1
  315. data/lib/shopify_api/webhooks/request.rb +1 -1
  316. data/sorbet/rbi/todo.rbi +0 -1
  317. metadata +80 -77
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81babe6da64bc6c8b0e413213fff00c818778c5bc5cf9bd79b1acb25fd3ea3d1
4
- data.tar.gz: b9dda7bb0992365df524d1e22d70ee34fee776a68c5dc9e958b826d49c6c0541
3
+ metadata.gz: 480de35765a695c4111ca43f241270a12a7eb4a22c83844fa5820a27ac829125
4
+ data.tar.gz: 5d20da61c0cad987a0b6048cf6a10460af29e80df2d7c89617e24e12fc5f1049
5
5
  SHA512:
6
- metadata.gz: cb1eeacedfe1a0fdd8f0262e0bb63ea52996aa6a98f1ffee803481a2ce38424f31d8aa0658108f53a376fef29d5a65acf7bb1384d6d87ce21e52eabdc4926da8
7
- data.tar.gz: 03c666d05fc413b5da1951a0693818ca97c48064bb2735facb019a4e04a55581525ee061e19dc1c1406e4c67a0949ded89ffec69ef5cab1f1d8866f8d514277f
6
+ metadata.gz: 68662d27963ec681ca2b1604e11991f33ae19b3833711828743ac17905c5ed62ed37d2ca425b2042ea2093608ece1cc14d2bc2052f0f6b71c42d21b667e7ef71
7
+ data.tar.gz: febcfc8ca74c8bf13529d71d91ef6083075c011edb4aeda539b3e5a7d003471a2536a94180ba182b8bbf335ac7f7d9f4752e49ddfac08d1897e02880b24bbff8
@@ -11,7 +11,6 @@ jobs:
11
11
  strategy:
12
12
  matrix:
13
13
  version:
14
- - 2.6
15
14
  - 2.7
16
15
  - 3.0
17
16
  - 3.1
data/.rubocop.yml CHANGED
@@ -5,7 +5,7 @@ require:
5
5
  - rubocop-sorbet
6
6
 
7
7
  AllCops:
8
- TargetRubyVersion: 2.6
8
+ TargetRubyVersion: 2.7
9
9
  NewCops: enable
10
10
  Exclude:
11
11
  - "sorbet/**/*"
@@ -0,0 +1,110 @@
1
+ # Breaking changes for older versions
2
+
3
+ The breaking changes for the previous major release are listed in the main [README](README.md).
4
+ The breaking changes for older major releases are listed below.
5
+
6
+ ### Breaking change notice for version 8.0.0
7
+
8
+ Version 7.0.0 introduced ApiVersion, and known versions were hardcoded into the gem. Manually defining API versions is no longer required for versions not listed in the gem. Version 8.0.0 removes the following:
9
+ * `ShopifyAPI::ApiVersion::Unstable`
10
+ * `ShopifyAPI::ApiVersion::Release`
11
+ * `ShopifyAPI::ApiVersion.define_version`
12
+
13
+ The following methods on `ApiVersion` have been deprecated:
14
+ - `.coerce_to_version` deprecated. use `.find_version`
15
+ - `.define_known_versions` deprecated. Use `.fetch_known_versions`
16
+ - `.clear_defined_versions` deprecated. Use. `.clear_known_versions`
17
+ - `.latest_stable_version` deprecated. Use `ShopifyAPI::Meta.admin_versions.find(&:latest_supported)` (this fetches info from Shopify servers. No authentication required.)
18
+ - `#name` deprecated. Use `#handle`
19
+ - `#stable?` deprecated. Use `#supported?`
20
+
21
+ Version 8.0.0 introduces a _version lookup mode_. By default, `ShopifyAPI::ApiVersion.version_lookup_mode` is `:define_on_unknown`. When setting the api_version on `Session` or `Base`, the `api_version` attribute takes a version handle (i.e. `'2019-07'` or `:unstable`) and sets an instance of `ShopifyAPI::ApiVersion` matching the handle. When the version_lookup_mode is set to `:define_on_unknown`, any handle will naïvely create a new `ApiVersion` if the version is not in the known versions returned by `ShopifyAPI::ApiVersion.versions`.
22
+
23
+ To ensure you're setting only known and active versions, call :
24
+
25
+ ```ruby
26
+ ShopifyAPI::ApiVersion.version_lookup_mode = :raise_on_unknown
27
+ ShopifyAPI::ApiVersion.fetch_known_versions
28
+ ```
29
+
30
+ Known and active versions are fetched from https://app.shopify.com/services/apis.json and cached. Trying to use a version outside this cached set will raise an error. To switch back to naïve lookup and create a version if one is not found, call `ShopifyAPI::ApiVersion.version_lookup_mode = :define_on_unknown`.
31
+
32
+ ### Breaking change notice for version 7.0.0
33
+
34
+ #### Changes to ShopifyAPI::Session
35
+ When creating sessions, `api_version`is now required and uses keyword arguments.
36
+
37
+ To upgrade your use of ShopifyAPI you will need to make the following changes.
38
+
39
+ ```ruby
40
+ ShopifyAPI::Session.new(domain, token, extras)
41
+ ```
42
+ is now
43
+ ```ruby
44
+ ShopifyAPI::Session.new(domain: domain, token: token, api_version: api_version, extras: extras)
45
+ ```
46
+ Note `extras` is still optional. The other arguments are required.
47
+
48
+ ```ruby
49
+ ShopifyAPI::Session.temp(domain, token, extras) do
50
+ ...
51
+ end
52
+ ```
53
+ is now
54
+ ```ruby
55
+ ShopifyAPI::Session.temp(domain: domain, token: token, api_version: api_version) do
56
+ ...
57
+ end
58
+ ```
59
+
60
+ For example, if you want to use the `2019-04` version, you will create a session like this:
61
+ ```ruby
62
+ session = ShopifyAPI::Session.new(domain: domain, token: token, api_version: '2019-04')
63
+ ```
64
+ if you want to use the `unstable` version, you will create a session like this:
65
+ ```ruby
66
+ session = ShopifyAPI::Session.new(domain: domain, token: token, api_version: :unstable)
67
+ ```
68
+
69
+ #### Changes to how to define resources
70
+
71
+ If you have defined or customized Resources, classes that extend `ShopifyAPI::Base`:
72
+ The use of `self.prefix =` has been deprecated; you should now use `self.resource =` and not include `/admin`.
73
+ For example, if you specified a prefix like this before:
74
+ ```ruby
75
+ class MyResource < ShopifyAPI::Base
76
+ self.prefix = '/admin/shop/'
77
+ end
78
+ ```
79
+ You will update this to:
80
+ ```ruby
81
+ class MyResource < ShopifyAPI::Base
82
+ self.resource_prefix = 'shop/'
83
+ end
84
+ ```
85
+
86
+ #### URL construction
87
+
88
+ If you have specified any full paths for API calls in find
89
+ ```ruby
90
+ def self.current(options={})
91
+ find(:one, options.merge(from: "/admin/shop.#{format.extension}"))
92
+ end
93
+ ```
94
+ would be changed to
95
+
96
+ ```ruby
97
+ def self.current(options = {})
98
+ find(:one, options.merge(
99
+ from: api_version.construct_api_path("shop.#{format.extension}")
100
+ ))
101
+ end
102
+ ```
103
+
104
+ #### URLs that have not changed
105
+
106
+ - OAuth URLs for `authorize`, getting the `access_token` from a code, `access_scopes`, and using a `refresh_token` have _not_ changed.
107
+ - get: `/admin/oauth/authorize`
108
+ - post: `/admin/oauth/access_token`
109
+ - get: `/admin/oauth/access_scopes`
110
+ - URLs for the merchant’s web admin have _not_ changed. For example: to send the merchant to the product page the url is still `/admin/product/<id>`
data/CHANGELOG.md CHANGED
@@ -1,7 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ Note: For changes to the API, see https://shopify.dev/changelog?filter=api
4
+
3
5
  ## Unreleased
4
6
 
7
+ N/A
8
+
9
+ ## Version 11.0.1
10
+
11
+ - [#990](https://github.com/Shopify/shopify-api-ruby/pull/991) Validate `hmac` signature of OAuth callback using both old and new API secrets
12
+
13
+ ## Version 11.0.0
14
+
15
+ - [#987](https://github.com/Shopify/shopify_api/pull/987) ⚠️ [Breaking] Add REST resources for July 2022 API version, remove support and REST resources for July 2021 (`2021-07`) API version
16
+ - [#979](https://github.com/Shopify/shopify_api/pull/979) Update `ShopifyAPI::Context.setup` to take `old_api_secret_key` to support API credentials rotation
17
+ - [#977](https://github.com/Shopify/shopify_api/pull/977) Fix webhook requests when a header is present having a symbol key (e.g. `:clearance`)
18
+
19
+ ## Version 10.1.0
20
+
21
+ - [#933](https://github.com/Shopify/shopify_api/pull/933) Fix syntax of GraphQL query in `Webhooks.get_webhook_id` method by removing extra curly brace
22
+ - [#941](https://github.com/Shopify/shopify_api/pull/941) Fix `to_hash` to return readonly attributes, unless being used for serialize the object for saving - fix issue [#930](https://github.com/Shopify/shopify_api/issues/930)
23
+ - [#959](https://github.com/Shopify/shopify_api/pull/959) Update `LATEST_SUPPORTED_ADMIN_VERSION` to `2022-04` to align it with the current value
24
+
5
25
  ## Version 10.0.3
6
26
 
7
27
  ### Fixed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify_api (10.0.3)
4
+ shopify_api (11.0.1)
5
5
  concurrent-ruby
6
6
  hash_diff
7
7
  httparty
@@ -36,7 +36,7 @@ GEM
36
36
  multi_xml (>= 0.5.2)
37
37
  i18n (1.8.11)
38
38
  concurrent-ruby (~> 1.0)
39
- jwt (2.3.0)
39
+ jwt (2.4.1)
40
40
  method_source (1.0.0)
41
41
  mime-types (3.4.1)
42
42
  mime-types-data (~> 3.2015)
@@ -44,10 +44,10 @@ GEM
44
44
  minitest (5.15.0)
45
45
  mocha (1.13.0)
46
46
  multi_xml (0.6.0)
47
- oj (3.13.11)
47
+ oj (3.13.15)
48
48
  openssl (3.0.0)
49
49
  parallel (1.21.0)
50
- parser (3.1.0.0)
50
+ parser (3.1.2.0)
51
51
  ast (~> 2.4.1)
52
52
  pry (0.14.1)
53
53
  coderay (~> 1.1)
@@ -55,9 +55,9 @@ GEM
55
55
  public_suffix (4.0.6)
56
56
  rainbow (3.1.1)
57
57
  rake (13.0.6)
58
- rbi (0.0.11)
58
+ rbi (0.0.14)
59
59
  ast
60
- parser
60
+ parser (>= 2.6.4.0)
61
61
  sorbet-runtime (>= 0.5.9204)
62
62
  unparser
63
63
  regexp_parser (2.2.0)
@@ -79,29 +79,32 @@ GEM
79
79
  rubocop (>= 0.90.0)
80
80
  ruby-progressbar (1.11.0)
81
81
  securerandom (0.2.0)
82
- sorbet (0.5.9924)
83
- sorbet-static (= 0.5.9924)
84
- sorbet-runtime (0.5.9924)
85
- sorbet-static (0.5.9924-universal-darwin-21)
86
- sorbet-static (0.5.9924-x86_64-linux)
87
- spoom (1.1.8)
82
+ sorbet (0.5.10109)
83
+ sorbet-static (= 0.5.10109)
84
+ sorbet-runtime (0.5.10109)
85
+ sorbet-static (0.5.10109-universal-darwin-21)
86
+ sorbet-static (0.5.10109-x86_64-linux)
87
+ sorbet-static-and-runtime (0.5.10109)
88
+ sorbet (= 0.5.10109)
89
+ sorbet-runtime (= 0.5.10109)
90
+ spoom (1.1.11)
88
91
  sorbet (>= 0.5.9204)
89
92
  sorbet-runtime (>= 0.5.9204)
90
93
  thor (>= 0.19.2)
91
- tapioca (0.6.3)
94
+ tapioca (0.8.3)
92
95
  bundler (>= 1.17.3)
96
+ parallel (>= 1.21.0)
93
97
  pry (>= 0.12.2)
94
- rbi (~> 0.0.0, >= 0.0.9)
95
- sorbet-runtime (>= 0.5.9204)
96
- sorbet-static (>= 0.5.9204)
97
- spoom (~> 1.1.0, >= 1.1.4)
98
+ rbi (~> 0.0.0, >= 0.0.14)
99
+ sorbet-static-and-runtime (>= 0.5.9204)
100
+ spoom (~> 1.1.0, >= 1.1.11)
98
101
  thor (>= 1.2.0)
99
102
  yard-sorbet
100
103
  thor (1.2.1)
101
104
  tzinfo (2.0.4)
102
105
  concurrent-ruby (~> 1.0)
103
106
  unicode-display_width (2.1.0)
104
- unparser (0.6.3)
107
+ unparser (0.6.5)
105
108
  diff-lcs (~> 1.3)
106
109
  parser (>= 3.1.0)
107
110
  webmock (3.14.0)
@@ -109,12 +112,12 @@ GEM
109
112
  crack (>= 0.3.2)
110
113
  hashdiff (>= 0.4.0, < 2.0.0)
111
114
  webrick (1.7.0)
112
- yard (0.9.27)
115
+ yard (0.9.28)
113
116
  webrick (~> 1.7.0)
114
117
  yard-sorbet (0.6.1)
115
118
  sorbet-runtime (>= 0.5)
116
119
  yard (>= 0.9)
117
- zeitwerk (2.5.4)
120
+ zeitwerk (2.6.0)
118
121
 
119
122
  PLATFORMS
120
123
  arm64-darwin-21
data/README.md CHANGED
@@ -57,7 +57,7 @@ ShopifyAPI::Context.setup(
57
57
  session_storage: ShopifyAPI::Auth::FileSessionStorage.new, # See more details below
58
58
  is_embedded: true, # Set to true if you are building an embedded app
59
59
  is_private: false, # Set to true if you are building a private app
60
- api_version: "2022-01" # The vesion of the API you would like to use
60
+ api_version: "2022-01" # The version of the API you would like to use
61
61
  )
62
62
  ```
63
63
 
@@ -115,112 +115,9 @@ With this, a lot changed in how apps access the library. Here are the updates yo
115
115
  | `order = Order.new(<id>)`<br/>`order.post(:close)` | `order = Order.new(session:)`<br/>`order.close()` |
116
116
  | `order = Order.new(<id>)`<br/>`order.delete` | `Order.delete(id: <id>, session:)` |
117
117
 
118
- ### Breaking change notice for version 8.0.0
119
-
120
- Version 7.0.0 introduced ApiVersion, and known versions were hardcoded into the gem. Manually defining API versions is no longer required for versions not listed in the gem. Version 8.0.0 removes the following:
121
- * `ShopifyAPI::ApiVersion::Unstable`
122
- * `ShopifyAPI::ApiVersion::Release`
123
- * `ShopifyAPI::ApiVersion.define_version`
124
-
125
- The following methods on `ApiVersion` have been deprecated:
126
- - `.coerce_to_version` deprecated. use `.find_version`
127
- - `.define_known_versions` deprecated. Use `.fetch_known_versions`
128
- - `.clear_defined_versions` deprecated. Use. `.clear_known_versions`
129
- - `.latest_stable_version` deprecated. Use `ShopifyAPI::Meta.admin_versions.find(&:latest_supported)` (this fetches info from Shopify servers. No authentication required.)
130
- - `#name` deprecated. Use `#handle`
131
- - `#stable?` deprecated. Use `#supported?`
132
-
133
- Version 8.0.0 introduces a _version lookup mode_. By default, `ShopifyAPI::ApiVersion.version_lookup_mode` is `:define_on_unknown`. When setting the api_version on `Session` or `Base`, the `api_version` attribute takes a version handle (i.e. `'2019-07'` or `:unstable`) and sets an instance of `ShopifyAPI::ApiVersion` matching the handle. When the version_lookup_mode is set to `:define_on_unknown`, any handle will naïvely create a new `ApiVersion` if the version is not in the known versions returned by `ShopifyAPI::ApiVersion.versions`.
134
-
135
- To ensure you're setting only known and active versions, call :
136
-
137
- ```ruby
138
- ShopifyAPI::ApiVersion.version_lookup_mode = :raise_on_unknown
139
- ShopifyAPI::ApiVersion.fetch_known_versions
140
- ```
141
-
142
- Known and active versions are fetched from https://app.shopify.com/services/apis.json and cached. Trying to use a version outside this cached set will raise an error. To switch back to naïve lookup and create a version if one is not found, call `ShopifyAPI::ApiVersion.version_lookup_mode = :define_on_unknown`.
143
-
144
- ### Breaking change notice for version 7.0.0
145
-
146
- #### Changes to ShopifyAPI::Session
147
- When creating sessions, `api_version`is now required and uses keyword arguments.
148
-
149
- To upgrade your use of ShopifyAPI you will need to make the following changes.
150
-
151
- ```ruby
152
- ShopifyAPI::Session.new(domain, token, extras)
153
- ```
154
- is now
155
- ```ruby
156
- ShopifyAPI::Session.new(domain: domain, token: token, api_version: api_version, extras: extras)
157
- ```
158
- Note `extras` is still optional. The other arguments are required.
159
-
160
- ```ruby
161
- ShopifyAPI::Session.temp(domain, token, extras) do
162
- ...
163
- end
164
- ```
165
- is now
166
- ```ruby
167
- ShopifyAPI::Session.temp(domain: domain, token: token, api_version: api_version) do
168
- ...
169
- end
170
- ```
171
-
172
- For example, if you want to use the `2019-04` version, you will create a session like this:
173
- ```ruby
174
- session = ShopifyAPI::Session.new(domain: domain, token: token, api_version: '2019-04')
175
- ```
176
- if you want to use the `unstable` version, you will create a session like this:
177
- ```ruby
178
- session = ShopifyAPI::Session.new(domain: domain, token: token, api_version: :unstable)
179
- ```
180
-
181
- #### Changes to how to define resources
182
-
183
- If you have defined or customized Resources, classes that extend `ShopifyAPI::Base`:
184
- The use of `self.prefix =` has been deprecated; you should now use `self.resource =` and not include `/admin`.
185
- For example, if you specified a prefix like this before:
186
- ```ruby
187
- class MyResource < ShopifyAPI::Base
188
- self.prefix = '/admin/shop/'
189
- end
190
- ```
191
- You will update this to:
192
- ```ruby
193
- class MyResource < ShopifyAPI::Base
194
- self.resource_prefix = 'shop/'
195
- end
196
- ```
197
-
198
- #### URL construction
199
-
200
- If you have specified any full paths for API calls in find
201
- ```ruby
202
- def self.current(options={})
203
- find(:one, options.merge(from: "/admin/shop.#{format.extension}"))
204
- end
205
- ```
206
- would be changed to
207
-
208
- ```ruby
209
- def self.current(options = {})
210
- find(:one, options.merge(
211
- from: api_version.construct_api_path("shop.#{format.extension}")
212
- ))
213
- end
214
- ```
215
-
216
- #### URLs that have not changed
217
-
218
- - OAuth URLs for `authorize`, getting the `access_token` from a code, `access_scopes`, and using a `refresh_token` have _not_ changed.
219
- - get: `/admin/oauth/authorize`
220
- - post: `/admin/oauth/access_token`
221
- - get: `/admin/oauth/access_scopes`
222
- - URLs for the merchant’s web admin have _not_ changed. For example: to send the merchant to the product page the url is still `/admin/product/<id>`
118
+ ## Breaking changes for older versions
223
119
 
120
+ See [BREAKING_CHANGES_FOR_OLDER_VERSIONS](BREAKING_CHANGES_FOR_OLDER_VERSIONS.md)
224
121
 
225
122
  ## Developing this gem
226
123
 
data/RELEASING.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Releasing ShopifyAPI
2
2
 
3
- 1. Before releasing, make sure `sorbet` and `sorbet-runtime` are up to date
3
+ 1. Before releasing, make sure `sorbet` and related gems are up to date:
4
+ `bundle update sorbet sorbet-runtime sorbet-static tapioca --conservative`
4
5
  1. Check the Semantic Versioning page for info on how to version the new release: http://semver.org
5
6
  1. Update the version of ShopifyAPI in lib/shopify_api/version.rb
6
7
  1. Run `bundle`
@@ -54,7 +54,7 @@ variables = {
54
54
  first: 3
55
55
  }
56
56
 
57
- response = client.query(data: query, variables: variables)
57
+ response = client.query(query: query, variables: variables)
58
58
 
59
59
  ```
60
60
 
@@ -5,14 +5,13 @@ module ShopifyAPI
5
5
  module AdminVersions
6
6
  SUPPORTED_ADMIN_VERSIONS = T.let([
7
7
  "unstable",
8
+ "2022-07",
8
9
  "2022-04",
9
10
  "2022-01",
10
11
  "2021-10",
11
- "2021-07",
12
- "2021-04",
13
12
  ], T::Array[String])
14
13
 
15
- LATEST_SUPPORTED_ADMIN_VERSION = T.let("2022-01", String)
14
+ LATEST_SUPPORTED_ADMIN_VERSION = T.let("2022-07", String)
16
15
  end
17
16
 
18
17
  SUPPORTED_ADMIN_VERSIONS = ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS
@@ -16,11 +16,12 @@ module ShopifyAPI
16
16
 
17
17
  sig { params(token: String).void }
18
18
  def initialize(token)
19
- begin
20
- payload_hash = JWT.decode(token, Context.api_secret_key, true,
21
- { exp_leeway: JWT_EXPIRATION_LEEWAY, algorithm: "HS256" })[0]
22
- rescue
23
- raise ShopifyAPI::Errors::InvalidJwtTokenError, "Failed to parse session token '#{token}'"
19
+ payload_hash = begin
20
+ decode_token(token, Context.api_secret_key)
21
+ rescue ShopifyAPI::Errors::InvalidJwtTokenError
22
+ raise unless Context.old_api_secret_key
23
+
24
+ decode_token(token, T.must(Context.old_api_secret_key))
24
25
  end
25
26
 
26
27
  @iss = T.let(payload_hash["iss"], String)
@@ -67,6 +68,16 @@ module ShopifyAPI
67
68
  jti == other.jti &&
68
69
  sid == other.sid
69
70
  end
71
+
72
+ private
73
+
74
+ sig { params(token: String, api_secret_key: String).returns(T::Hash[String, T.untyped]) }
75
+ def decode_token(token, api_secret_key)
76
+ JWT.decode(token, api_secret_key, true,
77
+ { exp_leeway: JWT_EXPIRATION_LEEWAY, algorithm: "HS256" })[0]
78
+ rescue
79
+ raise ShopifyAPI::Errors::InvalidJwtTokenError, "Failed to parse session token '#{token}'"
80
+ end
70
81
  end
71
82
  end
72
83
  end
@@ -18,6 +18,7 @@ module ShopifyAPI
18
18
  @notified_missing_resources_folder = T.let({}, T::Hash[String, T::Boolean])
19
19
  @active_session = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
20
20
  @user_agent_prefix = T.let(nil, T.nilable(String))
21
+ @old_api_secret_key = T.let(nil, T.nilable(String))
21
22
 
22
23
  @rest_resource_loader = T.let(nil, T.nilable(Zeitwerk::Loader))
23
24
 
@@ -37,6 +38,7 @@ module ShopifyAPI
37
38
  logger: Logger,
38
39
  private_shop: T.nilable(String),
39
40
  user_agent_prefix: T.nilable(String),
41
+ old_api_secret_key: T.nilable(String),
40
42
  ).void
41
43
  end
42
44
  def setup(
@@ -50,7 +52,8 @@ module ShopifyAPI
50
52
  session_storage:,
51
53
  logger: Logger.new($stdout),
52
54
  private_shop: nil,
53
- user_agent_prefix: nil
55
+ user_agent_prefix: nil,
56
+ old_api_secret_key: nil
54
57
  )
55
58
  unless ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS.include?(api_version)
56
59
  raise Errors::UnsupportedVersionError,
@@ -68,6 +71,7 @@ module ShopifyAPI
68
71
  @logger = logger
69
72
  @private_shop = private_shop
70
73
  @user_agent_prefix = user_agent_prefix
74
+ @old_api_secret_key = old_api_secret_key
71
75
 
72
76
  load_rest_resources(api_version: api_version)
73
77
  end
@@ -118,7 +122,7 @@ module ShopifyAPI
118
122
  end
119
123
 
120
124
  sig { returns(T.nilable(String)) }
121
- attr_reader :private_shop, :user_agent_prefix
125
+ attr_reader :private_shop, :user_agent_prefix, :old_api_secret_key
122
126
 
123
127
  sig { returns(T::Boolean) }
124
128
  def embedded?
@@ -55,6 +55,12 @@ module ShopifyAPI
55
55
  sig { returns(T.nilable(String)) }
56
56
  attr_reader :custom_prefix
57
57
 
58
+ sig { returns(T::Hash[Symbol, Class]) }
59
+ attr_reader :has_many
60
+
61
+ sig { returns(T::Hash[Symbol, Class]) }
62
+ attr_reader :has_one
63
+
58
64
  sig do
59
65
  params(
60
66
  session: T.nilable(Auth::Session),
@@ -261,8 +267,8 @@ module ShopifyAPI
261
267
  match.nil? ? true : super
262
268
  end
263
269
 
264
- sig { returns(T::Hash[String, T.untyped]) }
265
- def to_hash
270
+ sig { params(saving: T::Boolean).returns(T::Hash[String, T.untyped]) }
271
+ def to_hash(saving = false)
266
272
  hash = {}
267
273
  instance_variables.each do |var|
268
274
  next if [
@@ -273,7 +279,7 @@ module ShopifyAPI
273
279
  :"@errors",
274
280
  :"@aliased_properties",
275
281
  ].include?(var)
276
- next if self.class.read_only_attributes&.include?(var)
282
+ next if saving && self.class.read_only_attributes&.include?(var)
277
283
 
278
284
  var = var.to_s.delete("@")
279
285
  attribute = if @aliased_properties.value?(var)
@@ -283,9 +289,16 @@ module ShopifyAPI
283
289
  end.to_sym
284
290
 
285
291
  if self.class.has_many?(attribute)
286
- hash[attribute.to_s] = get_property(attribute).map(&:to_hash).to_a if get_property(attribute)
292
+ attribute_class = self.class.has_many[attribute]
293
+ hash[attribute.to_s] = get_property(attribute).map do |element|
294
+ get_element_hash(element, T.unsafe(attribute_class), saving)
295
+ end.to_a if get_property(attribute)
287
296
  elsif self.class.has_one?(attribute)
288
- element_hash = get_property(attribute)&.to_hash
297
+ element_hash = get_element_hash(
298
+ get_property(attribute),
299
+ T.unsafe(self.class.has_one[attribute]),
300
+ saving
301
+ )
289
302
  hash[attribute.to_s] = element_hash if element_hash || @forced_nils[attribute.to_s]
290
303
  elsif !get_property(attribute).nil? || @forced_nils[attribute.to_s]
291
304
  hash[attribute.to_s] =
@@ -313,7 +326,7 @@ module ShopifyAPI
313
326
 
314
327
  sig { params(update_object: T::Boolean).void }
315
328
  def save(update_object: false)
316
- hash = HashDiff::Comparison.new(original_state, to_hash).left_diff
329
+ hash = HashDiff::Comparison.new(original_state, to_hash(true)).left_diff
317
330
  method = hash[self.class.primary_key] ? :put : :post
318
331
 
319
332
  path = self.class.get_path(http_method: method, operation: method, entity: self)
@@ -355,6 +368,20 @@ module ShopifyAPI
355
368
 
356
369
  instance_variable_get("@#{clean_key}")
357
370
  end
371
+
372
+ sig do
373
+ params(
374
+ element: T.nilable(T.any(T::Hash[String, T.untyped], ShopifyAPI::Rest::Base)),
375
+ attribute_class: Class,
376
+ saving: T::Boolean,
377
+ ).returns(T.nilable(T::Hash[String, T.untyped]))
378
+ end
379
+ def get_element_hash(element, attribute_class, saving)
380
+ return nil if element.nil?
381
+ return element.to_hash(saving) unless element.is_a?(Hash)
382
+
383
+ T.unsafe(attribute_class).create_instance(session: @session, data: element).to_hash(saving)
384
+ end
358
385
  end
359
386
  end
360
387
  end
@@ -1,6 +1,10 @@
1
1
  # typed: false
2
2
  # frozen_string_literal: true
3
3
 
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
4
8
  module ShopifyAPI
5
9
  class AbandonedCheckout < ShopifyAPI::Rest::Base
6
10
  extend T::Sig
@@ -1,6 +1,10 @@
1
1
  # typed: false
2
2
  # frozen_string_literal: true
3
3
 
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
4
8
  module ShopifyAPI
5
9
  class AccessScope < ShopifyAPI::Rest::Base
6
10
  extend T::Sig
@@ -1,6 +1,10 @@
1
1
  # typed: false
2
2
  # frozen_string_literal: true
3
3
 
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
4
8
  module ShopifyAPI
5
9
  class AndroidPayKey < ShopifyAPI::Rest::Base
6
10
  extend T::Sig
@@ -1,6 +1,10 @@
1
1
  # typed: false
2
2
  # frozen_string_literal: true
3
3
 
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
4
8
  module ShopifyAPI
5
9
  class ApplePayCertificate < ShopifyAPI::Rest::Base
6
10
  extend T::Sig
@@ -1,6 +1,10 @@
1
1
  # typed: false
2
2
  # frozen_string_literal: true
3
3
 
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
4
8
  module ShopifyAPI
5
9
  class ApplicationCharge < ShopifyAPI::Rest::Base
6
10
  extend T::Sig
@@ -1,6 +1,10 @@
1
1
  # typed: false
2
2
  # frozen_string_literal: true
3
3
 
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
4
8
  module ShopifyAPI
5
9
  class ApplicationCredit < ShopifyAPI::Rest::Base
6
10
  extend T::Sig