Class: AmzSpApi::ProductPricingApiModel::OfferDetail

Inherits:
Object
  • Object
show all
Defined in:
lib/product-pricing-api-model/models/offer_detail.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ OfferDetail

Initializes the object

Parameters:

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

    Model attributes in the form of hash



107
108
109
110
111
112
113
114
115
116
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
147
148
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
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 107

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `AmzSpApi::ProductPricingApiModel::OfferDetail` 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 `AmzSpApi::ProductPricingApiModel::OfferDetail`. 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?(:'my_offer')
    self.my_offer = attributes[:'my_offer']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#condition_notesObject

Information about the condition of the item.



28
29
30
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 28

def condition_notes
  @condition_notes
end

#is_buy_box_winnerObject

When true, the offer is currently in the Buy Box. There can be up to two Buy Box winners at any time per ASIN, one that is eligible for Prime and one that is not eligible for Prime.



50
51
52
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 50

def is_buy_box_winner
  @is_buy_box_winner
end

When true, the seller of the item is eligible to win the Buy Box.



53
54
55
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 53

def is_featured_merchant
  @is_featured_merchant
end

#is_fulfilled_by_amazonObject

When true, the offer is fulfilled by Amazon.



45
46
47
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 45

def is_fulfilled_by_amazon
  @is_fulfilled_by_amazon
end

#listing_priceObject

Returns the value of attribute listing_price.



34
35
36
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 34

def listing_price
  @listing_price
end

#my_offerObject

When true, this is the seller’s offer.



17
18
19
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 17

def my_offer
  @my_offer
end

#offer_typeObject

Returns the value of attribute offer_type.



19
20
21
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 19

def offer_type
  @offer_type
end

#pointsObject

Returns the value of attribute points.



38
39
40
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 38

def points
  @points
end

#prime_informationObject

Returns the value of attribute prime_information.



47
48
49
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 47

def prime_information
  @prime_information
end

#quantity_discount_pricesObject

Returns the value of attribute quantity_discount_prices.



36
37
38
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 36

def quantity_discount_prices
  @quantity_discount_prices
end

#seller_feedback_ratingObject

Returns the value of attribute seller_feedback_rating.



30
31
32
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 30

def seller_feedback_rating
  @seller_feedback_rating
end

#seller_idObject

The seller identifier for the offer.



25
26
27
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 25

def seller_id
  @seller_id
end

#shippingObject

Returns the value of attribute shipping.



40
41
42
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 40

def shipping
  @shipping
end

#shipping_timeObject

Returns the value of attribute shipping_time.



32
33
34
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 32

def shipping_time
  @shipping_time
end

#ships_fromObject

Returns the value of attribute ships_from.



42
43
44
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 42

def ships_from
  @ships_from
end

#sub_conditionObject

The subcondition of the item. Subcondition values: New, Mint, Very Good, Good, Acceptable, Poor, Club, OEM, Warranty, Refurbished Warranty, Refurbished, Open Box, or Other.



22
23
24
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 22

def sub_condition
  @sub_condition
end

Class Method Details

.attribute_mapObject

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



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 56

def self.attribute_map
  {
    :'my_offer' => :'MyOffer',
    :'offer_type' => :'offerType',
    :'sub_condition' => :'SubCondition',
    :'seller_id' => :'SellerId',
    :'condition_notes' => :'ConditionNotes',
    :'seller_feedback_rating' => :'SellerFeedbackRating',
    :'shipping_time' => :'ShippingTime',
    :'listing_price' => :'ListingPrice',
    :'quantity_discount_prices' => :'quantityDiscountPrices',
    :'points' => :'Points',
    :'shipping' => :'Shipping',
    :'ships_from' => :'ShipsFrom',
    :'is_fulfilled_by_amazon' => :'IsFulfilledByAmazon',
    :'prime_information' => :'PrimeInformation',
    :'is_buy_box_winner' => :'IsBuyBoxWinner',
    :'is_featured_merchant' => :'IsFeaturedMerchant'
  }
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



263
264
265
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 263

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

.openapi_nullableObject

List of attributes with nullable: true



100
101
102
103
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 100

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

.openapi_typesObject

Attribute type mapping.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 78

def self.openapi_types
  {
    :'my_offer' => :'Object',
    :'offer_type' => :'Object',
    :'sub_condition' => :'Object',
    :'seller_id' => :'Object',
    :'condition_notes' => :'Object',
    :'seller_feedback_rating' => :'Object',
    :'shipping_time' => :'Object',
    :'listing_price' => :'Object',
    :'quantity_discount_prices' => :'Object',
    :'points' => :'Object',
    :'shipping' => :'Object',
    :'ships_from' => :'Object',
    :'is_fulfilled_by_amazon' => :'Object',
    :'prime_information' => :'Object',
    :'is_buy_box_winner' => :'Object',
    :'is_featured_merchant' => :'Object'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 227

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      my_offer == o.my_offer &&
      offer_type == o.offer_type &&
      sub_condition == o.sub_condition &&
      seller_id == o.seller_id &&
      condition_notes == o.condition_notes &&
      seller_feedback_rating == o.seller_feedback_rating &&
      shipping_time == o.shipping_time &&
      listing_price == o.listing_price &&
      quantity_discount_prices == o.quantity_discount_prices &&
      points == o.points &&
      shipping == o.shipping &&
      ships_from == o.ships_from &&
      is_fulfilled_by_amazon == o.is_fulfilled_by_amazon &&
      prime_information == o.prime_information &&
      is_buy_box_winner == o.is_buy_box_winner &&
      is_featured_merchant == o.is_featured_merchant
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



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
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 293

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
    AmzSpApi::ProductPricingApiModel.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



362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 362

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



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 270

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
      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]]))
    elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


250
251
252
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 250

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



256
257
258
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 256

def hash
  [my_offer, offer_type, sub_condition, seller_id, condition_notes, seller_feedback_rating, shipping_time, listing_price, quantity_discount_prices, points, shipping, ships_from, is_fulfilled_by_amazon, prime_information, is_buy_box_winner, is_featured_merchant].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 189

def list_invalid_properties
  invalid_properties = Array.new
  if @sub_condition.nil?
    invalid_properties.push('invalid value for "sub_condition", sub_condition cannot be nil.')
  end

  if @shipping_time.nil?
    invalid_properties.push('invalid value for "shipping_time", shipping_time cannot be nil.')
  end

  if @listing_price.nil?
    invalid_properties.push('invalid value for "listing_price", listing_price cannot be nil.')
  end

  if @shipping.nil?
    invalid_properties.push('invalid value for "shipping", shipping cannot be nil.')
  end

  if @is_fulfilled_by_amazon.nil?
    invalid_properties.push('invalid value for "is_fulfilled_by_amazon", is_fulfilled_by_amazon cannot be nil.')
  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



338
339
340
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 338

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



344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 344

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



332
333
334
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 332

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



216
217
218
219
220
221
222
223
# File 'lib/product-pricing-api-model/models/offer_detail.rb', line 216

def valid?
  return false if @sub_condition.nil?
  return false if @shipping_time.nil?
  return false if @listing_price.nil?
  return false if @shipping.nil?
  return false if @is_fulfilled_by_amazon.nil?
  true
end