Class: Zernio::MetaCatalogProduct

Inherits:
ApiModelBase show all
Defined in:
lib/zernio-sdk/models/meta_catalog_product.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ MetaCatalogProduct

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
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
293
294
295
296
297
298
299
300
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 177

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::MetaCatalogProduct` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::MetaCatalogProduct`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'retailer_id')
    self.retailer_id = attributes[:'retailer_id']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.key?(:'url')
    self.url = attributes[:'url']
  end

  if attributes.key?(:'image_url')
    self.image_url = attributes[:'image_url']
  end

  if attributes.key?(:'additional_image_urls')
    if (value = attributes[:'additional_image_urls']).is_a?(Array)
      self.additional_image_urls = value
    end
  end

  if attributes.key?(:'price')
    self.price = attributes[:'price']
  end

  if attributes.key?(:'sale_price')
    self.sale_price = attributes[:'sale_price']
  end

  if attributes.key?(:'currency')
    self.currency = attributes[:'currency']
  end

  if attributes.key?(:'availability')
    self.availability = attributes[:'availability']
  end

  if attributes.key?(:'condition')
    self.condition = attributes[:'condition']
  end

  if attributes.key?(:'brand')
    self.brand = attributes[:'brand']
  end

  if attributes.key?(:'category')
    self.category = attributes[:'category']
  end

  if attributes.key?(:'product_type')
    self.product_type = attributes[:'product_type']
  end

  if attributes.key?(:'gtin')
    self.gtin = attributes[:'gtin']
  end

  if attributes.key?(:'inventory')
    self.inventory = attributes[:'inventory']
  end

  if attributes.key?(:'visibility')
    self.visibility = attributes[:'visibility']
  end

  if attributes.key?(:'color')
    self.color = attributes[:'color']
  end

  if attributes.key?(:'size')
    self.size = attributes[:'size']
  end

  if attributes.key?(:'gender')
    self.gender = attributes[:'gender']
  end

  if attributes.key?(:'material')
    self.material = attributes[:'material']
  end

  if attributes.key?(:'pattern')
    self.pattern = attributes[:'pattern']
  end

  if attributes.key?(:'custom_labels')
    if (value = attributes[:'custom_labels']).is_a?(Array)
      self.custom_labels = value
    end
  end

  if attributes.key?(:'review_status')
    self.review_status = attributes[:'review_status']
  end

  if attributes.key?(:'review_rejection_reasons')
    if (value = attributes[:'review_rejection_reasons']).is_a?(Array)
      self.review_rejection_reasons = value
    end
  end
end

Instance Attribute Details

#additional_image_urlsObject

Returns the value of attribute additional_image_urls.



31
32
33
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 31

def additional_image_urls
  @additional_image_urls
end

#availabilityObject

Returns the value of attribute availability.



40
41
42
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 40

def availability
  @availability
end

#brandObject

Returns the value of attribute brand.



44
45
46
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 44

def brand
  @brand
end

#categoryObject

Returns the value of attribute category.



46
47
48
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 46

def category
  @category
end

#colorObject

Returns the value of attribute color.



56
57
58
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 56

def color
  @color
end

#conditionObject

Returns the value of attribute condition.



42
43
44
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 42

def condition
  @condition
end

#currencyObject

Returns the value of attribute currency.



38
39
40
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 38

def currency
  @currency
end

#custom_labelsObject

custom_label_0 to custom_label_4



67
68
69
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 67

def custom_labels
  @custom_labels
end

#descriptionObject

Returns the value of attribute description.



25
26
27
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 25

def description
  @description
end

#genderObject

Returns the value of attribute gender.



60
61
62
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 60

def gender
  @gender
end

#gtinObject

Returns the value of attribute gtin.



50
51
52
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 50

def gtin
  @gtin
end

#idObject

Meta product item ID (use in the product endpoints)



19
20
21
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 19

def id
  @id
end

#image_urlObject

Returns the value of attribute image_url.



29
30
31
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 29

def image_url
  @image_url
end

#inventoryObject

Returns the value of attribute inventory.



52
53
54
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 52

def inventory
  @inventory
end

#materialObject

Returns the value of attribute material.



62
63
64
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 62

def material
  @material
end

#nameObject

Returns the value of attribute name.



23
24
25
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 23

def name
  @name
end

#patternObject

Returns the value of attribute pattern.



64
65
66
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 64

def pattern
  @pattern
end

#priceObject

Formatted by Meta, e.g. "€49.90"



34
35
36
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 34

def price
  @price
end

#product_typeObject

Returns the value of attribute product_type.



48
49
50
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 48

def product_type
  @product_type
end

#retailer_idObject

Returns the value of attribute retailer_id.



21
22
23
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 21

def retailer_id
  @retailer_id
end

#review_rejection_reasonsObject

Returns the value of attribute review_rejection_reasons.



72
73
74
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 72

def review_rejection_reasons
  @review_rejection_reasons
end

#review_statusObject

Meta's commerce review status (approved, rejected, pending, ...)



70
71
72
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 70

def review_status
  @review_status
end

#sale_priceObject

Returns the value of attribute sale_price.



36
37
38
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 36

def sale_price
  @sale_price
end

#sizeObject

Returns the value of attribute size.



58
59
60
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 58

def size
  @size
end

#urlObject

Returns the value of attribute url.



27
28
29
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 27

def url
  @url
end

#visibilityObject

Returns the value of attribute visibility.



54
55
56
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 54

def visibility
  @visibility
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



107
108
109
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 107

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



112
113
114
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 112

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 75

def self.attribute_map
  {
    :'id' => :'id',
    :'retailer_id' => :'retailerId',
    :'name' => :'name',
    :'description' => :'description',
    :'url' => :'url',
    :'image_url' => :'imageUrl',
    :'additional_image_urls' => :'additionalImageUrls',
    :'price' => :'price',
    :'sale_price' => :'salePrice',
    :'currency' => :'currency',
    :'availability' => :'availability',
    :'condition' => :'condition',
    :'brand' => :'brand',
    :'category' => :'category',
    :'product_type' => :'productType',
    :'gtin' => :'gtin',
    :'inventory' => :'inventory',
    :'visibility' => :'visibility',
    :'color' => :'color',
    :'size' => :'size',
    :'gender' => :'gender',
    :'material' => :'material',
    :'pattern' => :'pattern',
    :'custom_labels' => :'customLabels',
    :'review_status' => :'reviewStatus',
    :'review_rejection_reasons' => :'reviewRejectionReasons'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 365

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 149

def self.openapi_nullable
  Set.new([
    :'retailer_id',
    :'description',
    :'url',
    :'image_url',
    :'price',
    :'sale_price',
    :'currency',
    :'availability',
    :'condition',
    :'brand',
    :'category',
    :'product_type',
    :'gtin',
    :'inventory',
    :'visibility',
    :'color',
    :'size',
    :'gender',
    :'material',
    :'pattern',
    :'review_status',
  ])
end

.openapi_typesObject

Attribute type mapping.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 117

def self.openapi_types
  {
    :'id' => :'String',
    :'retailer_id' => :'String',
    :'name' => :'String',
    :'description' => :'String',
    :'url' => :'String',
    :'image_url' => :'String',
    :'additional_image_urls' => :'Array<String>',
    :'price' => :'String',
    :'sale_price' => :'String',
    :'currency' => :'String',
    :'availability' => :'String',
    :'condition' => :'String',
    :'brand' => :'String',
    :'category' => :'String',
    :'product_type' => :'String',
    :'gtin' => :'String',
    :'inventory' => :'Integer',
    :'visibility' => :'String',
    :'color' => :'String',
    :'size' => :'String',
    :'gender' => :'String',
    :'material' => :'String',
    :'pattern' => :'String',
    :'custom_labels' => :'Array<String>',
    :'review_status' => :'String',
    :'review_rejection_reasons' => :'Array<String>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 319

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      retailer_id == o.retailer_id &&
      name == o.name &&
      description == o.description &&
      url == o.url &&
      image_url == o.image_url &&
      additional_image_urls == o.additional_image_urls &&
      price == o.price &&
      sale_price == o.sale_price &&
      currency == o.currency &&
      availability == o.availability &&
      condition == o.condition &&
      brand == o.brand &&
      category == o.category &&
      product_type == o.product_type &&
      gtin == o.gtin &&
      inventory == o.inventory &&
      visibility == o.visibility &&
      color == o.color &&
      size == o.size &&
      gender == o.gender &&
      material == o.material &&
      pattern == o.pattern &&
      custom_labels == o.custom_labels &&
      review_status == o.review_status &&
      review_rejection_reasons == o.review_rejection_reasons
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


352
353
354
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 352

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



358
359
360
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 358

def hash
  [id, retailer_id, name, description, url, image_url, additional_image_urls, price, sale_price, currency, availability, condition, brand, category, product_type, gtin, inventory, visibility, color, size, gender, material, pattern, custom_labels, review_status, review_rejection_reasons].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



304
305
306
307
308
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 304

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 387

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



312
313
314
315
# File 'lib/zernio-sdk/models/meta_catalog_product.rb', line 312

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end