Class: PinterestSdkClient::ItemAttributes

Inherits:
Object
  • Object
show all
Defined in:
lib/pinterest_sdk/models/item_attributes.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ItemAttributes

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 263

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

Allows advertisers to specify a separate URL that can be used to track traffic coming from Pinterest shopping ads. Must send full URL including tracking—do not send tracking parameters only. At this time we do not support impression tracking. Must begin with http:// or https://.



19
20
21
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 19

def ad_link
  @ad_link
end

The links to additional images for your product. Up to five additional images can be used to show a product from different angles or to show different stages. Separate each additional image with a comma. We recommend enclosing the whole string with quotes. Must begin with http:// or https://



22
23
24
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 22

def additional_image_link
  @additional_image_link
end

#adultObject

Set this attribute to TRUE if you’re submitting items that are considered “adult”. These will not be shown on Pinterest.



25
26
27
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 25

def adult
  @adult
end

#age_groupObject

The age group to apply a demographic range to the product. Must be one of the following values: ‘newborn’, ‘infant’, ‘toddler’, ‘kids’, ‘adult’.



28
29
30
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 28

def age_group
  @age_group
end

#availabilityObject

The availability of the product. Must be one of the following values: ‘in stock’, ‘out of stock’, ‘preorder’.



31
32
33
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 31

def availability
  @availability
end

#average_review_ratingObject

Average reviews for the item. Can be a number from 1-5.



34
35
36
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 34

def average_review_rating
  @average_review_rating
end

#brandObject

The brand of the product.



37
38
39
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 37

def brand
  @brand
end

#colorObject

The primary color of the product.



40
41
42
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 40

def color
  @color
end

#conditionObject

The condition of the product. Must be one of the following values: ‘new’, ‘used’, ‘refurbished’.



43
44
45
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 43

def condition
  @condition
end

#custom_label_0Object

Custom grouping of products.



46
47
48
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 46

def custom_label_0
  @custom_label_0
end

#custom_label_1Object

Custom grouping of products.



49
50
51
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 49

def custom_label_1
  @custom_label_1
end

#custom_label_2Object

Custom grouping of products.



52
53
54
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 52

def custom_label_2
  @custom_label_2
end

#custom_label_3Object

Custom grouping of products.



55
56
57
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 55

def custom_label_3
  @custom_label_3
end

#custom_label_4Object

Custom grouping of products.



58
59
60
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 58

def custom_label_4
  @custom_label_4
end

#descriptionObject

The description of the product.



61
62
63
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 61

def description
  @description
end

#free_shipping_labelObject

The item is free to ship.



64
65
66
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 64

def free_shipping_label
  @free_shipping_label
end

#free_shipping_limitObject

The minimum order purchase necessary for the customer to get free shipping. Only relevant if free shipping is offered.



67
68
69
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 67

def free_shipping_limit
  @free_shipping_limit
end

#genderObject

The gender associated with the product. Must be one of the following values: ‘male’, ‘female’, ‘unisex’.



70
71
72
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 70

def gender
  @gender
end

#google_product_categoryObject

The categorization of the product based on the standardized Google Product Taxonomy. This is a set taxonomy. Both the text values and numeric codes are accepted.



73
74
75
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 73

def google_product_category
  @google_product_category
end

#gtinObject

The unique universal product identifier.



76
77
78
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 76

def gtin
  @gtin
end

#idObject

The user-created unique ID that represents the product. Only Unicode characters are accepted.



79
80
81
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 79

def id
  @id
end

The link to the main product images. Images should be at least 75x75 pixels to avoid errors. Use the additional_image_link field to add more images of your product. The URL of your image_link must be accessible by the Pinterest user-agent, and send the accurate images. Please make sure there are no template or placeholder images at the link. Must start with http:// or https://



82
83
84
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 82

def image_link
  @image_link
end

#item_group_idObject

The parent ID of the product.



85
86
87
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 85

def item_group_id
  @item_group_id
end

#last_updated_timeObject

The millisecond timestamp when the item was lastly modified by the merchant.



88
89
90
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 88

def last_updated_time
  @last_updated_time
end

The landing page for the product.



91
92
93
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 91

def link
  @link
end

#materialObject

The material used to make the product.



94
95
96
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 94

def material
  @material
end

#min_ad_priceObject

The minimum advertised price of the product. It supports the following formats, "19.99 USD", "19.99USD" and "19.99". If the currency is not included, we default to US dollars.



97
98
99
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 97

def min_ad_price
  @min_ad_price
end

The mobile-optimized version of your landing page. Must begin with http:// or https://.



100
101
102
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 100

def mobile_link
  @mobile_link
end

#mpnObject

Manufacturer Part Number are alpha-numeric codes created by the manufacturer of a product to uniquely identify it among all products from the same manufacturer.



103
104
105
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 103

def mpn
  @mpn
end

#number_of_ratingsObject

The number of ratings for the item.



106
107
108
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 106

def number_of_ratings
  @number_of_ratings
end

#number_of_reviewsObject

The number of reviews available for the item.



109
110
111
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 109

def number_of_reviews
  @number_of_reviews
end

#patternObject

The description of the pattern used for the product.



112
113
114
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 112

def pattern
  @pattern
end

#priceObject

The price of the product. It supports the following formats, "24.99 USD", "24.99USD" and "24.99". If the currency is not included, we default to US dollars.



115
116
117
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 115

def price
  @price
end

#product_typeObject

The categorization of your product based on your custom product taxonomy. Subcategories must be sent separated by “ > “. The > must be wrapped by spaces. We do not recognize any other delimiters such as comma or pipe.



118
119
120
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 118

def product_type
  @product_type
end

#sale_priceObject

The discounted price of the product. The sale_price must be lower than the price. It supports the following formats, "14.99 USD", "14.99USD" and "14.99". If the currency is not included, we default to US dollars.



121
122
123
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 121

def sale_price
  @sale_price
end

#shippingObject

Shipping consists of one group of up to four elements, country, region, service (all optional) and price (required). All colons, even for blank values, are required.



124
125
126
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 124

def shipping
  @shipping
end

#shipping_heightObject

The height of the package needed to ship the product. Ensure there is a space between the numeric string and the metric.



127
128
129
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 127

def shipping_height
  @shipping_height
end

#shipping_weightObject

The weight of the product. Ensure there is a space between the numeric string and the metric.



130
131
132
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 130

def shipping_weight
  @shipping_weight
end

#shipping_widthObject

The width of the package needed to ship the product. Ensure there is a space between the numeric string and the metric.



133
134
135
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 133

def shipping_width
  @shipping_width
end

#sizeObject

The size of the product.



136
137
138
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 136

def size
  @size
end

#size_systemObject

Indicates the country’s sizing system in which you are submitting your product.



139
140
141
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 139

def size_system
  @size_system
end

#size_typeObject

Additional description for the size. Must be one of the following values: ‘regular’, ‘petite’, ‘plus’, ‘big_and_tall’, ‘maternity’.



142
143
144
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 142

def size_type
  @size_type
end

#taxObject

Tax consists of one group of up to four elements, country, region, rate (all required) and tax_ship (optional). All colons, even for blank values, are required.



145
146
147
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 145

def tax
  @tax
end

#titleObject

The name of the product.



148
149
150
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 148

def title
  @title
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



201
202
203
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 201

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 151

def self.attribute_map
  {
    :'ad_link' => :'ad_link',
    :'additional_image_link' => :'additional_image_link',
    :'adult' => :'adult',
    :'age_group' => :'age_group',
    :'availability' => :'availability',
    :'average_review_rating' => :'average_review_rating',
    :'brand' => :'brand',
    :'color' => :'color',
    :'condition' => :'condition',
    :'custom_label_0' => :'custom_label_0',
    :'custom_label_1' => :'custom_label_1',
    :'custom_label_2' => :'custom_label_2',
    :'custom_label_3' => :'custom_label_3',
    :'custom_label_4' => :'custom_label_4',
    :'description' => :'description',
    :'free_shipping_label' => :'free_shipping_label',
    :'free_shipping_limit' => :'free_shipping_limit',
    :'gender' => :'gender',
    :'google_product_category' => :'google_product_category',
    :'gtin' => :'gtin',
    :'id' => :'id',
    :'image_link' => :'image_link',
    :'item_group_id' => :'item_group_id',
    :'last_updated_time' => :'last_updated_time',
    :'link' => :'link',
    :'material' => :'material',
    :'min_ad_price' => :'min_ad_price',
    :'mobile_link' => :'mobile_link',
    :'mpn' => :'mpn',
    :'number_of_ratings' => :'number_of_ratings',
    :'number_of_reviews' => :'number_of_reviews',
    :'pattern' => :'pattern',
    :'price' => :'price',
    :'product_type' => :'product_type',
    :'sale_price' => :'sale_price',
    :'shipping' => :'shipping',
    :'shipping_height' => :'shipping_height',
    :'shipping_weight' => :'shipping_weight',
    :'shipping_width' => :'shipping_width',
    :'size' => :'size',
    :'size_system' => :'size_system',
    :'size_type' => :'size_type',
    :'tax' => :'tax',
    :'title' => :'title'
  }
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



716
717
718
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 716

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



256
257
258
259
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 256

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 206

def self.openapi_types
  {
    :'ad_link' => :'String',
    :'additional_image_link' => :'Array<String>',
    :'adult' => :'Boolean',
    :'age_group' => :'String',
    :'availability' => :'String',
    :'average_review_rating' => :'Float',
    :'brand' => :'String',
    :'color' => :'String',
    :'condition' => :'String',
    :'custom_label_0' => :'String',
    :'custom_label_1' => :'String',
    :'custom_label_2' => :'String',
    :'custom_label_3' => :'String',
    :'custom_label_4' => :'String',
    :'description' => :'String',
    :'free_shipping_label' => :'Boolean',
    :'free_shipping_limit' => :'String',
    :'gender' => :'String',
    :'google_product_category' => :'String',
    :'gtin' => :'Integer',
    :'id' => :'String',
    :'image_link' => :'Array<String>',
    :'item_group_id' => :'String',
    :'last_updated_time' => :'Integer',
    :'link' => :'String',
    :'material' => :'String',
    :'min_ad_price' => :'String',
    :'mobile_link' => :'String',
    :'mpn' => :'String',
    :'number_of_ratings' => :'Integer',
    :'number_of_reviews' => :'Integer',
    :'pattern' => :'String',
    :'price' => :'String',
    :'product_type' => :'String',
    :'sale_price' => :'String',
    :'shipping' => :'String',
    :'shipping_height' => :'String',
    :'shipping_weight' => :'String',
    :'shipping_width' => :'String',
    :'size' => :'String',
    :'size_system' => :'String',
    :'size_type' => :'String',
    :'tax' => :'String',
    :'title' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 652

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      ad_link == o.ad_link &&
      additional_image_link == o.additional_image_link &&
      adult == o.adult &&
      age_group == o.age_group &&
      availability == o.availability &&
      average_review_rating == o.average_review_rating &&
      brand == o.brand &&
      color == o.color &&
      condition == o.condition &&
      custom_label_0 == o.custom_label_0 &&
      custom_label_1 == o.custom_label_1 &&
      custom_label_2 == o.custom_label_2 &&
      custom_label_3 == o.custom_label_3 &&
      custom_label_4 == o.custom_label_4 &&
      description == o.description &&
      free_shipping_label == o.free_shipping_label &&
      free_shipping_limit == o.free_shipping_limit &&
      gender == o.gender &&
      google_product_category == o.google_product_category &&
      gtin == o.gtin &&
      id == o.id &&
      image_link == o.image_link &&
      item_group_id == o.item_group_id &&
      last_updated_time == o.last_updated_time &&
      link == o.link &&
      material == o.material &&
      min_ad_price == o.min_ad_price &&
      mobile_link == o.mobile_link &&
      mpn == o.mpn &&
      number_of_ratings == o.number_of_ratings &&
      number_of_reviews == o.number_of_reviews &&
      pattern == o.pattern &&
      price == o.price &&
      product_type == o.product_type &&
      sale_price == o.sale_price &&
      shipping == o.shipping &&
      shipping_height == o.shipping_height &&
      shipping_weight == o.shipping_weight &&
      shipping_width == o.shipping_width &&
      size == o.size &&
      size_system == o.size_system &&
      size_type == o.size_type &&
      tax == o.tax &&
      title == o.title
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 746

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = PinterestSdkClient.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



817
818
819
820
821
822
823
824
825
826
827
828
829
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 817

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
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



723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 723

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


703
704
705
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 703

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



709
710
711
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 709

def hash
  [ad_link, additional_image_link, adult, age_group, availability, average_review_rating, brand, color, condition, custom_label_0, custom_label_1, custom_label_2, custom_label_3, custom_label_4, description, free_shipping_label, free_shipping_limit, gender, google_product_category, gtin, id, image_link, item_group_id, last_updated_time, link, material, min_ad_price, mobile_link, mpn, number_of_ratings, number_of_reviews, pattern, price, product_type, sale_price, shipping, shipping_height, shipping_weight, shipping_width, size, size_system, size_type, tax, title].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 459

def list_invalid_properties
  invalid_properties = Array.new
  if !@custom_label_0.nil? && @custom_label_0.to_s.length > 1000
    invalid_properties.push('invalid value for "custom_label_0", the character length must be smaller than or equal to 1000.')
  end

  if !@custom_label_1.nil? && @custom_label_1.to_s.length > 1000
    invalid_properties.push('invalid value for "custom_label_1", the character length must be smaller than or equal to 1000.')
  end

  if !@custom_label_2.nil? && @custom_label_2.to_s.length > 1000
    invalid_properties.push('invalid value for "custom_label_2", the character length must be smaller than or equal to 1000.')
  end

  if !@custom_label_3.nil? && @custom_label_3.to_s.length > 1000
    invalid_properties.push('invalid value for "custom_label_3", the character length must be smaller than or equal to 1000.')
  end

  if !@custom_label_4.nil? && @custom_label_4.to_s.length > 1000
    invalid_properties.push('invalid value for "custom_label_4", the character length must be smaller than or equal to 1000.')
  end

  if !@description.nil? && @description.to_s.length > 10000
    invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 10000.')
  end

  if !@id.nil? && @id.to_s.length > 127
    invalid_properties.push('invalid value for "id", the character length must be smaller than or equal to 127.')
  end

  if !@image_link.nil? && @image_link.length < 1
    invalid_properties.push('invalid value for "image_link", number of items must be greater than or equal to 1.')
  end

  if !@item_group_id.nil? && @item_group_id.to_s.length > 127
    invalid_properties.push('invalid value for "item_group_id", the character length must be smaller than or equal to 127.')
  end

  if !@link.nil? && @link.to_s.length > 511
    invalid_properties.push('invalid value for "link", the character length must be smaller than or equal to 511.')
  end

  if !@product_type.nil? && @product_type.to_s.length > 1000
    invalid_properties.push('invalid value for "product_type", the character length must be smaller than or equal to 1000.')
  end

  if !@title.nil? && @title.to_s.length > 500
    invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 500.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



793
794
795
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 793

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



799
800
801
802
803
804
805
806
807
808
809
810
811
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 799

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



787
788
789
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 787

def to_s
  to_hash.to_s
end

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
# File 'lib/pinterest_sdk/models/item_attributes.rb', line 514

def valid?
  return false if !@custom_label_0.nil? && @custom_label_0.to_s.length > 1000
  return false if !@custom_label_1.nil? && @custom_label_1.to_s.length > 1000
  return false if !@custom_label_2.nil? && @custom_label_2.to_s.length > 1000
  return false if !@custom_label_3.nil? && @custom_label_3.to_s.length > 1000
  return false if !@custom_label_4.nil? && @custom_label_4.to_s.length > 1000
  return false if !@description.nil? && @description.to_s.length > 10000
  return false if !@id.nil? && @id.to_s.length > 127
  return false if !@image_link.nil? && @image_link.length < 1
  return false if !@item_group_id.nil? && @item_group_id.to_s.length > 127
  return false if !@link.nil? && @link.to_s.length > 511
  return false if !@product_type.nil? && @product_type.to_s.length > 1000
  return false if !@title.nil? && @title.to_s.length > 500
  true
end