shopify_api 10.1.0 → 11.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) 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 +6 -0
  6. data/Gemfile.lock +23 -20
  7. data/README.md +2 -105
  8. data/RELEASING.md +2 -1
  9. data/lib/shopify_api/admin_versions.rb +2 -3
  10. data/lib/shopify_api/auth/jwt_payload.rb +16 -5
  11. data/lib/shopify_api/context.rb +6 -2
  12. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/abandoned_checkout.rb +0 -0
  13. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/access_scope.rb +0 -0
  14. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/android_pay_key.rb +0 -0
  15. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/apple_pay_certificate.rb +0 -0
  16. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/application_charge.rb +0 -0
  17. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/application_credit.rb +0 -0
  18. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/article.rb +0 -0
  19. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/asset.rb +0 -0
  20. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/assigned_fulfillment_order.rb +0 -0
  21. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/balance.rb +0 -0
  22. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/blog.rb +0 -0
  23. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/cancellation_request.rb +0 -0
  24. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/carrier_service.rb +0 -3
  25. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/checkout.rb +0 -0
  26. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/collect.rb +0 -0
  27. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/collection.rb +0 -0
  28. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/collection_listing.rb +0 -0
  29. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/comment.rb +0 -0
  30. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/country.rb +0 -0
  31. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/currency.rb +0 -0
  32. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/custom_collection.rb +0 -0
  33. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/customer.rb +12 -0
  34. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/customer_address.rb +0 -0
  35. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/customer_saved_search.rb +0 -0
  36. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/deprecated_api_call.rb +0 -0
  37. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/discount_code.rb +0 -0
  38. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/dispute.rb +0 -0
  39. data/lib/shopify_api/rest/resources/2022_07/dispute_evidence.rb +117 -0
  40. data/lib/shopify_api/rest/resources/2022_07/dispute_file_upload.rb +81 -0
  41. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/draft_order.rb +6 -1
  42. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/event.rb +0 -0
  43. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/fulfillment.rb +5 -49
  44. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/fulfillment_event.rb +0 -0
  45. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/fulfillment_order.rb +83 -1
  46. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/fulfillment_request.rb +5 -1
  47. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/fulfillment_service.rb +3 -3
  48. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/gift_card.rb +0 -0
  49. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/gift_card_adjustment.rb +0 -0
  50. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/image.rb +0 -0
  51. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/inventory_item.rb +0 -0
  52. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/inventory_level.rb +0 -0
  53. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/location.rb +0 -0
  54. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/locations_for_move.rb +0 -0
  55. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/marketing_event.rb +0 -0
  56. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/metafield.rb +0 -0
  57. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/mobile_platform_application.rb +0 -0
  58. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/order.rb +3 -0
  59. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/order_risk.rb +0 -0
  60. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/page.rb +0 -0
  61. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/payment.rb +0 -0
  62. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/payment_gateway.rb +0 -0
  63. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/payment_transaction.rb +0 -0
  64. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/payout.rb +0 -0
  65. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/policy.rb +0 -0
  66. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/price_rule.rb +3 -3
  67. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/product.rb +0 -0
  68. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/product_listing.rb +0 -0
  69. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/product_resource_feedback.rb +0 -0
  70. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/province.rb +0 -0
  71. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/recurring_application_charge.rb +0 -0
  72. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/redirect.rb +0 -0
  73. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/refund.rb +0 -0
  74. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/report.rb +0 -0
  75. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/resource_feedback.rb +0 -0
  76. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/script_tag.rb +0 -0
  77. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/shipping_zone.rb +0 -0
  78. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/shop.rb +0 -0
  79. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/smart_collection.rb +0 -0
  80. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/storefront_access_token.rb +0 -0
  81. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/tender_transaction.rb +0 -0
  82. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/theme.rb +0 -0
  83. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/transaction.rb +3 -0
  84. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/usage_charge.rb +0 -0
  85. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/user.rb +0 -0
  86. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/variant.rb +0 -0
  87. data/lib/shopify_api/rest/resources/{2021_07 → 2022_07}/webhook.rb +0 -0
  88. data/lib/shopify_api/version.rb +1 -1
  89. data/lib/shopify_api/webhooks/request.rb +1 -1
  90. data/sorbet/rbi/todo.rbi +0 -1
  91. metadata +80 -77
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc4cfe78db0e88c911424f8d3e2b3ed88b41a3bb91db59beea5a250222a784af
4
- data.tar.gz: c2f3d45bf47d0b0e5d8da086895c59145b0c84ef4b70f04acee72188278f4b74
3
+ metadata.gz: e6ef6d1ca6d9c8e54ddd8fd1c4ca34fdb015e2fe1157c1a101810c8036a69b02
4
+ data.tar.gz: 94cf5af5bf1e14d8fa1728bb87d0c138f92bebcdbb16d47885a2e2ce73ffba81
5
5
  SHA512:
6
- metadata.gz: f5fdbadb1ba50cf494e3eee2e08c6e2ee29085093821d24da8965d3215c1197ddadbaf0c1b2fb979ba59a3e3fad315691a85658ba970dd8f58b0a5f4b23456ab
7
- data.tar.gz: b71d5ec832995ae090aa52ee61c5fe3a67c05ad04d78a3e8f34cfee2fa8565f221ce5229a354f981c1de2d9eed25e2fd341919c6474695a973b7052b71db72df
6
+ metadata.gz: 505926c8d97d9ec73a4dbab76ff42aabf7f0559c503450ada931c51f900a62540ea52cfe4c8e02877a86f515b50b5f7c7f6536fde6d760ff44337d8e68bc6ed5
7
+ data.tar.gz: 84c6d2c78256cd4b84290ba324d3825ed2365aad7e142bd7f0ca0275f5f9c48d9f2251ff9a022cc2bb663a3a25c5d6c9841af25558a2dd154f62323305e4fd85
@@ -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
@@ -4,6 +4,12 @@ Note: For changes to the API, see https://shopify.dev/changelog?filter=api
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## Version 11.0.0
8
+
9
+ - [#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
10
+ - [#979](https://github.com/Shopify/shopify_api/pull/979) Update `ShopifyAPI::Context.setup` to take `old_api_secret_key` to support API credentials rotation
11
+ - [#977](https://github.com/Shopify/shopify_api/pull/977) Fix webhook requests when a header is present having a symbol key (e.g. `:clearance`)
12
+
7
13
  ## Version 10.1.0
8
14
 
9
15
  - [#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
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify_api (10.1.0)
4
+ shopify_api (11.0.0)
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.10016)
83
- sorbet-static (= 0.5.10016)
84
- sorbet-runtime (0.5.10016)
85
- sorbet-static (0.5.10016-universal-darwin-21)
86
- sorbet-static (0.5.10016-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.4)
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
@@ -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`
@@ -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-04", 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?
@@ -20,7 +20,6 @@ module ShopifyAPI
20
20
  @admin_graphql_api_id = T.let(nil, T.nilable(String))
21
21
  @callback_url = T.let(nil, T.nilable(String))
22
22
  @carrier_service_type = T.let(nil, T.nilable(String))
23
- @format = T.let(nil, T.nilable(String))
24
23
  @id = T.let(nil, T.nilable(Integer))
25
24
  @name = T.let(nil, T.nilable(String))
26
25
  @service_discovery = T.let(nil, T.nilable(T::Boolean))
@@ -44,8 +43,6 @@ module ShopifyAPI
44
43
  attr_reader :callback_url
45
44
  sig { returns(T.nilable(String)) }
46
45
  attr_reader :carrier_service_type
47
- sig { returns(T.nilable(String)) }
48
- attr_reader :format
49
46
  sig { returns(T.nilable(Integer)) }
50
47
  attr_reader :id
51
48
  sig { returns(T.nilable(String)) }
@@ -23,6 +23,7 @@ module ShopifyAPI
23
23
  @currency = T.let(nil, T.nilable(String))
24
24
  @default_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
25
25
  @email = T.let(nil, T.nilable(String))
26
+ @email_marketing_consent = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
26
27
  @first_name = T.let(nil, T.nilable(String))
27
28
  @id = T.let(nil, T.nilable(Integer))
28
29
  @last_name = T.let(nil, T.nilable(String))
@@ -33,7 +34,10 @@ module ShopifyAPI
33
34
  @multipass_identifier = T.let(nil, T.nilable(String))
34
35
  @note = T.let(nil, T.nilable(String))
35
36
  @orders_count = T.let(nil, T.nilable(Integer))
37
+ @password = T.let(nil, T.nilable(String))
38
+ @password_confirmation = T.let(nil, T.nilable(String))
36
39
  @phone = T.let(nil, T.nilable(String))
40
+ @sms_marketing_consent = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
37
41
  @state = T.let(nil, T.nilable(String))
38
42
  @tags = T.let(nil, T.nilable(String))
39
43
  @tax_exempt = T.let(nil, T.nilable(T::Boolean))
@@ -73,6 +77,8 @@ module ShopifyAPI
73
77
  attr_reader :default_address
74
78
  sig { returns(T.nilable(String)) }
75
79
  attr_reader :email
80
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
81
+ attr_reader :email_marketing_consent
76
82
  sig { returns(T.nilable(String)) }
77
83
  attr_reader :first_name
78
84
  sig { returns(T.nilable(Integer)) }
@@ -94,7 +100,13 @@ module ShopifyAPI
94
100
  sig { returns(T.nilable(Integer)) }
95
101
  attr_reader :orders_count
96
102
  sig { returns(T.nilable(String)) }
103
+ attr_reader :password
104
+ sig { returns(T.nilable(String)) }
105
+ attr_reader :password_confirmation
106
+ sig { returns(T.nilable(String)) }
97
107
  attr_reader :phone
108
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
109
+ attr_reader :sms_marketing_consent
98
110
  sig { returns(T.nilable(String)) }
99
111
  attr_reader :state
100
112
  sig { returns(T.nilable(String)) }