shopify_api 12.5.0 → 13.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/CHANGELOG.md +13 -0
  4. data/Gemfile.lock +7 -7
  5. data/README.md +0 -7
  6. data/docs/getting_started.md +1 -8
  7. data/lib/shopify_api/admin_versions.rb +2 -1
  8. data/lib/shopify_api/auth/oauth.rb +0 -2
  9. data/lib/shopify_api/clients/http_client.rb +13 -9
  10. data/lib/shopify_api/context.rb +5 -20
  11. data/lib/shopify_api/rest/base.rb +52 -14
  12. data/lib/shopify_api/rest/resources/2022_04/abandoned_checkout.rb +190 -0
  13. data/lib/shopify_api/rest/resources/2022_04/access_scope.rb +58 -0
  14. data/lib/shopify_api/rest/resources/2022_04/android_pay_key.rb +77 -0
  15. data/lib/shopify_api/rest/resources/2022_04/apple_pay_certificate.rb +105 -0
  16. data/lib/shopify_api/rest/resources/2022_04/application_charge.rb +109 -0
  17. data/lib/shopify_api/rest/resources/2022_04/application_credit.rb +92 -0
  18. data/lib/shopify_api/rest/resources/2022_04/article.rb +265 -0
  19. data/lib/shopify_api/rest/resources/2022_04/asset.rb +118 -0
  20. data/lib/shopify_api/rest/resources/2022_04/assigned_fulfillment_order.rb +86 -0
  21. data/lib/shopify_api/rest/resources/2022_04/balance.rb +50 -0
  22. data/lib/shopify_api/rest/resources/2022_04/blog.rb +162 -0
  23. data/lib/shopify_api/rest/resources/2022_04/cancellation_request.rb +83 -0
  24. data/lib/shopify_api/rest/resources/2022_04/carrier_service.rb +116 -0
  25. data/lib/shopify_api/rest/resources/2022_04/checkout.rb +209 -0
  26. data/lib/shopify_api/rest/resources/2022_04/collect.rb +142 -0
  27. data/lib/shopify_api/rest/resources/2022_04/collection.rb +110 -0
  28. data/lib/shopify_api/rest/resources/2022_04/collection_listing.rb +155 -0
  29. data/lib/shopify_api/rest/resources/2022_04/comment.rb +283 -0
  30. data/lib/shopify_api/rest/resources/2022_04/country.rb +137 -0
  31. data/lib/shopify_api/rest/resources/2022_04/currency.rb +57 -0
  32. data/lib/shopify_api/rest/resources/2022_04/custom_collection.rb +187 -0
  33. data/lib/shopify_api/rest/resources/2022_04/customer.rb +329 -0
  34. data/lib/shopify_api/rest/resources/2022_04/customer_address.rb +201 -0
  35. data/lib/shopify_api/rest/resources/2022_04/customer_saved_search.rb +169 -0
  36. data/lib/shopify_api/rest/resources/2022_04/deprecated_api_call.rb +57 -0
  37. data/lib/shopify_api/rest/resources/2022_04/discount_code.rb +222 -0
  38. data/lib/shopify_api/rest/resources/2022_04/dispute.rb +111 -0
  39. data/lib/shopify_api/rest/resources/2022_04/draft_order.rb +275 -0
  40. data/lib/shopify_api/rest/resources/2022_04/event.rb +148 -0
  41. data/lib/shopify_api/rest/resources/2022_04/fulfillment.rb +278 -0
  42. data/lib/shopify_api/rest/resources/2022_04/fulfillment_event.rb +166 -0
  43. data/lib/shopify_api/rest/resources/2022_04/fulfillment_order.rb +280 -0
  44. data/lib/shopify_api/rest/resources/2022_04/fulfillment_request.rb +87 -0
  45. data/lib/shopify_api/rest/resources/2022_04/fulfillment_service.rb +130 -0
  46. data/lib/shopify_api/rest/resources/2022_04/gift_card.rb +218 -0
  47. data/lib/shopify_api/rest/resources/2022_04/gift_card_adjustment.rb +118 -0
  48. data/lib/shopify_api/rest/resources/2022_04/image.rb +157 -0
  49. data/lib/shopify_api/rest/resources/2022_04/inventory_item.rb +108 -0
  50. data/lib/shopify_api/rest/resources/2022_04/inventory_level.rb +179 -0
  51. data/lib/shopify_api/rest/resources/2022_04/location.rb +167 -0
  52. data/lib/shopify_api/rest/resources/2022_04/locations_for_move.rb +56 -0
  53. data/lib/shopify_api/rest/resources/2022_04/marketing_event.rb +209 -0
  54. data/lib/shopify_api/rest/resources/2022_04/metafield.rb +344 -0
  55. data/lib/shopify_api/rest/resources/2022_04/mobile_platform_application.rb +110 -0
  56. data/lib/shopify_api/rest/resources/2022_04/order.rb +473 -0
  57. data/lib/shopify_api/rest/resources/2022_04/order_risk.rb +142 -0
  58. data/lib/shopify_api/rest/resources/2022_04/page.rb +194 -0
  59. data/lib/shopify_api/rest/resources/2022_04/payment.rb +140 -0
  60. data/lib/shopify_api/rest/resources/2022_04/payment_gateway.rb +143 -0
  61. data/lib/shopify_api/rest/resources/2022_04/payment_transaction.rb +107 -0
  62. data/lib/shopify_api/rest/resources/2022_04/payout.rb +97 -0
  63. data/lib/shopify_api/rest/resources/2022_04/policy.rb +69 -0
  64. data/lib/shopify_api/rest/resources/2022_04/price_rule.rb +223 -0
  65. data/lib/shopify_api/rest/resources/2022_04/product.rb +223 -0
  66. data/lib/shopify_api/rest/resources/2022_04/product_listing.rb +196 -0
  67. data/lib/shopify_api/rest/resources/2022_04/product_resource_feedback.rb +88 -0
  68. data/lib/shopify_api/rest/resources/2022_04/province.rb +132 -0
  69. data/lib/shopify_api/rest/resources/2022_04/recurring_application_charge.rb +172 -0
  70. data/lib/shopify_api/rest/resources/2022_04/redirect.rb +139 -0
  71. data/lib/shopify_api/rest/resources/2022_04/refund.rb +151 -0
  72. data/lib/shopify_api/rest/resources/2022_04/report.rb +121 -0
  73. data/lib/shopify_api/rest/resources/2022_04/resource_feedback.rb +73 -0
  74. data/lib/shopify_api/rest/resources/2022_04/script_tag.rb +155 -0
  75. data/lib/shopify_api/rest/resources/2022_04/shipping_zone.rb +83 -0
  76. data/lib/shopify_api/rest/resources/2022_04/shop.rb +218 -0
  77. data/lib/shopify_api/rest/resources/2022_04/smart_collection.rb +216 -0
  78. data/lib/shopify_api/rest/resources/2022_04/storefront_access_token.rb +87 -0
  79. data/lib/shopify_api/rest/resources/2022_04/tender_transaction.rb +93 -0
  80. data/lib/shopify_api/rest/resources/2022_04/theme.rb +123 -0
  81. data/lib/shopify_api/rest/resources/2022_04/transaction.rb +181 -0
  82. data/lib/shopify_api/rest/resources/2022_04/usage_charge.rb +102 -0
  83. data/lib/shopify_api/rest/resources/2022_04/user.rb +138 -0
  84. data/lib/shopify_api/rest/resources/2022_04/variant.rb +212 -0
  85. data/lib/shopify_api/rest/resources/2022_04/webhook.rb +168 -0
  86. data/lib/shopify_api/rest/resources/2022_07/application_credit.rb +2 -2
  87. data/lib/shopify_api/rest/resources/2022_07/carrier_service.rb +3 -0
  88. data/lib/shopify_api/rest/resources/2022_07/discount_code.rb +3 -0
  89. data/lib/shopify_api/rest/resources/2022_07/dispute.rb +2 -2
  90. data/lib/shopify_api/rest/resources/2022_07/draft_order.rb +2 -2
  91. data/lib/shopify_api/rest/resources/2022_07/event.rb +2 -2
  92. data/lib/shopify_api/rest/resources/2022_07/fulfillment.rb +6 -0
  93. data/lib/shopify_api/rest/resources/2022_07/fulfillment_order.rb +3 -7
  94. data/lib/shopify_api/rest/resources/2022_07/gift_card.rb +8 -5
  95. data/lib/shopify_api/rest/resources/2022_07/order_risk.rb +9 -2
  96. data/lib/shopify_api/rest/resources/2022_07/shipping_zone.rb +2 -2
  97. data/lib/shopify_api/rest/resources/2022_07/shop.rb +4 -4
  98. data/lib/shopify_api/rest/resources/2022_07/theme.rb +3 -0
  99. data/lib/shopify_api/rest/resources/2022_07/usage_charge.rb +2 -2
  100. data/lib/shopify_api/rest/resources/2022_10/application_credit.rb +2 -2
  101. data/lib/shopify_api/rest/resources/2022_10/carrier_service.rb +3 -0
  102. data/lib/shopify_api/rest/resources/2022_10/discount_code.rb +3 -0
  103. data/lib/shopify_api/rest/resources/2022_10/dispute.rb +2 -2
  104. data/lib/shopify_api/rest/resources/2022_10/draft_order.rb +2 -2
  105. data/lib/shopify_api/rest/resources/2022_10/event.rb +2 -2
  106. data/lib/shopify_api/rest/resources/2022_10/fulfillment.rb +6 -0
  107. data/lib/shopify_api/rest/resources/2022_10/fulfillment_order.rb +3 -7
  108. data/lib/shopify_api/rest/resources/2022_10/gift_card.rb +8 -5
  109. data/lib/shopify_api/rest/resources/2022_10/order_risk.rb +9 -2
  110. data/lib/shopify_api/rest/resources/2022_10/shipping_zone.rb +2 -2
  111. data/lib/shopify_api/rest/resources/2022_10/shop.rb +4 -4
  112. data/lib/shopify_api/rest/resources/2022_10/theme.rb +3 -0
  113. data/lib/shopify_api/rest/resources/2022_10/usage_charge.rb +2 -2
  114. data/lib/shopify_api/rest/resources/2023_01/application_credit.rb +2 -2
  115. data/lib/shopify_api/rest/resources/2023_01/carrier_service.rb +3 -0
  116. data/lib/shopify_api/rest/resources/2023_01/discount_code.rb +3 -0
  117. data/lib/shopify_api/rest/resources/2023_01/dispute.rb +2 -2
  118. data/lib/shopify_api/rest/resources/2023_01/draft_order.rb +2 -2
  119. data/lib/shopify_api/rest/resources/2023_01/event.rb +2 -2
  120. data/lib/shopify_api/rest/resources/2023_01/fulfillment.rb +6 -0
  121. data/lib/shopify_api/rest/resources/2023_01/fulfillment_order.rb +3 -7
  122. data/lib/shopify_api/rest/resources/2023_01/gift_card.rb +8 -5
  123. data/lib/shopify_api/rest/resources/2023_01/order_risk.rb +9 -2
  124. data/lib/shopify_api/rest/resources/2023_01/shipping_zone.rb +2 -2
  125. data/lib/shopify_api/rest/resources/2023_01/shop.rb +4 -4
  126. data/lib/shopify_api/rest/resources/2023_01/theme.rb +3 -0
  127. data/lib/shopify_api/rest/resources/2023_01/usage_charge.rb +2 -2
  128. data/lib/shopify_api/rest/resources/2023_04/application_credit.rb +2 -2
  129. data/lib/shopify_api/rest/resources/2023_04/carrier_service.rb +3 -0
  130. data/lib/shopify_api/rest/resources/2023_04/discount_code.rb +3 -0
  131. data/lib/shopify_api/rest/resources/2023_04/dispute.rb +2 -2
  132. data/lib/shopify_api/rest/resources/2023_04/draft_order.rb +2 -2
  133. data/lib/shopify_api/rest/resources/2023_04/event.rb +2 -2
  134. data/lib/shopify_api/rest/resources/2023_04/fulfillment.rb +6 -0
  135. data/lib/shopify_api/rest/resources/2023_04/gift_card.rb +8 -5
  136. data/lib/shopify_api/rest/resources/2023_04/order_risk.rb +9 -2
  137. data/lib/shopify_api/rest/resources/2023_04/shipping_zone.rb +2 -2
  138. data/lib/shopify_api/rest/resources/2023_04/shop.rb +4 -4
  139. data/lib/shopify_api/rest/resources/2023_04/theme.rb +3 -0
  140. data/lib/shopify_api/rest/resources/2023_04/usage_charge.rb +2 -2
  141. data/lib/shopify_api/rest/resources/2023_07/abandoned_checkout.rb +190 -0
  142. data/lib/shopify_api/rest/resources/2023_07/access_scope.rb +58 -0
  143. data/lib/shopify_api/rest/resources/2023_07/apple_pay_certificate.rb +105 -0
  144. data/lib/shopify_api/rest/resources/2023_07/application_charge.rb +109 -0
  145. data/lib/shopify_api/rest/resources/2023_07/application_credit.rb +91 -0
  146. data/lib/shopify_api/rest/resources/2023_07/article.rb +265 -0
  147. data/lib/shopify_api/rest/resources/2023_07/asset.rb +118 -0
  148. data/lib/shopify_api/rest/resources/2023_07/assigned_fulfillment_order.rb +86 -0
  149. data/lib/shopify_api/rest/resources/2023_07/balance.rb +50 -0
  150. data/lib/shopify_api/rest/resources/2023_07/blog.rb +162 -0
  151. data/lib/shopify_api/rest/resources/2023_07/cancellation_request.rb +83 -0
  152. data/lib/shopify_api/rest/resources/2023_07/carrier_service.rb +116 -0
  153. data/lib/shopify_api/rest/resources/2023_07/checkout.rb +209 -0
  154. data/lib/shopify_api/rest/resources/2023_07/collect.rb +142 -0
  155. data/lib/shopify_api/rest/resources/2023_07/collection.rb +110 -0
  156. data/lib/shopify_api/rest/resources/2023_07/collection_listing.rb +155 -0
  157. data/lib/shopify_api/rest/resources/2023_07/comment.rb +283 -0
  158. data/lib/shopify_api/rest/resources/2023_07/country.rb +137 -0
  159. data/lib/shopify_api/rest/resources/2023_07/currency.rb +57 -0
  160. data/lib/shopify_api/rest/resources/2023_07/custom_collection.rb +187 -0
  161. data/lib/shopify_api/rest/resources/2023_07/customer.rb +329 -0
  162. data/lib/shopify_api/rest/resources/2023_07/customer_address.rb +201 -0
  163. data/lib/shopify_api/rest/resources/2023_07/customer_saved_search.rb +169 -0
  164. data/lib/shopify_api/rest/resources/2023_07/deprecated_api_call.rb +57 -0
  165. data/lib/shopify_api/rest/resources/2023_07/discount_code.rb +222 -0
  166. data/lib/shopify_api/rest/resources/2023_07/dispute.rb +111 -0
  167. data/lib/shopify_api/rest/resources/2023_07/dispute_evidence.rb +117 -0
  168. data/lib/shopify_api/rest/resources/2023_07/dispute_file_upload.rb +81 -0
  169. data/lib/shopify_api/rest/resources/2023_07/draft_order.rb +275 -0
  170. data/lib/shopify_api/rest/resources/2023_07/event.rb +148 -0
  171. data/lib/shopify_api/rest/resources/2023_07/fulfillment.rb +231 -0
  172. data/lib/shopify_api/rest/resources/2023_07/fulfillment_event.rb +166 -0
  173. data/lib/shopify_api/rest/resources/2023_07/fulfillment_order.rb +312 -0
  174. data/lib/shopify_api/rest/resources/2023_07/fulfillment_request.rb +87 -0
  175. data/lib/shopify_api/rest/resources/2023_07/fulfillment_service.rb +130 -0
  176. data/lib/shopify_api/rest/resources/2023_07/gift_card.rb +218 -0
  177. data/lib/shopify_api/rest/resources/2023_07/gift_card_adjustment.rb +118 -0
  178. data/lib/shopify_api/rest/resources/2023_07/image.rb +157 -0
  179. data/lib/shopify_api/rest/resources/2023_07/inventory_item.rb +108 -0
  180. data/lib/shopify_api/rest/resources/2023_07/inventory_level.rb +179 -0
  181. data/lib/shopify_api/rest/resources/2023_07/location.rb +167 -0
  182. data/lib/shopify_api/rest/resources/2023_07/locations_for_move.rb +56 -0
  183. data/lib/shopify_api/rest/resources/2023_07/marketing_event.rb +209 -0
  184. data/lib/shopify_api/rest/resources/2023_07/metafield.rb +344 -0
  185. data/lib/shopify_api/rest/resources/2023_07/mobile_platform_application.rb +110 -0
  186. data/lib/shopify_api/rest/resources/2023_07/order.rb +488 -0
  187. data/lib/shopify_api/rest/resources/2023_07/order_risk.rb +142 -0
  188. data/lib/shopify_api/rest/resources/2023_07/page.rb +194 -0
  189. data/lib/shopify_api/rest/resources/2023_07/payment.rb +140 -0
  190. data/lib/shopify_api/rest/resources/2023_07/payment_gateway.rb +143 -0
  191. data/lib/shopify_api/rest/resources/2023_07/payment_transaction.rb +107 -0
  192. data/lib/shopify_api/rest/resources/2023_07/payout.rb +97 -0
  193. data/lib/shopify_api/rest/resources/2023_07/policy.rb +69 -0
  194. data/lib/shopify_api/rest/resources/2023_07/price_rule.rb +223 -0
  195. data/lib/shopify_api/rest/resources/2023_07/product.rb +223 -0
  196. data/lib/shopify_api/rest/resources/2023_07/product_listing.rb +196 -0
  197. data/lib/shopify_api/rest/resources/2023_07/product_resource_feedback.rb +88 -0
  198. data/lib/shopify_api/rest/resources/2023_07/province.rb +132 -0
  199. data/lib/shopify_api/rest/resources/2023_07/recurring_application_charge.rb +172 -0
  200. data/lib/shopify_api/rest/resources/2023_07/redirect.rb +139 -0
  201. data/lib/shopify_api/rest/resources/2023_07/refund.rb +151 -0
  202. data/lib/shopify_api/rest/resources/2023_07/resource_feedback.rb +73 -0
  203. data/lib/shopify_api/rest/resources/2023_07/script_tag.rb +155 -0
  204. data/lib/shopify_api/rest/resources/2023_07/shipping_zone.rb +83 -0
  205. data/lib/shopify_api/rest/resources/2023_07/shop.rb +221 -0
  206. data/lib/shopify_api/rest/resources/2023_07/smart_collection.rb +216 -0
  207. data/lib/shopify_api/rest/resources/2023_07/storefront_access_token.rb +87 -0
  208. data/lib/shopify_api/rest/resources/2023_07/tender_transaction.rb +93 -0
  209. data/lib/shopify_api/rest/resources/2023_07/theme.rb +123 -0
  210. data/lib/shopify_api/rest/resources/2023_07/transaction.rb +184 -0
  211. data/lib/shopify_api/rest/resources/2023_07/usage_charge.rb +102 -0
  212. data/lib/shopify_api/rest/resources/2023_07/user.rb +138 -0
  213. data/lib/shopify_api/rest/resources/2023_07/variant.rb +212 -0
  214. data/lib/shopify_api/rest/resources/2023_07/webhook.rb +168 -0
  215. data/lib/shopify_api/utils/graphql_proxy.rb +3 -6
  216. data/lib/shopify_api/utils/session_utils.rb +0 -84
  217. data/lib/shopify_api/version.rb +1 -1
  218. data/lib/shopify_api/webhooks/registry.rb +1 -1
  219. data/shopify_api.gemspec +1 -1
  220. metadata +151 -11
  221. data/lib/shopify_api/auth/file_session_storage.rb +0 -72
  222. data/lib/shopify_api/auth/session_storage.rb +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fee0ac74bfc70897541951eb87b46e750e0ed650c11b77d3a1c582451c3f4c0
4
- data.tar.gz: 2e935108619f59022b9101a838582311bb5824a268fe2c1034b629339613dce3
3
+ metadata.gz: 330b033c35e9b3b421a89e937cd50f80cd9439cdfc344c9809ef16746971a6e0
4
+ data.tar.gz: 522ce45ee19bc4208b3ee29eb95f620cfc473757507075da9fcb679ba63946a8
5
5
  SHA512:
6
- metadata.gz: f5830157e403f197fedd154dbd5b69653026fc8ec9cce3d4427764b8e1e189ff303e1104b82faf124e7093f92979003b33be5061db81d825e2219fd7a70e8bef
7
- data.tar.gz: e8fac7416a292ade97b591fa86e91034ae04a50e1d0f870b1f5289dcf40df0b1ccada6210b4255aae8c4e1d57e263bd38a8d0b990da0fa3e3383ef83a1333c60
6
+ metadata.gz: 884e25968587509d4c7643e128939832613dfc3c335936b517c574b5d4ad2f83e0a7ddb19af55214a04b27a72a4eb9fa1e23e7bf992031120e5c4bb96e67f934
7
+ data.tar.gz: b163f2f6290fdf41ca6a5f10c3b4732f1e9f9404d56d560a83db657f70b55f39edc2916660ce0ddf4e24bb8faf4049b6ce55b93dc651ef7fe6f2842483482c2a
data/.rubocop.yml CHANGED
@@ -57,3 +57,6 @@ Layout/EmptyLineAfterGuardClause:
57
57
  Enabled: true
58
58
  Style/GlobalStdStream:
59
59
  Enabled: true
60
+ Layout/LineLength:
61
+ Exclude:
62
+ - "test/clients/*"
data/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ Note: For changes to the API, see https://shopify.dev/changelog?filter=api
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 13.1.0
8
+
9
+ - [#1183](https://github.com/Shopify/shopify-api-ruby/pull/1183) Added support for API version 2023-07
10
+ - [#1157](https://github.com/Shopify/shopify-api-ruby/pull/1157) Fix an issue where read-only attributes are included when saving REST resources
11
+ - [#1169](https://github.com/Shopify/shopify-api-ruby/pull/1169) Unpin zeitwerk version from 2.6.5
12
+
13
+ ## 13.0.0
14
+
15
+ - [#1140](https://github.com/Shopify/shopify-api-ruby/pull/1140) ⚠️ [Breaking] Reformat Http error messages to be JSON parsable.
16
+ - [#1142](https://github.com/Shopify/shopify-api-ruby/issues/1142) Restore API version 2022-04, in alignment with [this](https://shopify.dev/changelog/action-required-support-for-api-version-2022-04-extended-to-june-30-2023) changelog notice.
17
+ - [#1155](https://github.com/Shopify/shopify-api-ruby/pull/1155) ⚠️ [Breaking] Remove session storage that was deprecated with [#1055](https://github.com/Shopify/shopify-api-ruby/pull/1055). ⚠️ [Breaking] GraphQL Proxy now requires `session` to be passed as an argument.
18
+ - [#1150](https://github.com/Shopify/shopify-api-ruby/pull/1150) [Patch] Add support for Event topic names.
19
+
7
20
  ## 12.5.0
8
21
 
9
22
  - [#1113](https://github.com/Shopify/shopify-api-ruby/pull/1113) Handle JSON::ParserError when http response is HTML and raise ShopifyAPI::Errors::HttpResponseError
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify_api (12.5.0)
4
+ shopify_api (13.1.0)
5
5
  activesupport
6
6
  concurrent-ruby
7
7
  hash_diff
@@ -11,12 +11,12 @@ PATH
11
11
  openssl
12
12
  securerandom
13
13
  sorbet-runtime
14
- zeitwerk (~> 2.5, < 2.6.5)
14
+ zeitwerk (~> 2.5)
15
15
 
16
16
  GEM
17
17
  remote: https://rubygems.org/
18
18
  specs:
19
- activesupport (7.0.4.3)
19
+ activesupport (7.0.6)
20
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
21
  i18n (>= 1.6, < 2)
22
22
  minitest (>= 5.1)
@@ -36,10 +36,10 @@ GEM
36
36
  httparty (0.21.0)
37
37
  mini_mime (>= 1.0.0)
38
38
  multi_xml (>= 0.5.2)
39
- i18n (1.12.0)
39
+ i18n (1.14.1)
40
40
  concurrent-ruby (~> 1.0)
41
41
  json (2.6.2)
42
- jwt (2.7.0)
42
+ jwt (2.7.1)
43
43
  language_server-protocol (3.17.0.1)
44
44
  method_source (1.0.0)
45
45
  mini_mime (1.1.2)
@@ -47,7 +47,7 @@ GEM
47
47
  mocha (1.13.0)
48
48
  multi_xml (0.6.0)
49
49
  netrc (0.11.0)
50
- oj (3.14.3)
50
+ oj (3.15.0)
51
51
  openssl (3.1.0)
52
52
  parallel (1.22.1)
53
53
  parser (3.1.2.1)
@@ -133,7 +133,7 @@ GEM
133
133
  yard-sorbet (0.7.0)
134
134
  sorbet-runtime (>= 0.5)
135
135
  yard (>= 0.9)
136
- zeitwerk (2.6.4)
136
+ zeitwerk (2.6.8)
137
137
 
138
138
  PLATFORMS
139
139
  arm64-darwin-21
data/README.md CHANGED
@@ -52,19 +52,12 @@ ShopifyAPI::Context.setup(
52
52
  api_secret_key: "<api-secret-key>",
53
53
  host: "<https://application-host-name.com>",
54
54
  scope: "read_orders,read_products,etc",
55
- session_storage: ShopifyAPI::Auth::FileSessionStorage.new, # See more details below
56
55
  is_embedded: true, # Set to true if you are building an embedded app
57
56
  api_version: "2022-01", # The version of the API you would like to use
58
57
  is_private: false, # Set to true if you have an existing private app
59
58
  )
60
59
  ```
61
60
 
62
- ### Setup a Session Store
63
-
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
-
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
-
68
61
  ### Performing OAuth
69
62
 
70
63
  You need to go through OAuth as described [here](https://shopify.dev/docs/apps/auth/oauth) to create sessions for shops using your app.
@@ -26,19 +26,12 @@ ShopifyAPI::Context.setup(
26
26
  api_secret_key: "<api-secret-key>",
27
27
  host_name: "<application-host-name>",
28
28
  scope: "read_orders,read_products,etc",
29
- session_storage: ShopifyAPI::Auth::FileSessionStorage.new, # This is only to be used for testing, more information in session docs
30
29
  is_embedded: true, # Set to true if you are building an embedded app
31
30
  is_private: false, # Set to true if you are building a private app
32
- api_version: "2021-01" # The vesion of the API you would like to use
31
+ api_version: "2021-01" # The version of the API you would like to use
33
32
  )
34
33
  ```
35
34
 
36
- ### Setup a Session Store
37
-
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
-
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
-
42
35
  ### Performing OAuth
43
36
 
44
37
  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.
@@ -5,6 +5,7 @@ module ShopifyAPI
5
5
  module AdminVersions
6
6
  SUPPORTED_ADMIN_VERSIONS = T.let([
7
7
  "unstable",
8
+ "2023-07",
8
9
  "2023-04",
9
10
  "2023-01",
10
11
  "2022-10",
@@ -13,7 +14,7 @@ module ShopifyAPI
13
14
  "2022-01",
14
15
  ], T::Array[String])
15
16
 
16
- LATEST_SUPPORTED_ADMIN_VERSION = T.let("2023-04", String)
17
+ LATEST_SUPPORTED_ADMIN_VERSION = T.let("2023-07", String)
17
18
  end
18
19
 
19
20
  SUPPORTED_ADMIN_VERSIONS = ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS
@@ -93,8 +93,6 @@ module ShopifyAPI
93
93
  )
94
94
  end
95
95
 
96
- Context.session_storage&.store_session(session)
97
-
98
96
  { session: session, cookie: cookie }
99
97
  end
100
98
 
@@ -65,15 +65,7 @@ module ShopifyAPI
65
65
 
66
66
  break if response.ok?
67
67
 
68
- error_messages = []
69
- error_messages << response.body["errors"] if response.body["errors"]
70
-
71
- if response.headers["x-request-id"]
72
- id = T.must(response.headers["x-request-id"])[0]
73
- error_messages << "If you report this error, please include this id: #{id}."
74
- end
75
-
76
- error_message = error_messages.join("\n")
68
+ error_message = serialized_error(response)
77
69
 
78
70
  unless [429, 500].include?(response.code)
79
71
  raise ShopifyAPI::Errors::HttpResponseError.new(response: response), error_message
@@ -102,6 +94,18 @@ module ShopifyAPI
102
94
  def request_url(request)
103
95
  "#{@base_uri_and_path}/#{request.path}"
104
96
  end
97
+
98
+ sig { params(response: HttpResponse).returns(String) }
99
+ def serialized_error(response)
100
+ body = {}
101
+ body["errors"] = response.body["errors"] if response.body["errors"]
102
+
103
+ if response.headers["x-request-id"]
104
+ id = T.must(response.headers["x-request-id"])[0]
105
+ body["error_reference"] = "If you report this error, please include this id: #{id}."
106
+ end
107
+ body.to_json
108
+ end
105
109
  end
106
110
  end
107
111
  end
@@ -15,8 +15,7 @@ module ShopifyAPI
15
15
  @logger = T.let(::Logger.new($stdout), ::Logger)
16
16
  @log_level = T.let(:info, Symbol)
17
17
  @notified_missing_resources_folder = T.let({}, T::Hash[String, T::Boolean])
18
- @active_session = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
19
- @session_storage = T.let(nil, T.nilable(ShopifyAPI::Auth::SessionStorage))
18
+ @active_session = T.let(Concurrent::ThreadLocalVar.new { nil }, T.nilable(Concurrent::ThreadLocalVar))
20
19
  @user_agent_prefix = T.let(nil, T.nilable(String))
21
20
  @old_api_secret_key = T.let(nil, T.nilable(String))
22
21
 
@@ -35,7 +34,6 @@ module ShopifyAPI
35
34
  is_embedded: T::Boolean,
36
35
  log_level: T.any(String, Symbol),
37
36
  logger: ::Logger,
38
- session_storage: T.nilable(ShopifyAPI::Auth::SessionStorage),
39
37
  host_name: T.nilable(String),
40
38
  host: T.nilable(String),
41
39
  private_shop: T.nilable(String),
@@ -52,7 +50,6 @@ module ShopifyAPI
52
50
  is_embedded:,
53
51
  log_level: :info,
54
52
  logger: ::Logger.new($stdout),
55
- session_storage: nil,
56
53
  host_name: nil,
57
54
  host: ENV["HOST"] || "https://#{host_name}",
58
55
  private_shop: nil,
@@ -71,7 +68,6 @@ module ShopifyAPI
71
68
  @is_private = is_private
72
69
  @scope = Auth::AuthScopes.new(scope)
73
70
  @is_embedded = is_embedded
74
- @session_storage = session_storage
75
71
  @logger = logger
76
72
  @private_shop = private_shop
77
73
  @user_agent_prefix = user_agent_prefix
@@ -82,19 +78,13 @@ module ShopifyAPI
82
78
  :info
83
79
  end
84
80
 
85
- if @session_storage
86
- ::ShopifyAPI::Logger.deprecated("The use of SessionStorage in the API library has been deprecated. " \
87
- "The ShopifyAPI will no longer have responsibility for session persistence. " \
88
- "Upgrading to `shopify_app` 21.3 will allow you to remove session_storage" \
89
- " from the API library Context configuration.", "13.0.0")
90
- end
91
-
92
81
  load_rest_resources(api_version: api_version)
93
82
  end
94
83
 
95
84
  sig { params(api_version: String).void }
96
85
  def load_rest_resources(api_version:)
97
86
  # Unload any previous instances - mostly useful for tests where we need to reset the version
87
+ @rest_resource_loader&.setup
98
88
  @rest_resource_loader&.unload
99
89
 
100
90
  # No resources for the unstable version
@@ -126,9 +116,6 @@ module ShopifyAPI
126
116
  sig { returns(Auth::AuthScopes) }
127
117
  attr_reader :scope
128
118
 
129
- sig { returns(T.nilable(ShopifyAPI::Auth::SessionStorage)) }
130
- attr_reader :session_storage
131
-
132
119
  sig { returns(::Logger) }
133
120
  attr_reader :logger
134
121
 
@@ -155,19 +142,17 @@ module ShopifyAPI
155
142
 
156
143
  sig { returns(T.nilable(Auth::Session)) }
157
144
  def active_session
158
- return @active_session.value unless @active_session.value.nil?
159
-
160
- private? ? Utils::SessionUtils.load_current_session : nil
145
+ @active_session&.value
161
146
  end
162
147
 
163
148
  sig { params(session: T.nilable(Auth::Session)).void }
164
149
  def activate_session(session)
165
- @active_session.value = session
150
+ T.must(@active_session).value = session
166
151
  end
167
152
 
168
153
  sig { void }
169
154
  def deactivate_session
170
- @active_session.value = nil
155
+ T.must(@active_session).value = nil
171
156
  end
172
157
 
173
158
  sig { returns(String) }
@@ -21,7 +21,7 @@ module ShopifyAPI
21
21
  sig { returns(T::Hash[Symbol, T.untyped]) }
22
22
  attr_accessor :original_state
23
23
 
24
- sig { returns(Rest::BaseErrors) }
24
+ sig { returns(T.any(Rest::BaseErrors, T.nilable(T::Hash[T.untyped, T.untyped]))) }
25
25
  attr_reader :errors
26
26
 
27
27
  sig do
@@ -234,16 +234,20 @@ module ShopifyAPI
234
234
  attr_sym = attribute.to_sym
235
235
 
236
236
  if has_many?(attr_sym) && value
237
+ instance.original_state[attr_sym] = []
237
238
  attr_list = []
238
239
  value.each do |element|
239
- attr_list << T.unsafe(@has_many[attr_sym]).create_instance(data: element, session: session)
240
+ child = T.unsafe(@has_many[attr_sym]).create_instance(data: element, session: session)
241
+ attr_list << child
242
+ instance.original_state[attr_sym] << child.to_hash(true)
240
243
  end
241
244
  instance.public_send("#{attribute}=", attr_list)
242
245
  elsif has_one?(attr_sym) && value
243
246
  # force a hash if core returns values that instantiate objects like "USD"
244
247
  data_hash = value.is_a?(Hash) ? value : { attribute.to_s => value }
245
- instance.public_send("#{attribute}=",
246
- T.unsafe(@has_one[attr_sym]).create_instance(data: data_hash, session: session))
248
+ child = T.unsafe(@has_one[attr_sym]).create_instance(data: data_hash, session: session)
249
+ instance.public_send("#{attribute}=", child)
250
+ instance.original_state[attr_sym] = child.to_hash(true)
247
251
  else
248
252
  instance.public_send("#{attribute}=", value)
249
253
  instance.original_state[attr_sym] = value
@@ -335,16 +339,12 @@ module ShopifyAPI
335
339
 
336
340
  sig { params(update_object: T::Boolean).void }
337
341
  def save(update_object: false)
338
- hash = HashDiff::Comparison.new(original_state, to_hash(true)).left_diff
339
- method = hash[self.class.primary_key] ? :put : :post
340
-
341
- path = self.class.get_path(http_method: method, operation: method, entity: self)
342
- if path.nil?
343
- method = method == :post ? :put : :post
344
- path = self.class.get_path(http_method: method, operation: method, entity: self)
345
- end
346
-
347
- response = @client.public_send(method, body: { self.class.json_body_name => hash }, path: path)
342
+ method = deduce_write_verb
343
+ response = @client.public_send(
344
+ method,
345
+ body: { self.class.json_body_name => attributes_to_update },
346
+ path: deduce_write_path(method),
347
+ )
348
348
 
349
349
  if update_object
350
350
  self.class.create_instance(
@@ -359,6 +359,44 @@ module ShopifyAPI
359
359
 
360
360
  private
361
361
 
362
+ sig { returns(T::Hash[String, String]) }
363
+ def attributes_to_update
364
+ original_state_for_update = original_state.reject do |attribute, _|
365
+ self.class.read_only_attributes&.include?("@#{attribute}".to_sym)
366
+ end
367
+
368
+ HashDiff::Comparison.new(
369
+ deep_stringify_keys(original_state_for_update),
370
+ deep_stringify_keys(to_hash(true)),
371
+ ).left_diff
372
+ end
373
+
374
+ sig { returns(Symbol) }
375
+ def deduce_write_verb
376
+ send(self.class.primary_key) ? :put : :post
377
+ end
378
+
379
+ sig { params(method: Symbol).returns(T.nilable(String)) }
380
+ def deduce_write_path(method)
381
+ path = self.class.get_path(http_method: method, operation: method, entity: self)
382
+
383
+ if path.nil?
384
+ method = method == :post ? :put : :post
385
+ path = self.class.get_path(http_method: method, operation: method, entity: self)
386
+ end
387
+
388
+ path
389
+ end
390
+
391
+ sig { params(hash: T::Hash[T.any(String, Symbol), T.untyped]).returns(T::Hash[String, String]) }
392
+ def deep_stringify_keys(hash)
393
+ hash.each_with_object({}) do |(key, value), result|
394
+ new_key = key.to_s
395
+ new_value = value.is_a?(Hash) ? deep_stringify_keys(value) : value
396
+ result[new_key] = new_value
397
+ end
398
+ end
399
+
362
400
  sig { params(key: T.any(String, Symbol), val: T.untyped).void }
363
401
  def set_property(key, val)
364
402
  # Some API fields contain invalid characters, like `?`, which causes issues when setting them as instance
@@ -0,0 +1,190 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
8
+ module ShopifyAPI
9
+ class AbandonedCheckout < ShopifyAPI::Rest::Base
10
+ extend T::Sig
11
+
12
+ @prev_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
13
+ @next_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
14
+
15
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session)).void }
16
+ def initialize(session: ShopifyAPI::Context.active_session)
17
+ super(session: session)
18
+
19
+ @abandoned_checkout_url = T.let(nil, T.nilable(String))
20
+ @billing_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
21
+ @buyer_accepts_marketing = T.let(nil, T.nilable(T::Boolean))
22
+ @buyer_accepts_sms_marketing = T.let(nil, T.nilable(T::Boolean))
23
+ @cart_token = T.let(nil, T.nilable(String))
24
+ @closed_at = T.let(nil, T.nilable(String))
25
+ @completed_at = T.let(nil, T.nilable(String))
26
+ @created_at = T.let(nil, T.nilable(String))
27
+ @currency = T.let(nil, T.nilable(Currency))
28
+ @customer = T.let(nil, T.nilable(Customer))
29
+ @customer_locale = T.let(nil, T.nilable(String))
30
+ @device_id = T.let(nil, T.nilable(Integer))
31
+ @discount_codes = T.let(nil, T.nilable(T::Array[T.untyped]))
32
+ @email = T.let(nil, T.nilable(String))
33
+ @gateway = T.let(nil, T.nilable(String))
34
+ @id = T.let(nil, T.nilable(Integer))
35
+ @landing_site = T.let(nil, T.nilable(String))
36
+ @line_items = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
37
+ @location_id = T.let(nil, T.nilable(Integer))
38
+ @note = T.let(nil, T.nilable(String))
39
+ @phone = T.let(nil, T.nilable(String))
40
+ @presentment_currency = T.let(nil, T.nilable(String))
41
+ @referring_site = T.let(nil, T.nilable(String))
42
+ @shipping_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
43
+ @shipping_lines = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
44
+ @sms_marketing_phone = T.let(nil, T.nilable(String))
45
+ @source_name = T.let(nil, T.nilable(String))
46
+ @subtotal_price = T.let(nil, T.nilable(String))
47
+ @tax_lines = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
48
+ @taxes_included = T.let(nil, T.nilable(T::Boolean))
49
+ @token = T.let(nil, T.nilable(String))
50
+ @total_discounts = T.let(nil, T.nilable(String))
51
+ @total_duties = T.let(nil, T.nilable(String))
52
+ @total_line_items_price = T.let(nil, T.nilable(String))
53
+ @total_price = T.let(nil, T.nilable(String))
54
+ @total_tax = T.let(nil, T.nilable(String))
55
+ @total_weight = T.let(nil, T.nilable(Integer))
56
+ @updated_at = T.let(nil, T.nilable(String))
57
+ @user_id = T.let(nil, T.nilable(Integer))
58
+ end
59
+
60
+ @has_one = T.let({
61
+ currency: Currency,
62
+ customer: Customer
63
+ }, T::Hash[Symbol, Class])
64
+ @has_many = T.let({
65
+ discount_codes: DiscountCode
66
+ }, T::Hash[Symbol, Class])
67
+ @paths = T.let([
68
+ {http_method: :get, operation: :checkouts, ids: [], path: "checkouts.json"},
69
+ {http_method: :get, operation: :checkouts, ids: [], path: "checkouts.json"}
70
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
71
+
72
+ sig { returns(T.nilable(String)) }
73
+ attr_reader :abandoned_checkout_url
74
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
75
+ attr_reader :billing_address
76
+ sig { returns(T.nilable(T::Boolean)) }
77
+ attr_reader :buyer_accepts_marketing
78
+ sig { returns(T.nilable(T::Boolean)) }
79
+ attr_reader :buyer_accepts_sms_marketing
80
+ sig { returns(T.nilable(String)) }
81
+ attr_reader :cart_token
82
+ sig { returns(T.nilable(String)) }
83
+ attr_reader :closed_at
84
+ sig { returns(T.nilable(String)) }
85
+ attr_reader :completed_at
86
+ sig { returns(T.nilable(String)) }
87
+ attr_reader :created_at
88
+ sig { returns(T.nilable(Currency)) }
89
+ attr_reader :currency
90
+ sig { returns(T.nilable(Customer)) }
91
+ attr_reader :customer
92
+ sig { returns(T.nilable(String)) }
93
+ attr_reader :customer_locale
94
+ sig { returns(T.nilable(Integer)) }
95
+ attr_reader :device_id
96
+ sig { returns(T.nilable(T::Array[DiscountCode])) }
97
+ attr_reader :discount_codes
98
+ sig { returns(T.nilable(String)) }
99
+ attr_reader :email
100
+ sig { returns(T.nilable(String)) }
101
+ attr_reader :gateway
102
+ sig { returns(T.nilable(Integer)) }
103
+ attr_reader :id
104
+ sig { returns(T.nilable(String)) }
105
+ attr_reader :landing_site
106
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
107
+ attr_reader :line_items
108
+ sig { returns(T.nilable(Integer)) }
109
+ attr_reader :location_id
110
+ sig { returns(T.nilable(String)) }
111
+ attr_reader :note
112
+ sig { returns(T.nilable(String)) }
113
+ attr_reader :phone
114
+ sig { returns(T.nilable(String)) }
115
+ attr_reader :presentment_currency
116
+ sig { returns(T.nilable(String)) }
117
+ attr_reader :referring_site
118
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
119
+ attr_reader :shipping_address
120
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
121
+ attr_reader :shipping_lines
122
+ sig { returns(T.nilable(String)) }
123
+ attr_reader :sms_marketing_phone
124
+ sig { returns(T.nilable(String)) }
125
+ attr_reader :source_name
126
+ sig { returns(T.nilable(String)) }
127
+ attr_reader :subtotal_price
128
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
129
+ attr_reader :tax_lines
130
+ sig { returns(T.nilable(T::Boolean)) }
131
+ attr_reader :taxes_included
132
+ sig { returns(T.nilable(String)) }
133
+ attr_reader :token
134
+ sig { returns(T.nilable(String)) }
135
+ attr_reader :total_discounts
136
+ sig { returns(T.nilable(String)) }
137
+ attr_reader :total_duties
138
+ sig { returns(T.nilable(String)) }
139
+ attr_reader :total_line_items_price
140
+ sig { returns(T.nilable(String)) }
141
+ attr_reader :total_price
142
+ sig { returns(T.nilable(String)) }
143
+ attr_reader :total_tax
144
+ sig { returns(T.nilable(Integer)) }
145
+ attr_reader :total_weight
146
+ sig { returns(T.nilable(String)) }
147
+ attr_reader :updated_at
148
+ sig { returns(T.nilable(Integer)) }
149
+ attr_reader :user_id
150
+
151
+ class << self
152
+ sig do
153
+ params(
154
+ since_id: T.untyped,
155
+ created_at_min: T.untyped,
156
+ created_at_max: T.untyped,
157
+ updated_at_min: T.untyped,
158
+ updated_at_max: T.untyped,
159
+ status: T.untyped,
160
+ limit: T.untyped,
161
+ session: Auth::Session,
162
+ kwargs: T.untyped
163
+ ).returns(T.untyped)
164
+ end
165
+ def checkouts(
166
+ since_id: nil,
167
+ created_at_min: nil,
168
+ created_at_max: nil,
169
+ updated_at_min: nil,
170
+ updated_at_max: nil,
171
+ status: nil,
172
+ limit: nil,
173
+ session: ShopifyAPI::Context.active_session,
174
+ **kwargs
175
+ )
176
+ request(
177
+ http_method: :get,
178
+ operation: :checkouts,
179
+ session: session,
180
+ ids: {},
181
+ params: {since_id: since_id, created_at_min: created_at_min, created_at_max: created_at_max, updated_at_min: updated_at_min, updated_at_max: updated_at_max, status: status, limit: limit}.merge(kwargs).compact,
182
+ body: {},
183
+ entity: nil,
184
+ )
185
+ end
186
+
187
+ end
188
+
189
+ end
190
+ end
@@ -0,0 +1,58 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
8
+ module ShopifyAPI
9
+ class AccessScope < ShopifyAPI::Rest::Base
10
+ extend T::Sig
11
+
12
+ @prev_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
13
+ @next_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
14
+
15
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session)).void }
16
+ def initialize(session: ShopifyAPI::Context.active_session)
17
+ super(session: session)
18
+
19
+ @handle = T.let(nil, T.nilable(String))
20
+ @access_scopes = T.let(nil, T.nilable(T::Array[T.untyped]))
21
+ end
22
+
23
+ @has_one = T.let({}, T::Hash[Symbol, Class])
24
+ @has_many = T.let({}, T::Hash[Symbol, Class])
25
+ @custom_prefix = T.let("/admin/oauth", T.nilable(String))
26
+ @paths = T.let([
27
+ {http_method: :get, operation: :get, ids: [], path: "access_scopes.json"}
28
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
29
+
30
+ sig { returns(T.nilable(String)) }
31
+ attr_reader :handle
32
+ sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) }
33
+ attr_reader :access_scopes
34
+
35
+ class << self
36
+ sig do
37
+ params(
38
+ session: Auth::Session,
39
+ kwargs: T.untyped
40
+ ).returns(T::Array[AccessScope])
41
+ end
42
+ def all(
43
+ session: ShopifyAPI::Context.active_session,
44
+ **kwargs
45
+ )
46
+ response = base_find(
47
+ session: session,
48
+ ids: {},
49
+ params: {}.merge(kwargs).compact,
50
+ )
51
+
52
+ T.cast(response, T::Array[AccessScope])
53
+ end
54
+
55
+ end
56
+
57
+ end
58
+ end