Class: ShopifyAPI::Metafield

Inherits:
Rest::Base show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/rest/resources/2022_01/metafield.rb,
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

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

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

Constructor Details

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

Returns a new instance of Metafield.



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

def initialize(session: ShopifyAPI::Context.active_session)
  super(session: session)

  @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)))
  @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))
  @value_type = T.let(nil, T.nilable(String))
  @variant_id = T.let(nil, T.nilable(Integer))
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.



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

def article_id
  @article_id
end

#blog_idObject (readonly)

Returns the value of attribute blog_id.



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

def blog_id
  @blog_id
end

#collection_idObject (readonly)

Returns the value of attribute collection_id.



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

def collection_id
  @collection_id
end

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



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

def customer_id
  @customer_id
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#draft_order_idObject (readonly)

Returns the value of attribute draft_order_id.



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

def draft_order_id
  @draft_order_id
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



120
121
122
# File 'lib/shopify_api/rest/resources/2022_01/metafield.rb', line 120

def key
  @key
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



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

def namespace
  @namespace
end

#order_idObject (readonly)

Returns the value of attribute order_id.



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

def order_id
  @order_id
end

#owner_idObject (readonly)

Returns the value of attribute owner_id.



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

def owner_id
  @owner_id
end

#owner_resourceObject (readonly)

Returns the value of attribute owner_resource.



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

def owner_resource
  @owner_resource
end

#page_idObject (readonly)

Returns the value of attribute page_id.



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

def page_id
  @page_id
end

#product_idObject (readonly)

Returns the value of attribute product_id.



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

def product_id
  @product_id
end

#product_image_idObject (readonly)

Returns the value of attribute product_image_id.



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

def product_image_id
  @product_image_id
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

#value_typeObject (readonly)

Returns the value of attribute value_type.



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

def value_type
  @value_type
end

#variant_idObject (readonly)

Returns the value of attribute variant_id.



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

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
303
# File 'lib/shopify_api/rest/resources/2022_01/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,
  value_type: 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, value_type: value_type, 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



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

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



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

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



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

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