Class: ShopifyAPI::Metafield

Inherits:
Rest::Base show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/rest/resources/2022_04/metafield.rb,
lib/shopify_api/rest/resources/2022_07/metafield.rb,
lib/shopify_api/rest/resources/2022_10/metafield.rb,
lib/shopify_api/rest/resources/2023_01/metafield.rb,
lib/shopify_api/rest/resources/2023_04/metafield.rb,
lib/shopify_api/rest/resources/2023_07/metafield.rb,
lib/shopify_api/rest/resources/2023_10/metafield.rb,
lib/shopify_api/rest/resources/2024_01/metafield.rb,
lib/shopify_api/rest/resources/2024_04/metafield.rb,
lib/shopify_api/rest/resources/2024_07/metafield.rb,
lib/shopify_api/rest/resources/2024_10/metafield.rb

Instance Attribute Summary collapse

Attributes inherited from Rest::Base

#errors, #original_state

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Rest::Base

api_call_limit, base_find, class_name, create_instance, create_instances_from_response, #delete, get_path, get_path_ids, has_many?, has_one?, inherited, json_body_name, json_response_body_names, #method_missing, next_page?, next_page_info, prev_page?, prev_page_info, primary_key, read_only_attributes, request, #respond_to_missing?, retry_request_after, #save, #save!, #to_hash

Constructor Details

#initialize(session: ShopifyAPI::Context.active_session, from_hash: nil) ⇒ Metafield

Returns a new instance of Metafield.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 19

def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)

  @key = T.let(nil, T.nilable(String))
  @namespace = T.let(nil, T.nilable(String))
  @value = T.let(nil, T.nilable(T.any(String, Integer, Float, T::Boolean, String)))
  @article_id = T.let(nil, T.nilable(Integer))
  @blog_id = T.let(nil, T.nilable(Integer))
  @collection_id = T.let(nil, T.nilable(Integer))
  @created_at = T.let(nil, T.nilable(String))
  @customer_id = T.let(nil, T.nilable(Integer))
  @description = T.let(nil, T.nilable(String))
  @draft_order_id = T.let(nil, T.nilable(Integer))
  @id = T.let(nil, T.nilable(Integer))
  @order_id = T.let(nil, T.nilable(Integer))
  @owner_id = T.let(nil, T.nilable(Integer))
  @owner_resource = T.let(nil, T.nilable(String))
  @page_id = T.let(nil, T.nilable(Integer))
  @product_id = T.let(nil, T.nilable(Integer))
  @product_image_id = T.let(nil, T.nilable(Integer))
  @type = T.let(nil, T.nilable(String))
  @updated_at = T.let(nil, T.nilable(String))
  @variant_id = T.let(nil, T.nilable(Integer))

  super(session: session, from_hash: from_hash)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ShopifyAPI::Rest::Base

Instance Attribute Details

#article_idObject (readonly)

Returns the value of attribute article_id.



129
130
131
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 129

def article_id
  @article_id
end

#blog_idObject (readonly)

Returns the value of attribute blog_id.



131
132
133
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 131

def blog_id
  @blog_id
end

#collection_idObject (readonly)

Returns the value of attribute collection_id.



133
134
135
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 133

def collection_id
  @collection_id
end

#created_atObject (readonly)

Returns the value of attribute created_at.



135
136
137
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 135

def created_at
  @created_at
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



137
138
139
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 137

def customer_id
  @customer_id
end

#descriptionObject (readonly)

Returns the value of attribute description.



139
140
141
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 139

def description
  @description
end

#draft_order_idObject (readonly)

Returns the value of attribute draft_order_id.



141
142
143
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 141

def draft_order_id
  @draft_order_id
end

#idObject (readonly)

Returns the value of attribute id.



143
144
145
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 143

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



123
124
125
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 123

def key
  @key
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



125
126
127
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 125

def namespace
  @namespace
end

#order_idObject (readonly)

Returns the value of attribute order_id.



145
146
147
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 145

def order_id
  @order_id
end

#owner_idObject (readonly)

Returns the value of attribute owner_id.



147
148
149
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 147

def owner_id
  @owner_id
end

#owner_resourceObject (readonly)

Returns the value of attribute owner_resource.



149
150
151
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 149

def owner_resource
  @owner_resource
end

#page_idObject (readonly)

Returns the value of attribute page_id.



151
152
153
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 151

def page_id
  @page_id
end

#product_idObject (readonly)

Returns the value of attribute product_id.



153
154
155
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 153

def product_id
  @product_id
end

#product_image_idObject (readonly)

Returns the value of attribute product_image_id.



155
156
157
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 155

def product_image_id
  @product_image_id
end

#typeObject (readonly)

Returns the value of attribute type.



157
158
159
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 157

def type
  @type
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



159
160
161
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 159

def updated_at
  @updated_at
end

#valueObject (readonly)

Returns the value of attribute value.



127
128
129
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 127

def value
  @value
end

#variant_idObject (readonly)

Returns the value of attribute variant_id.



161
162
163
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 161

def variant_id
  @variant_id
end

Class Method Details

.all(article_id: nil, blog_id: nil, collection_id: nil, customer_id: nil, draft_order_id: nil, order_id: nil, page_id: nil, product_image_id: nil, product_id: nil, variant_id: nil, limit: nil, since_id: nil, created_at_min: nil, created_at_max: nil, updated_at_min: nil, updated_at_max: nil, namespace: nil, key: nil, type: nil, fields: nil, metafield: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 270

def all(
  article_id: nil,
  blog_id: nil,
  collection_id: nil,
  customer_id: nil,
  draft_order_id: nil,
  order_id: nil,
  page_id: nil,
  product_image_id: nil,
  product_id: nil,
  variant_id: nil,
  limit: nil,
  since_id: nil,
  created_at_min: nil,
  created_at_max: nil,
  updated_at_min: nil,
  updated_at_max: nil,
  namespace: nil,
  key: nil,
  type: nil,
  fields: nil,
  metafield: nil,
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  response = base_find(
    session: session,
    ids: {article_id: article_id, blog_id: blog_id, collection_id: collection_id, customer_id: customer_id, draft_order_id: draft_order_id, order_id: order_id, page_id: page_id, product_image_id: product_image_id, product_id: product_id, variant_id: variant_id},
    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, namespace: namespace, key: key, type: type, fields: fields, metafield: metafield}.merge(kwargs).compact,
  )

  T.cast(response, T::Array[Metafield])
end

.count(article_id: nil, blog_id: nil, collection_id: nil, customer_id: nil, draft_order_id: nil, order_id: nil, page_id: nil, product_image_id: nil, product_id: nil, variant_id: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 320

def count(
  article_id: nil,
  blog_id: nil,
  collection_id: nil,
  customer_id: nil,
  draft_order_id: nil,
  order_id: nil,
  page_id: nil,
  product_image_id: nil,
  product_id: nil,
  variant_id: nil,
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  request(
    http_method: :get,
    operation: :count,
    session: session,
    ids: {article_id: article_id, blog_id: blog_id, collection_id: collection_id, customer_id: customer_id, draft_order_id: draft_order_id, order_id: order_id, page_id: page_id, product_image_id: product_image_id, product_id: product_id, variant_id: variant_id},
    params: {}.merge(kwargs).compact,
    body: {},
    entity: nil,
  )
end

.delete(id:, article_id: nil, blog_id: nil, collection_id: nil, customer_id: nil, draft_order_id: nil, order_id: nil, page_id: nil, product_image_id: nil, product_id: nil, variant_id: nil, session: ShopifyAPI::Context.active_session) ⇒ Object



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 220

def delete(
  id:,
  article_id: nil,
  blog_id: nil,
  collection_id: nil,
  customer_id: nil,
  draft_order_id: nil,
  order_id: nil,
  page_id: nil,
  product_image_id: nil,
  product_id: nil,
  variant_id: nil,
  session: ShopifyAPI::Context.active_session
)
  request(
    http_method: :delete,
    operation: :delete,
    session: session,
    ids: {id: id, article_id: article_id, blog_id: blog_id, collection_id: collection_id, customer_id: customer_id, draft_order_id: draft_order_id, order_id: order_id, page_id: page_id, product_image_id: product_image_id, product_id: product_id, variant_id: variant_id},
    params: {},
  )
end

.find(id:, article_id: nil, blog_id: nil, collection_id: nil, customer_id: nil, draft_order_id: nil, order_id: nil, page_id: nil, product_image_id: nil, product_id: nil, variant_id: nil, fields: nil, session: ShopifyAPI::Context.active_session) ⇒ Object



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 181

def find(
  id:,
  article_id: nil,
  blog_id: nil,
  collection_id: nil,
  customer_id: nil,
  draft_order_id: nil,
  order_id: nil,
  page_id: nil,
  product_image_id: nil,
  product_id: nil,
  variant_id: nil,
  fields: nil,
  session: ShopifyAPI::Context.active_session
)
  result = base_find(
    session: session,
    ids: {id: id, article_id: article_id, blog_id: blog_id, collection_id: collection_id, customer_id: customer_id, draft_order_id: draft_order_id, order_id: order_id, page_id: page_id, product_image_id: product_image_id, product_id: product_id, variant_id: variant_id},
    params: {fields: fields},
  )
  T.cast(result[0], T.nilable(Metafield))
end