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

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, 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?, #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
# File 'lib/shopify_api/rest/resources/2022_04/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, 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))
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.



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

def article_id
  @article_id
end

#blog_idObject (readonly)

Returns the value of attribute blog_id.



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

def blog_id
  @blog_id
end

#collection_idObject (readonly)

Returns the value of attribute collection_id.



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

def collection_id
  @collection_id
end

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



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

def customer_id
  @customer_id
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#draft_order_idObject (readonly)

Returns the value of attribute draft_order_id.



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

def draft_order_id
  @draft_order_id
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



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

def key
  @key
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



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

def namespace
  @namespace
end

#order_idObject (readonly)

Returns the value of attribute order_id.



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

def order_id
  @order_id
end

#owner_idObject (readonly)

Returns the value of attribute owner_id.



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

def owner_id
  @owner_id
end

#owner_resourceObject (readonly)

Returns the value of attribute owner_resource.



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

def owner_resource
  @owner_resource
end

#page_idObject (readonly)

Returns the value of attribute page_id.



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

def page_id
  @page_id
end

#product_idObject (readonly)

Returns the value of attribute product_id.



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

def product_id
  @product_id
end

#product_image_idObject (readonly)

Returns the value of attribute product_image_id.



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

def product_image_id
  @product_image_id
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

#variant_idObject (readonly)

Returns the value of attribute variant_id.



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

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



266
267
268
269
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
# File 'lib/shopify_api/rest/resources/2022_04/metafield.rb', line 266

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



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

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



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

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



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

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