shopify_api 10.0.0 → 10.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.github/pull_request_template.md +2 -2
  3. data/.github/workflows/build.yml +1 -0
  4. data/CHANGELOG.md +238 -212
  5. data/Gemfile.lock +6 -6
  6. data/README.md +2 -6
  7. data/RELEASING.md +18 -0
  8. data/Rakefile +1 -1
  9. data/docs/usage/rest.md +5 -5
  10. data/lib/shopify_api/admin_versions.rb +14 -9
  11. data/lib/shopify_api/auth/jwt_payload.rb +6 -3
  12. data/lib/shopify_api/context.rb +2 -2
  13. data/lib/shopify_api/rest/base.rb +73 -31
  14. data/lib/shopify_api/rest/resources/2021_07/abandoned_checkout.rb +3 -4
  15. data/lib/shopify_api/rest/resources/2021_07/article.rb +9 -2
  16. data/lib/shopify_api/rest/resources/2021_07/gift_card_adjustment.rb +1 -1
  17. data/lib/shopify_api/rest/resources/2021_07/variant.rb +6 -2
  18. data/lib/shopify_api/rest/resources/2021_10/abandoned_checkout.rb +3 -4
  19. data/lib/shopify_api/rest/resources/2021_10/article.rb +9 -2
  20. data/lib/shopify_api/rest/resources/2021_10/gift_card_adjustment.rb +1 -1
  21. data/lib/shopify_api/rest/resources/2021_10/variant.rb +6 -2
  22. data/lib/shopify_api/rest/resources/2022_01/abandoned_checkout.rb +3 -4
  23. data/lib/shopify_api/rest/resources/2022_01/article.rb +9 -2
  24. data/lib/shopify_api/rest/resources/2022_01/gift_card_adjustment.rb +1 -1
  25. data/lib/shopify_api/rest/resources/2022_01/variant.rb +6 -2
  26. data/lib/shopify_api/rest/resources/2022_04/abandoned_checkout.rb +3 -4
  27. data/lib/shopify_api/rest/resources/2022_04/article.rb +9 -2
  28. data/lib/shopify_api/rest/resources/2022_04/gift_card_adjustment.rb +1 -1
  29. data/lib/shopify_api/rest/resources/2022_04/variant.rb +6 -2
  30. data/lib/shopify_api/version.rb +1 -1
  31. metadata +3 -3
  32. data/RELEASING +0 -17
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify_api (10.0.0)
4
+ shopify_api (10.0.3)
5
5
  concurrent-ruby
6
6
  hash_diff
7
7
  httparty
@@ -79,11 +79,11 @@ GEM
79
79
  rubocop (>= 0.90.0)
80
80
  ruby-progressbar (1.11.0)
81
81
  securerandom (0.2.0)
82
- sorbet (0.5.9623)
83
- sorbet-static (= 0.5.9623)
84
- sorbet-runtime (0.5.9619)
85
- sorbet-static (0.5.9623-universal-darwin-21)
86
- sorbet-static (0.5.9623-x86_64-linux)
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
87
  spoom (1.1.8)
88
88
  sorbet (>= 0.5.9204)
89
89
  sorbet-runtime (>= 0.5.9204)
data/README.md CHANGED
@@ -4,12 +4,6 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
5
5
  ![Build Status](https://github.com/Shopify/shopify_api/workflows/CI/badge.svg?branch=main)
6
6
 
7
- ## A Note About Versions
8
-
9
- The latest release of `shopify_api` is v9. The main branch of this repo reflects the upcoming v10 release, which has some major changes. If you’re looking for the documentation / instructions for v9, you can find them [in this branch](https://github.com/Shopify/shopify_api/tree/v9).
10
-
11
- ## v10
12
-
13
7
  This library provides support for Ruby [Shopify apps](https://apps.shopify.com/) to access the [Shopify Admin API](https://shopify.dev/api/admin), by making it easier to perform the following actions:
14
8
 
15
9
  - Creating [online](https://shopify.dev/concepts/about-apis/authentication#online-access) or [offline](https://shopify.dev/concepts/about-apis/authentication#offline-access) access tokens for the Admin API via OAuth
@@ -21,6 +15,8 @@ In addition to the Admin API, this library also allows querying the [Storefront
21
15
 
22
16
  You can use this library in any application that has a Ruby backend, since it doesn't rely on any specific framework — you can include it alongside your preferred stack and use the features that you need to build your app.
23
17
 
18
+ **Note**: These instructions apply to v10 or later of this package. If you're running v9 in your app, you can find the documentation [in this branch](https://github.com/Shopify/shopify_api/tree/v9).
19
+
24
20
  ## Requirements
25
21
 
26
22
  To follow these usage guides, you will need to:
data/RELEASING.md ADDED
@@ -0,0 +1,18 @@
1
+ # Releasing ShopifyAPI
2
+
3
+ 1. Before releasing, make sure `sorbet` and `sorbet-runtime` are up to date
4
+ 1. Check the Semantic Versioning page for info on how to version the new release: http://semver.org
5
+ 1. Update the version of ShopifyAPI in lib/shopify_api/version.rb
6
+ 1. Run `bundle`
7
+ 1. Add a CHANGELOG entry for the new release
8
+ 1. Commit the changes with a commit message like "Packaging for release X.Y.Z"
9
+ 1. Tag the release with the version (Leave REV blank for HEAD or provide a SHA)
10
+ $ git tag vX.Y.Z REV
11
+ 1. Push out the changes
12
+ $ git push
13
+ 1. Push out the tags
14
+ $ git push --tags
15
+ 1. Publish the gem using Shipit
16
+ 1. Consider if the dependency in Shopify/shopify needs updated. It's used only by the tests so is a low risk change.
17
+ Also consider Shopify/shopify_app whose gemspec depends on this.
18
+ We don't need to do this for every release, but we should try to keep them relatively up to date.
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ namespace :test do
11
11
 
12
12
  Rake::TestTask.new(:rest_wrappers) do |t|
13
13
  pattern = if ENV.key?("API_VERSION")
14
- "test/rest/**/#{ENV["API_VERSION"]}/*.rb"
14
+ "test/rest/**/#{ENV.fetch("API_VERSION")}/*.rb"
15
15
  else
16
16
  "test/rest/**/*.rb"
17
17
  end
data/docs/usage/rest.md CHANGED
@@ -22,7 +22,7 @@ The Rest Admin client offers the 4 core request methods: `get`, `delete`, `post`
22
22
 
23
23
  ```ruby
24
24
  # Load the current session to get the `accessToken`.
25
- session = ShopifyAPI::Auth::SessionLoader.load_current_session(headers, cookies, is_online)
25
+ session = ShopifyAPI::Utils::SessionUtils.load_current_session(headers, cookies, is_online)
26
26
 
27
27
  # Create a new client.
28
28
  client = ShopifyAPI::Clients::Rest::Admin.new(session: session)
@@ -38,7 +38,7 @@ some_function(response.body)
38
38
 
39
39
  ```ruby
40
40
  # Load the current session to get the `accessToken`.
41
- session = ShopifyAPI::Auth::SessionLoader.load_current_session(headers, cookies, is_online)
41
+ session = ShopifyAPI::Utils::SessionUtils.load_current_session(headers, cookies, is_online)
42
42
 
43
43
  # Create a new client.
44
44
  client = ShopifyAPI::Clients::Rest::Admin.new(session: session)
@@ -71,7 +71,7 @@ After making a request, the `next_page_info` and `prev_page_info` can be found o
71
71
  An example of this is shown below:
72
72
 
73
73
  ```ruby
74
- session = ShopifyAPI::Auth::SessionLoader.load_current_session(headers, cookies, is_online)
74
+ session = ShopifyAPI::Utils::SessionUtils.load_current_session(headers, cookies, is_online)
75
75
  client = ShopifyAPI::Clients::Rest::Admin.new(session: session)
76
76
 
77
77
  response = client.get(path: "products", query: { limit: 10 })
@@ -88,7 +88,7 @@ Similarly, when using REST resources the `next_page_info` and `prev_page_info` c
88
88
  An example of this is shown below:
89
89
 
90
90
  ```ruby
91
- session = ShopifyAPI::Auth::SessionLoader.load_current_session(headers, cookies, is_online)
91
+ session = ShopifyAPI::Utils::SessionUtils.load_current_session(headers, cookies, is_online)
92
92
 
93
93
  products = ShopifyAPI::Product.all(session: session, limit: 10)
94
94
 
@@ -104,7 +104,7 @@ The next/previous page_info strings can also be retrieved from the response obje
104
104
  An example of this is shown below:
105
105
 
106
106
  ```ruby
107
- session = ShopifyAPI::Auth::SessionLoader.load_current_session(headers, cookies, is_online)
107
+ session = ShopifyAPI::Utils::SessionUtils.load_current_session(headers, cookies, is_online)
108
108
  client = ShopifyAPI::Clients::Rest::Admin.new(session: session)
109
109
 
110
110
  response = client.get(path: "products", query: { limit: 10 })
@@ -2,14 +2,19 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module ShopifyAPI
5
- SUPPORTED_ADMIN_VERSIONS = T.let([
6
- "unstable",
7
- "2022-04",
8
- "2022-01",
9
- "2021-10",
10
- "2021-07",
11
- "2021-04",
12
- ], T::Array[String])
5
+ module AdminVersions
6
+ SUPPORTED_ADMIN_VERSIONS = T.let([
7
+ "unstable",
8
+ "2022-04",
9
+ "2022-01",
10
+ "2021-10",
11
+ "2021-07",
12
+ "2021-04",
13
+ ], T::Array[String])
13
14
 
14
- LATEST_SUPPORTED_ADMIN_VERSION = T.let("2022-01", String)
15
+ LATEST_SUPPORTED_ADMIN_VERSION = T.let("2022-01", String)
16
+ end
17
+
18
+ SUPPORTED_ADMIN_VERSIONS = ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS
19
+ LATEST_SUPPORTED_ADMIN_VERSION = ShopifyAPI::AdminVersions::LATEST_SUPPORTED_ADMIN_VERSION
15
20
  end
@@ -35,8 +35,6 @@ module ShopifyAPI
35
35
 
36
36
  raise ShopifyAPI::Errors::InvalidJwtTokenError,
37
37
  "Session token had invalid API key" unless @aud == Context.api_key
38
- raise ShopifyAPI::Errors::InvalidJwtTokenError,
39
- "Session token had invalid shop" unless validate_shop(shop)
40
38
  end
41
39
 
42
40
  sig { returns(String) }
@@ -44,9 +42,14 @@ module ShopifyAPI
44
42
  @dest.gsub("https://", "")
45
43
  end
46
44
 
45
+ # TODO: Remove before releasing v11
47
46
  sig { params(shop: String).returns(T::Boolean) }
48
47
  def validate_shop(shop)
49
- /\A[a-z0-9]+[a-z0-9\-]*[a-z0-9]+\.myshopify\.(io|com)\z/.match?(shop)
48
+ Context.logger.warn(
49
+ "Deprecation notice: ShopifyAPI::Auth::JwtPayload.validate_shop no longer checks the given shop and always " \
50
+ "returns true. It will be removed in v11."
51
+ )
52
+ true
50
53
  end
51
54
 
52
55
  alias_method :eql?, :==
@@ -52,9 +52,9 @@ module ShopifyAPI
52
52
  private_shop: nil,
53
53
  user_agent_prefix: nil
54
54
  )
55
- unless SUPPORTED_ADMIN_VERSIONS.include?(api_version)
55
+ unless ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS.include?(api_version)
56
56
  raise Errors::UnsupportedVersionError,
57
- "Invalid vession #{api_version}, supported versions: #{SUPPORTED_ADMIN_VERSIONS}"
57
+ "Invalid vession #{api_version}, supported versions: #{ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS}"
58
58
  end
59
59
 
60
60
  @api_key = api_key
@@ -15,6 +15,8 @@ module ShopifyAPI
15
15
  @has_many = T.let({}, T::Hash[Symbol, Class])
16
16
  @paths = T.let([], T::Array[T::Hash[Symbol, T.any(T::Array[Symbol], String, Symbol)]])
17
17
  @custom_prefix = T.let(nil, T.nilable(String))
18
+ @read_only_attributes = T.let([], T.nilable(T::Array[Symbol]))
19
+ @aliased_properties = T.let({}, T::Hash[String, String])
18
20
 
19
21
  sig { returns(T::Hash[Symbol, T.untyped]) }
20
22
  attr_accessor :original_state
@@ -32,6 +34,7 @@ module ShopifyAPI
32
34
  @original_state = T.let({}, T::Hash[Symbol, T.untyped])
33
35
  @custom_prefix = T.let(nil, T.nilable(String))
34
36
  @forced_nils = T.let({}, T::Hash[String, T::Boolean])
37
+ @aliased_properties = T.let({}, T::Hash[String, String])
35
38
 
36
39
  session ||= ShopifyAPI::Context.active_session
37
40
 
@@ -42,7 +45,7 @@ module ShopifyAPI
42
45
  @errors = T.let(Rest::BaseErrors.new, Rest::BaseErrors)
43
46
 
44
47
  from_hash&.each do |key, value|
45
- instance_variable_set("@#{key}", value)
48
+ set_property(key, value)
46
49
  end
47
50
  end
48
51
 
@@ -118,6 +121,11 @@ module ShopifyAPI
118
121
  @has_one.include?(attribute)
119
122
  end
120
123
 
124
+ sig { returns(T.nilable(T::Array[Symbol])) }
125
+ def read_only_attributes
126
+ @read_only_attributes&.map { |a| :"@#{a}" }
127
+ end
128
+
121
129
  sig do
122
130
  params(
123
131
  http_method: Symbol,
@@ -209,24 +217,21 @@ module ShopifyAPI
209
217
  instance ||= new(session: session)
210
218
  instance.original_state = {}
211
219
 
212
- unless data.empty?
213
- # This retrieves all the setters on the resource and calls them with the data
214
- instance_methods(false).select { |method| !method.to_s.include?("=") }.each do |attribute|
215
- next unless data.key?(attribute.to_s)
216
-
217
- if has_many?(attribute) && data[attribute.to_s]
218
- attr_list = []
219
- data[attribute.to_s].each do |element|
220
- attr_list << T.unsafe(@has_many[attribute]).create_instance(data: element, session: session)
221
- end
222
- instance.public_send("#{attribute}=", attr_list)
223
- elsif has_one?(attribute) && data[attribute.to_s]
224
- instance.public_send("#{attribute}=",
225
- T.unsafe(@has_one[attribute]).create_instance(data: data[attribute.to_s], session: session))
226
- else
227
- instance.public_send("#{attribute}=", data[attribute.to_s])
228
- instance.original_state[attribute] = data[attribute.to_s]
220
+ data.each do |attribute, value|
221
+ attr_sym = attribute.to_sym
222
+
223
+ if has_many?(attr_sym) && value
224
+ attr_list = []
225
+ value.each do |element|
226
+ attr_list << T.unsafe(@has_many[attr_sym]).create_instance(data: element, session: session)
229
227
  end
228
+ instance.public_send("#{attribute}=", attr_list)
229
+ elsif has_one?(attr_sym) && value
230
+ instance.public_send("#{attribute}=",
231
+ T.unsafe(@has_one[attr_sym]).create_instance(data: value, session: session))
232
+ else
233
+ instance.public_send("#{attribute}=", value)
234
+ instance.original_state[attr_sym] = value
230
235
  end
231
236
  end
232
237
 
@@ -234,16 +239,18 @@ module ShopifyAPI
234
239
  end
235
240
  end
236
241
 
237
- sig { params(meth_id: Symbol, val: T.untyped).void }
242
+ sig { params(meth_id: Symbol, val: T.untyped).returns(T.untyped) }
238
243
  def method_missing(meth_id, val = nil)
239
- match = meth_id.id2name.match(/([^=]+)=/)
240
-
241
- return super unless match
244
+ match = meth_id.id2name.match(/([^=]+)(=)?/)
242
245
 
243
- var = match[1]
246
+ var = T.must(T.must(match)[1])
244
247
 
245
- instance_variable_set("@#{var}", val)
246
- @forced_nils[T.must(var)] = val.nil?
248
+ if T.must(match)[2]
249
+ set_property(var, val)
250
+ @forced_nils[var] = val.nil?
251
+ else
252
+ get_property(var)
253
+ end
247
254
  end
248
255
 
249
256
  sig { params(meth_id: Symbol, args: T.untyped).void }
@@ -258,17 +265,31 @@ module ShopifyAPI
258
265
  def to_hash
259
266
  hash = {}
260
267
  instance_variables.each do |var|
261
- next if [:"@original_state", :"@session", :"@client", :"@forced_nils", :"@errors"].include?(var)
268
+ next if [
269
+ :"@original_state",
270
+ :"@session",
271
+ :"@client",
272
+ :"@forced_nils",
273
+ :"@errors",
274
+ :"@aliased_properties",
275
+ ].include?(var)
276
+ next if self.class.read_only_attributes&.include?(var)
277
+
278
+ var = var.to_s.delete("@")
279
+ attribute = if @aliased_properties.value?(var)
280
+ T.must(@aliased_properties.key(var))
281
+ else
282
+ var
283
+ end.to_sym
262
284
 
263
- attribute = var.to_s.delete("@").to_sym
264
285
  if self.class.has_many?(attribute)
265
- hash[attribute.to_s] = instance_variable_get(var).map(&:to_hash).to_a if instance_variable_get(var)
286
+ hash[attribute.to_s] = get_property(attribute).map(&:to_hash).to_a if get_property(attribute)
266
287
  elsif self.class.has_one?(attribute)
267
- element_hash = instance_variable_get(var)&.to_hash
288
+ element_hash = get_property(attribute)&.to_hash
268
289
  hash[attribute.to_s] = element_hash if element_hash || @forced_nils[attribute.to_s]
269
- elsif !instance_variable_get(var).nil? || @forced_nils[attribute.to_s]
290
+ elsif !get_property(attribute).nil? || @forced_nils[attribute.to_s]
270
291
  hash[attribute.to_s] =
271
- instance_variable_get(var)
292
+ get_property(attribute)
272
293
  end
273
294
  end
274
295
  hash
@@ -313,6 +334,27 @@ module ShopifyAPI
313
334
  @errors.errors << e
314
335
  raise
315
336
  end
337
+
338
+ private
339
+
340
+ sig { params(key: T.any(String, Symbol), val: T.untyped).void }
341
+ def set_property(key, val)
342
+ # Some API fields contain invalid characters, like `?`, which causes issues when setting them as instance
343
+ # variables. To work around that, we're cleaning them up here but keeping track of the properties that were
344
+ # aliased this way. When loading up the property, we can map back from the "invalid" field so that it is
345
+ # transparent to outside callers
346
+ clean_key = key.to_s.gsub(/[\?\s]/, "")
347
+ @aliased_properties[key.to_s] = clean_key if clean_key != key
348
+
349
+ instance_variable_set("@#{clean_key}", val)
350
+ end
351
+
352
+ sig { params(key: T.any(String, Symbol)).returns(T.untyped) }
353
+ def get_property(key)
354
+ clean_key = @aliased_properties.key?(key.to_s) ? @aliased_properties[key.to_s] : key
355
+
356
+ instance_variable_get("@#{clean_key}")
357
+ end
316
358
  end
317
359
  end
318
360
  end
@@ -61,7 +61,6 @@ module ShopifyAPI
61
61
  discount_codes: DiscountCode
62
62
  }, T::Hash[Symbol, Class])
63
63
  @paths = T.let([
64
- {http_method: :get, operation: :checkouts, ids: [], path: "checkouts.json"},
65
64
  {http_method: :get, operation: :checkouts, ids: [], path: "checkouts.json"}
66
65
  ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
67
66
 
@@ -147,25 +146,25 @@ module ShopifyAPI
147
146
  class << self
148
147
  sig do
149
148
  params(
149
+ limit: T.untyped,
150
150
  since_id: T.untyped,
151
151
  created_at_min: T.untyped,
152
152
  created_at_max: T.untyped,
153
153
  updated_at_min: T.untyped,
154
154
  updated_at_max: T.untyped,
155
155
  status: T.untyped,
156
- limit: T.untyped,
157
156
  session: Auth::Session,
158
157
  kwargs: T.untyped
159
158
  ).returns(T.untyped)
160
159
  end
161
160
  def checkouts(
161
+ limit: nil,
162
162
  since_id: nil,
163
163
  created_at_min: nil,
164
164
  created_at_max: nil,
165
165
  updated_at_min: nil,
166
166
  updated_at_max: nil,
167
167
  status: nil,
168
- limit: nil,
169
168
  session: ShopifyAPI::Context.active_session,
170
169
  **kwargs
171
170
  )
@@ -174,7 +173,7 @@ module ShopifyAPI
174
173
  operation: :checkouts,
175
174
  session: session,
176
175
  ids: {},
177
- 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,
176
+ params: {limit: limit, 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}.merge(kwargs).compact,
178
177
  body: {},
179
178
  entity: nil,
180
179
  )
@@ -41,6 +41,7 @@ module ShopifyAPI
41
41
  {http_method: :get, operation: :get, ids: [:blog_id], path: "blogs/<blog_id>/articles.json"},
42
42
  {http_method: :get, operation: :get, ids: [:blog_id, :id], path: "blogs/<blog_id>/articles/<id>.json"},
43
43
  {http_method: :get, operation: :tags, ids: [], path: "articles/tags.json"},
44
+ {http_method: :get, operation: :tags, ids: [:blog_id], path: "blogs/<blog_id>/articles/tags.json"},
44
45
  {http_method: :post, operation: :post, ids: [:blog_id], path: "blogs/<blog_id>/articles.json"},
45
46
  {http_method: :put, operation: :put, ids: [:blog_id, :id], path: "blogs/<blog_id>/articles/<id>.json"}
46
47
  ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
@@ -229,11 +230,17 @@ module ShopifyAPI
229
230
 
230
231
  sig do
231
232
  params(
233
+ blog_id: T.nilable(T.any(Integer, String)),
234
+ limit: T.untyped,
235
+ popular: T.untyped,
232
236
  session: Auth::Session,
233
237
  kwargs: T.untyped
234
238
  ).returns(T.untyped)
235
239
  end
236
240
  def tags(
241
+ blog_id: nil,
242
+ limit: nil,
243
+ popular: nil,
237
244
  session: ShopifyAPI::Context.active_session,
238
245
  **kwargs
239
246
  )
@@ -241,8 +248,8 @@ module ShopifyAPI
241
248
  http_method: :get,
242
249
  operation: :tags,
243
250
  session: session,
244
- ids: {},
245
- params: {}.merge(kwargs).compact,
251
+ ids: {blog_id: blog_id},
252
+ params: {limit: limit, popular: popular}.merge(kwargs).compact,
246
253
  body: {},
247
254
  entity: nil,
248
255
  )
@@ -30,7 +30,7 @@ module ShopifyAPI
30
30
  @has_many = T.let({}, T::Hash[Symbol, Class])
31
31
  @paths = T.let([
32
32
  {http_method: :get, operation: :get, ids: [:gift_card_id], path: "gift_cards/<gift_card_id>/adjustments.json"},
33
- {http_method: :get, operation: :get, ids: [:gift_card_id, :id], path: "gift_cards/<gift_card_id>/adjustments/2.json"},
33
+ {http_method: :get, operation: :get, ids: [:gift_card_id, :id], path: "gift_cards/<gift_card_id>/adjustments/<id>.json"},
34
34
  {http_method: :post, operation: :post, ids: [:gift_card_id], path: "gift_cards/<gift_card_id>/adjustments.json"}
35
35
  ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
36
36
 
@@ -36,7 +36,7 @@ module ShopifyAPI
36
36
  @taxable = T.let(nil, T.nilable(T::Boolean))
37
37
  @title = T.let(nil, T.nilable(String))
38
38
  @updated_at = T.let(nil, T.nilable(String))
39
- @weight = T.let(nil, T.nilable(Integer))
39
+ @weight = T.let(nil, T.nilable(Float))
40
40
  @weight_unit = T.let(nil, T.nilable(String))
41
41
  end
42
42
 
@@ -50,6 +50,10 @@ module ShopifyAPI
50
50
  {http_method: :post, operation: :post, ids: [:product_id], path: "products/<product_id>/variants.json"},
51
51
  {http_method: :put, operation: :put, ids: [:id], path: "variants/<id>.json"}
52
52
  ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
53
+ @read_only_attributes = T.let([
54
+ :inventory_quantity,
55
+ :inventory_quantity_adjustment
56
+ ], T::Array[Symbol])
53
57
 
54
58
  sig { returns(T.nilable(String)) }
55
59
  attr_reader :barcode
@@ -99,7 +103,7 @@ module ShopifyAPI
99
103
  attr_reader :title
100
104
  sig { returns(T.nilable(String)) }
101
105
  attr_reader :updated_at
102
- sig { returns(T.nilable(Integer)) }
106
+ sig { returns(T.nilable(Float)) }
103
107
  attr_reader :weight
104
108
  sig { returns(T.nilable(String)) }
105
109
  attr_reader :weight_unit
@@ -61,7 +61,6 @@ module ShopifyAPI
61
61
  discount_codes: DiscountCode
62
62
  }, T::Hash[Symbol, Class])
63
63
  @paths = T.let([
64
- {http_method: :get, operation: :checkouts, ids: [], path: "checkouts.json"},
65
64
  {http_method: :get, operation: :checkouts, ids: [], path: "checkouts.json"}
66
65
  ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
67
66
 
@@ -147,25 +146,25 @@ module ShopifyAPI
147
146
  class << self
148
147
  sig do
149
148
  params(
149
+ limit: T.untyped,
150
150
  since_id: T.untyped,
151
151
  created_at_min: T.untyped,
152
152
  created_at_max: T.untyped,
153
153
  updated_at_min: T.untyped,
154
154
  updated_at_max: T.untyped,
155
155
  status: T.untyped,
156
- limit: T.untyped,
157
156
  session: Auth::Session,
158
157
  kwargs: T.untyped
159
158
  ).returns(T.untyped)
160
159
  end
161
160
  def checkouts(
161
+ limit: nil,
162
162
  since_id: nil,
163
163
  created_at_min: nil,
164
164
  created_at_max: nil,
165
165
  updated_at_min: nil,
166
166
  updated_at_max: nil,
167
167
  status: nil,
168
- limit: nil,
169
168
  session: ShopifyAPI::Context.active_session,
170
169
  **kwargs
171
170
  )
@@ -174,7 +173,7 @@ module ShopifyAPI
174
173
  operation: :checkouts,
175
174
  session: session,
176
175
  ids: {},
177
- 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,
176
+ params: {limit: limit, 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}.merge(kwargs).compact,
178
177
  body: {},
179
178
  entity: nil,
180
179
  )
@@ -41,6 +41,7 @@ module ShopifyAPI
41
41
  {http_method: :get, operation: :get, ids: [:blog_id], path: "blogs/<blog_id>/articles.json"},
42
42
  {http_method: :get, operation: :get, ids: [:blog_id, :id], path: "blogs/<blog_id>/articles/<id>.json"},
43
43
  {http_method: :get, operation: :tags, ids: [], path: "articles/tags.json"},
44
+ {http_method: :get, operation: :tags, ids: [:blog_id], path: "blogs/<blog_id>/articles/tags.json"},
44
45
  {http_method: :post, operation: :post, ids: [:blog_id], path: "blogs/<blog_id>/articles.json"},
45
46
  {http_method: :put, operation: :put, ids: [:blog_id, :id], path: "blogs/<blog_id>/articles/<id>.json"}
46
47
  ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
@@ -229,11 +230,17 @@ module ShopifyAPI
229
230
 
230
231
  sig do
231
232
  params(
233
+ blog_id: T.nilable(T.any(Integer, String)),
234
+ limit: T.untyped,
235
+ popular: T.untyped,
232
236
  session: Auth::Session,
233
237
  kwargs: T.untyped
234
238
  ).returns(T.untyped)
235
239
  end
236
240
  def tags(
241
+ blog_id: nil,
242
+ limit: nil,
243
+ popular: nil,
237
244
  session: ShopifyAPI::Context.active_session,
238
245
  **kwargs
239
246
  )
@@ -241,8 +248,8 @@ module ShopifyAPI
241
248
  http_method: :get,
242
249
  operation: :tags,
243
250
  session: session,
244
- ids: {},
245
- params: {}.merge(kwargs).compact,
251
+ ids: {blog_id: blog_id},
252
+ params: {limit: limit, popular: popular}.merge(kwargs).compact,
246
253
  body: {},
247
254
  entity: nil,
248
255
  )
@@ -30,7 +30,7 @@ module ShopifyAPI
30
30
  @has_many = T.let({}, T::Hash[Symbol, Class])
31
31
  @paths = T.let([
32
32
  {http_method: :get, operation: :get, ids: [:gift_card_id], path: "gift_cards/<gift_card_id>/adjustments.json"},
33
- {http_method: :get, operation: :get, ids: [:gift_card_id, :id], path: "gift_cards/<gift_card_id>/adjustments/2.json"},
33
+ {http_method: :get, operation: :get, ids: [:gift_card_id, :id], path: "gift_cards/<gift_card_id>/adjustments/<id>.json"},
34
34
  {http_method: :post, operation: :post, ids: [:gift_card_id], path: "gift_cards/<gift_card_id>/adjustments.json"}
35
35
  ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
36
36
 
@@ -36,7 +36,7 @@ module ShopifyAPI
36
36
  @taxable = T.let(nil, T.nilable(T::Boolean))
37
37
  @title = T.let(nil, T.nilable(String))
38
38
  @updated_at = T.let(nil, T.nilable(String))
39
- @weight = T.let(nil, T.nilable(Integer))
39
+ @weight = T.let(nil, T.nilable(Float))
40
40
  @weight_unit = T.let(nil, T.nilable(String))
41
41
  end
42
42
 
@@ -50,6 +50,10 @@ module ShopifyAPI
50
50
  {http_method: :post, operation: :post, ids: [:product_id], path: "products/<product_id>/variants.json"},
51
51
  {http_method: :put, operation: :put, ids: [:id], path: "variants/<id>.json"}
52
52
  ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
53
+ @read_only_attributes = T.let([
54
+ :inventory_quantity,
55
+ :inventory_quantity_adjustment
56
+ ], T::Array[Symbol])
53
57
 
54
58
  sig { returns(T.nilable(String)) }
55
59
  attr_reader :barcode
@@ -99,7 +103,7 @@ module ShopifyAPI
99
103
  attr_reader :title
100
104
  sig { returns(T.nilable(String)) }
101
105
  attr_reader :updated_at
102
- sig { returns(T.nilable(Integer)) }
106
+ sig { returns(T.nilable(Float)) }
103
107
  attr_reader :weight
104
108
  sig { returns(T.nilable(String)) }
105
109
  attr_reader :weight_unit
@@ -61,7 +61,6 @@ module ShopifyAPI
61
61
  discount_codes: DiscountCode
62
62
  }, T::Hash[Symbol, Class])
63
63
  @paths = T.let([
64
- {http_method: :get, operation: :checkouts, ids: [], path: "checkouts.json"},
65
64
  {http_method: :get, operation: :checkouts, ids: [], path: "checkouts.json"}
66
65
  ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
67
66
 
@@ -147,25 +146,25 @@ module ShopifyAPI
147
146
  class << self
148
147
  sig do
149
148
  params(
149
+ limit: T.untyped,
150
150
  since_id: T.untyped,
151
151
  created_at_min: T.untyped,
152
152
  created_at_max: T.untyped,
153
153
  updated_at_min: T.untyped,
154
154
  updated_at_max: T.untyped,
155
155
  status: T.untyped,
156
- limit: T.untyped,
157
156
  session: Auth::Session,
158
157
  kwargs: T.untyped
159
158
  ).returns(T.untyped)
160
159
  end
161
160
  def checkouts(
161
+ limit: nil,
162
162
  since_id: nil,
163
163
  created_at_min: nil,
164
164
  created_at_max: nil,
165
165
  updated_at_min: nil,
166
166
  updated_at_max: nil,
167
167
  status: nil,
168
- limit: nil,
169
168
  session: ShopifyAPI::Context.active_session,
170
169
  **kwargs
171
170
  )
@@ -174,7 +173,7 @@ module ShopifyAPI
174
173
  operation: :checkouts,
175
174
  session: session,
176
175
  ids: {},
177
- 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,
176
+ params: {limit: limit, 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}.merge(kwargs).compact,
178
177
  body: {},
179
178
  entity: nil,
180
179
  )