Class: ShopifyAPI::Metafield

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


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/shopify_api/rest/resources/2021_07/metafield.rb', line 12

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.


117
118
119
# File 'lib/shopify_api/rest/resources/2021_07/metafield.rb', line 117

def article_id
  @article_id
end

#blog_idObject (readonly)

Returns the value of attribute blog_id.


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

def blog_id
  @blog_id
end

#collection_idObject (readonly)

Returns the value of attribute collection_id.


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

def collection_id
  @collection_id
end

#created_atObject (readonly)

Returns the value of attribute created_at.


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

def created_at
  @created_at
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.


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

def customer_id
  @customer_id
end

#descriptionObject (readonly)

Returns the value of attribute description.


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

def description
  @description
end

#draft_order_idObject (readonly)

Returns the value of attribute draft_order_id.


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

def draft_order_id
  @draft_order_id
end

#idObject (readonly)

Returns the value of attribute id.


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

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.


111
112
113
# File 'lib/shopify_api/rest/resources/2021_07/metafield.rb', line 111

def key
  @key
end

#namespaceObject (readonly)

Returns the value of attribute namespace.


113
114
115
# File 'lib/shopify_api/rest/resources/2021_07/metafield.rb', line 113

def namespace
  @namespace
end

#order_idObject (readonly)

Returns the value of attribute order_id.


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

def order_id
  @order_id
end

#owner_idObject (readonly)

Returns the value of attribute owner_id.


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

def owner_id
  @owner_id
end

#owner_resourceObject (readonly)

Returns the value of attribute owner_resource.


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

def owner_resource
  @owner_resource
end

#page_idObject (readonly)

Returns the value of attribute page_id.


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

def page_id
  @page_id
end

#product_idObject (readonly)

Returns the value of attribute product_id.


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

def product_id
  @product_id
end

#product_image_idObject (readonly)

Returns the value of attribute product_image_id.


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

def product_image_id
  @product_image_id
end

#typeObject (readonly)

Returns the value of attribute type.


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

def type
  @type
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.


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

def updated_at
  @updated_at
end

#valueObject (readonly)

Returns the value of attribute value.


115
116
117
# File 'lib/shopify_api/rest/resources/2021_07/metafield.rb', line 115

def value
  @value
end

#value_typeObject (readonly)

Returns the value of attribute value_type.


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

def value_type
  @value_type
end

#variant_idObject (readonly)

Returns the value of attribute variant_id.


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

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, value_type: nil, fields: nil, metafield: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object


259
260
261
262
263
264
265
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
# File 'lib/shopify_api/rest/resources/2021_07/metafield.rb', line 259

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,
  value_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, value_type: value_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


310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/shopify_api/rest/resources/2021_07/metafield.rb', line 310

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


208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/shopify_api/rest/resources/2021_07/metafield.rb', line 208

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, session: ShopifyAPI::Context.active_session) ⇒ Object


170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/shopify_api/rest/resources/2021_07/metafield.rb', line 170

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,
  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: {},
  )
  T.cast(result[0], T.nilable(Metafield))
end