Class: AmznSpApi::CatalogItemsApiModel::ItemSummaryByMarketplace

Inherits:
Object
  • Object
show all
Defined in:
lib/catalog_items_api_model/models/item_summary_by_marketplace.rb

Overview

Summary details of an Amazon catalog item for the indicated Amazon marketplace.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ItemSummaryByMarketplace

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Raises:

  • (ArgumentError)


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
199
200
201
202
203
204
205
206
207
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 154

def initialize(attributes = {})
  raise ArgumentError, 'The input argument (attributes) must be a hash in `AmznSpApi::CatalogItemsApiModel::ItemSummaryByMarketplace` initialize method' unless attributes.is_a?(Hash)

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

    h[k.to_sym] = v
  end

  self.marketplace_id = attributes[:marketplace_id] if attributes.key?(:marketplace_id)

  self.adult_product = attributes[:adult_product] if attributes.key?(:adult_product)

  self.autographed = attributes[:autographed] if attributes.key?(:autographed)

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

  self.browse_classification = attributes[:browse_classification] if attributes.key?(:browse_classification)

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

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

  self.item_classification = attributes[:item_classification] if attributes.key?(:item_classification)

  self.item_name = attributes[:item_name] if attributes.key?(:item_name)

  self.manufacturer = attributes[:manufacturer] if attributes.key?(:manufacturer)

  self.memorabilia = attributes[:memorabilia] if attributes.key?(:memorabilia)

  self.model_number = attributes[:model_number] if attributes.key?(:model_number)

  self.package_quantity = attributes[:package_quantity] if attributes.key?(:package_quantity)

  self.part_number = attributes[:part_number] if attributes.key?(:part_number)

  self.release_date = attributes[:release_date] if attributes.key?(:release_date)

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

  self.style = attributes[:style] if attributes.key?(:style)

  self.trade_in_eligible = attributes[:trade_in_eligible] if attributes.key?(:trade_in_eligible)

  self.website_display_group = attributes[:website_display_group] if attributes.key?(:website_display_group)

  return unless attributes.key?(:website_display_group_name)

  self.website_display_group_name = attributes[:website_display_group_name]
end

Instance Attribute Details

#adult_productObject

Identifies an Amazon catalog item is intended for an adult audience or is sexual in nature.



19
20
21
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 19

def adult_product
  @adult_product
end

#autographedObject

Identifies an Amazon catalog item is autographed by a player or celebrity.



22
23
24
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 22

def autographed
  @autographed
end

#brandObject

Name of the brand associated with an Amazon catalog item.



25
26
27
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 25

def brand
  @brand
end

#browse_classificationObject

Returns the value of attribute browse_classification.



27
28
29
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 27

def browse_classification
  @browse_classification
end

#colorObject

Name of the color associated with an Amazon catalog item.



30
31
32
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 30

def color
  @color
end

#contributorsObject

Individual contributors to the creation of an item, such as the authors or actors.



33
34
35
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 33

def contributors
  @contributors
end

#item_classificationObject

Classification type associated with the Amazon catalog item.



36
37
38
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 36

def item_classification
  @item_classification
end

#item_nameObject

Name, or title, associated with an Amazon catalog item.



39
40
41
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 39

def item_name
  @item_name
end

#manufacturerObject

Name of the manufacturer associated with an Amazon catalog item.



42
43
44
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 42

def manufacturer
  @manufacturer
end

#marketplace_idObject

Amazon marketplace identifier.



16
17
18
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 16

def marketplace_id
  @marketplace_id
end

#memorabiliaObject

Identifies an Amazon catalog item is memorabilia valued for its connection with historical events, culture, or entertainment.



45
46
47
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 45

def memorabilia
  @memorabilia
end

#model_numberObject

Model number associated with an Amazon catalog item.



48
49
50
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 48

def model_number
  @model_number
end

#package_quantityObject

Quantity of an Amazon catalog item in one package.



51
52
53
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 51

def package_quantity
  @package_quantity
end

#part_numberObject

Part number associated with an Amazon catalog item.



54
55
56
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 54

def part_number
  @part_number
end

#release_dateObject

First date on which an Amazon catalog item is shippable to customers.



57
58
59
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 57

def release_date
  @release_date
end

#sizeObject

Name of the size associated with an Amazon catalog item.



60
61
62
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 60

def size
  @size
end

#styleObject

Name of the style associated with an Amazon catalog item.



63
64
65
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 63

def style
  @style
end

#trade_in_eligibleObject

Identifies an Amazon catalog item is eligible for trade-in.



66
67
68
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 66

def trade_in_eligible
  @trade_in_eligible
end

#website_display_groupObject

Identifier of the website display group associated with an Amazon catalog item.



69
70
71
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 69

def website_display_group
  @website_display_group
end

#website_display_group_nameObject

Display name of the website display group associated with an Amazon catalog item.



72
73
74
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 72

def website_display_group_name
  @website_display_group_name
end

Class Method Details

.attribute_mapObject

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



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 96

def self.attribute_map
  {
    'marketplace_id': :marketplaceId,
    'adult_product': :adultProduct,
    'autographed': :autographed,
    'brand': :brand,
    'browse_classification': :browseClassification,
    'color': :color,
    'contributors': :contributors,
    'item_classification': :itemClassification,
    'item_name': :itemName,
    'manufacturer': :manufacturer,
    'memorabilia': :memorabilia,
    'model_number': :modelNumber,
    'package_quantity': :packageQuantity,
    'part_number': :partNumber,
    'release_date': :releaseDate,
    'size': :size,
    'style': :style,
    'trade_in_eligible': :tradeInEligible,
    'website_display_group': :websiteDisplayGroup,
    'website_display_group_name': :websiteDisplayGroupName
  }
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



281
282
283
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 281

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

.openapi_nullableObject

List of attributes with nullable: true



148
149
150
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 148

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

.openapi_typesObject

Attribute type mapping.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 122

def self.openapi_types
  {
    'marketplace_id': :Object,
    'adult_product': :Object,
    'autographed': :Object,
    'brand': :Object,
    'browse_classification': :Object,
    'color': :Object,
    'contributors': :Object,
    'item_classification': :Object,
    'item_name': :Object,
    'manufacturer': :Object,
    'memorabilia': :Object,
    'model_number': :Object,
    'package_quantity': :Object,
    'part_number': :Object,
    'release_date': :Object,
    'size': :Object,
    'style': :Object,
    'trade_in_eligible': :Object,
    'website_display_group': :Object,
    'website_display_group_name': :Object
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 240

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    marketplace_id == other.marketplace_id &&
    adult_product == other.adult_product &&
    autographed == other.autographed &&
    brand == other.brand &&
    browse_classification == other.browse_classification &&
    color == other.color &&
    contributors == other.contributors &&
    item_classification == other.item_classification &&
    item_name == other.item_name &&
    manufacturer == other.manufacturer &&
    memorabilia == other.memorabilia &&
    model_number == other.model_number &&
    package_quantity == other.package_quantity &&
    part_number == other.part_number &&
    release_date == other.release_date &&
    size == other.size &&
    style == other.style &&
    trade_in_eligible == other.trade_in_eligible &&
    website_display_group == other.website_display_group &&
    website_display_group_name == other.website_display_group_name
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



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
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 310

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.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
    AmznSpApi::CatalogItemsApiModel.const_get(type).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



379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 379

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



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 288

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

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

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


268
269
270
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 268

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



274
275
276
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 274

def hash
  [marketplace_id, adult_product, autographed, brand, browse_classification, color, contributors, item_classification, item_name, manufacturer, memorabilia, model_number, package_quantity, part_number, release_date, size, style, trade_in_eligible, website_display_group, website_display_group_name].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



211
212
213
214
215
216
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 211

def list_invalid_properties
  invalid_properties = []
  invalid_properties.push('invalid value for "marketplace_id", marketplace_id cannot be nil.') if @marketplace_id.nil?

  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



355
356
357
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 355

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



361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 361

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = 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



349
350
351
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 349

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



220
221
222
223
224
225
226
227
# File 'lib/catalog_items_api_model/models/item_summary_by_marketplace.rb', line 220

def valid?
  return false if @marketplace_id.nil?

  item_classification_validator = EnumAttributeValidator.new('Object', %w[BASE_PRODUCT OTHER PRODUCT_BUNDLE VARIATION_PARENT])
  return false unless item_classification_validator.valid?(@item_classification)

  true
end