shopify_api 10.0.0 → 10.0.1

Sign up to get free protection for your applications and to get access to all the features.
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.1)
5
5
  concurrent-ruby
6
6
  hash_diff
7
7
  httparty
@@ -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
@@ -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
 
@@ -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
@@ -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
 
@@ -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
@@ -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
 
@@ -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
@@ -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
 
@@ -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
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module ShopifyAPI
5
- VERSION = "10.0.0"
5
+ VERSION = "10.0.1"
6
6
  end