Class: Ifeelgoods::RewardDetails

Inherits:
ApiModelBase show all
Defined in:
lib/ifeelgoods/models/reward_details.rb

Overview

A Reward (aka Product SKU) is a specific denomination of a Digital or Physical Gift that can be delivered to a User. "iTunes Code 10$ (US)" is a Reward.

Defined Under Namespace

Classes: EnumAttributeValidator

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 = {}) ⇒ RewardDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/ifeelgoods/models/reward_details.rb', line 226

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#brandObject

Returns the value of attribute brand.



51
52
53
# File 'lib/ifeelgoods/models/reward_details.rb', line 51

def brand
  @brand
end

#catalog_badge_urlObject

Reward image, without scheme (eg. //cdn.ifeelgoods.com/image.png).



82
83
84
# File 'lib/ifeelgoods/models/reward_details.rb', line 82

def catalog_badge_url
  @catalog_badge_url
end

#catalog_card_urlObject

(legacy) Reward image (same as catalog_badge_url).



85
86
87
# File 'lib/ifeelgoods/models/reward_details.rb', line 85

def catalog_card_url
  @catalog_card_url
end

#categoriesObject

Reward categories (eg. ['Games & Entertainment', 'Sports']) (not maintained).



64
65
66
# File 'lib/ifeelgoods/models/reward_details.rb', line 64

def categories
  @categories
end

#conditions_of_saleObject

Returns the value of attribute conditions_of_sale.



72
73
74
# File 'lib/ifeelgoods/models/reward_details.rb', line 72

def conditions_of_sale
  @conditions_of_sale
end

#costObject

Reward cost for your account (eg. 9.0). You need to query the API with the client_id parameter to retrieve the acutal cost, otherwise it will return face_value.



34
35
36
# File 'lib/ifeelgoods/models/reward_details.rb', line 34

def cost
  @cost
end

#cost_currencyObject

Reward cost currency (eg. USD, EUR).



37
38
39
# File 'lib/ifeelgoods/models/reward_details.rb', line 37

def cost_currency
  @cost_currency
end

#countryObject

Reward country list (eg. [\"US\", \"CA\"] or [\"WW\"] if worldwide). If the reward is not specific to a country, it will be considered as worldwide.



70
71
72
# File 'lib/ifeelgoods/models/reward_details.rb', line 70

def country
  @country
end

#denominationObject

Reward formatted value with currency (eg. $10).



26
27
28
# File 'lib/ifeelgoods/models/reward_details.rb', line 26

def denomination
  @denomination
end

#descriptionObject

Reward description.



67
68
69
# File 'lib/ifeelgoods/models/reward_details.rb', line 67

def description
  @description
end

#dimensionsObject

Returns the value of attribute dimensions.



74
75
76
# File 'lib/ifeelgoods/models/reward_details.rb', line 74

def dimensions
  @dimensions
end

#display_valueObject

Returns the value of attribute display_value.



28
29
30
# File 'lib/ifeelgoods/models/reward_details.rb', line 28

def display_value
  @display_value
end

#expiration_dateObject

Expiration date (eg. 2023-03-31)



61
62
63
# File 'lib/ifeelgoods/models/reward_details.rb', line 61

def expiration_date
  @expiration_date
end

#face_valueObject

Reward face value, actual reward amount (e.g. 10.00).



40
41
42
# File 'lib/ifeelgoods/models/reward_details.rb', line 40

def face_value
  @face_value
end

#face_value_currencyObject

Reward face value currency. (eg. EUR).



43
44
45
# File 'lib/ifeelgoods/models/reward_details.rb', line 43

def face_value_currency
  @face_value_currency
end

#free_valueObject

Indicates whether the reward should be redeemed with a value. Range can be found in dimensions.available_denominations_range.



31
32
33
# File 'lib/ifeelgoods/models/reward_details.rb', line 31

def free_value
  @free_value
end

#how_to_use_instructionsObject

Reward 'How to use' instructions.



97
98
99
# File 'lib/ifeelgoods/models/reward_details.rb', line 97

def how_to_use_instructions
  @how_to_use_instructions
end

#important_instructionsObject

Reward additional information.



100
101
102
# File 'lib/ifeelgoods/models/reward_details.rb', line 100

def important_instructions
  @important_instructions
end

#in_stockObject

Boolean that represent reward availability.



46
47
48
# File 'lib/ifeelgoods/models/reward_details.rb', line 46

def in_stock
  @in_stock
end

#logo_urlObject

Brand logo, without scheme (eg. //cdn.ifeelgoods.com/logo.png).



88
89
90
# File 'lib/ifeelgoods/models/reward_details.rb', line 88

def logo_url
  @logo_url
end

#nameObject

Reward name (eg. $10 iTunesĀ® Code).



20
21
22
# File 'lib/ifeelgoods/models/reward_details.rb', line 20

def name
  @name
end

#productObject

Returns the value of attribute product.



53
54
55
# File 'lib/ifeelgoods/models/reward_details.rb', line 53

def product
  @product
end

#product_typeObject

Returns the value of attribute product_type.



55
56
57
# File 'lib/ifeelgoods/models/reward_details.rb', line 55

def product_type
  @product_type
end

#skuObject

Unique identifier that represents the reward (eg. APP-ITC-10USD-US). It must be used with the redeem APIs.



23
24
25
# File 'lib/ifeelgoods/models/reward_details.rb', line 23

def sku
  @sku
end

#stock_quantityObject

Stock quantity. Can be null (if stock_quantity is null, in_stock is always true).



49
50
51
# File 'lib/ifeelgoods/models/reward_details.rb', line 49

def stock_quantity
  @stock_quantity
end

#tagsObject

Reward tags (not maintained).



77
78
79
# File 'lib/ifeelgoods/models/reward_details.rb', line 77

def tags
  @tags
end

#targetingObject

Returns the value of attribute targeting.



79
80
81
# File 'lib/ifeelgoods/models/reward_details.rb', line 79

def targeting
  @targeting
end

#terms_and_conditionsObject

Reward 'Terms and Conditions'.



94
95
96
# File 'lib/ifeelgoods/models/reward_details.rb', line 94

def terms_and_conditions
  @terms_and_conditions
end

#terms_and_conditions_urlObject

Reward 'Terms and Conditions' URL (when provided by brand, null otherwise).



91
92
93
# File 'lib/ifeelgoods/models/reward_details.rb', line 91

def terms_and_conditions_url
  @terms_and_conditions_url
end

#usagesObject

Reward code format



58
59
60
# File 'lib/ifeelgoods/models/reward_details.rb', line 58

def usages
  @usages
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



161
162
163
# File 'lib/ifeelgoods/models/reward_details.rb', line 161

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



166
167
168
# File 'lib/ifeelgoods/models/reward_details.rb', line 166

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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
# File 'lib/ifeelgoods/models/reward_details.rb', line 125

def self.attribute_map
  {
    :'name' => :'name',
    :'sku' => :'sku',
    :'denomination' => :'denomination',
    :'display_value' => :'display_value',
    :'free_value' => :'free_value',
    :'cost' => :'cost',
    :'cost_currency' => :'cost_currency',
    :'face_value' => :'face_value',
    :'face_value_currency' => :'face_value_currency',
    :'in_stock' => :'in_stock',
    :'stock_quantity' => :'stock_quantity',
    :'brand' => :'brand',
    :'product' => :'product',
    :'product_type' => :'product_type',
    :'usages' => :'usages',
    :'expiration_date' => :'expiration_date',
    :'categories' => :'categories',
    :'description' => :'description',
    :'country' => :'country',
    :'conditions_of_sale' => :'conditions_of_sale',
    :'dimensions' => :'dimensions',
    :'tags' => :'tags',
    :'targeting' => :'targeting',
    :'catalog_badge_url' => :'catalog_badge_url',
    :'catalog_card_url' => :'catalog_card_url',
    :'logo_url' => :'logo_url',
    :'terms_and_conditions_url' => :'terms_and_conditions_url',
    :'terms_and_conditions' => :'terms_and_conditions',
    :'how_to_use_instructions' => :'how_to_use_instructions',
    :'important_instructions' => :'important_instructions'
  }
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



448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'lib/ifeelgoods/models/reward_details.rb', line 448

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



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/ifeelgoods/models/reward_details.rb', line 207

def self.openapi_nullable
  Set.new([
    :'cost',
    :'stock_quantity',
    :'expiration_date',
    :'description',
    :'conditions_of_sale',
    :'catalog_badge_url',
    :'catalog_card_url',
    :'logo_url',
    :'terms_and_conditions_url',
    :'terms_and_conditions',
    :'how_to_use_instructions',
    :'important_instructions'
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/ifeelgoods/models/reward_details.rb', line 171

def self.openapi_types
  {
    :'name' => :'String',
    :'sku' => :'String',
    :'denomination' => :'String',
    :'display_value' => :'String',
    :'free_value' => :'Boolean',
    :'cost' => :'Float',
    :'cost_currency' => :'String',
    :'face_value' => :'String',
    :'face_value_currency' => :'String',
    :'in_stock' => :'Boolean',
    :'stock_quantity' => :'Integer',
    :'brand' => :'RewardDetailsBrand',
    :'product' => :'RewardDetailsProduct',
    :'product_type' => :'RewardDetailsProductType',
    :'usages' => :'Array<String>',
    :'expiration_date' => :'String',
    :'categories' => :'Array<String>',
    :'description' => :'String',
    :'country' => :'Array<String>',
    :'conditions_of_sale' => :'String',
    :'dimensions' => :'RewardDetailsDimensions',
    :'tags' => :'Array<String>',
    :'targeting' => :'RewardDetailsTargeting',
    :'catalog_badge_url' => :'String',
    :'catalog_card_url' => :'String',
    :'logo_url' => :'String',
    :'terms_and_conditions_url' => :'String',
    :'terms_and_conditions' => :'String',
    :'how_to_use_instructions' => :'String',
    :'important_instructions' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/ifeelgoods/models/reward_details.rb', line 398

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      name == o.name &&
      sku == o.sku &&
      denomination == o.denomination &&
      display_value == o.display_value &&
      free_value == o.free_value &&
      cost == o.cost &&
      cost_currency == o.cost_currency &&
      face_value == o.face_value &&
      face_value_currency == o.face_value_currency &&
      in_stock == o.in_stock &&
      stock_quantity == o.stock_quantity &&
      brand == o.brand &&
      product == o.product &&
      product_type == o.product_type &&
      usages == o.usages &&
      expiration_date == o.expiration_date &&
      categories == o.categories &&
      description == o.description &&
      country == o.country &&
      conditions_of_sale == o.conditions_of_sale &&
      dimensions == o.dimensions &&
      tags == o.tags &&
      targeting == o.targeting &&
      catalog_badge_url == o.catalog_badge_url &&
      catalog_card_url == o.catalog_card_url &&
      logo_url == o.logo_url &&
      terms_and_conditions_url == o.terms_and_conditions_url &&
      terms_and_conditions == o.terms_and_conditions &&
      how_to_use_instructions == o.how_to_use_instructions &&
      important_instructions == o.important_instructions
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


435
436
437
# File 'lib/ifeelgoods/models/reward_details.rb', line 435

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



441
442
443
# File 'lib/ifeelgoods/models/reward_details.rb', line 441

def hash
  [name, sku, denomination, display_value, free_value, cost, cost_currency, face_value, face_value_currency, in_stock, stock_quantity, brand, product, product_type, usages, expiration_date, categories, description, country, conditions_of_sale, dimensions, tags, targeting, catalog_badge_url, catalog_card_url, logo_url, terms_and_conditions_url, terms_and_conditions, how_to_use_instructions, important_instructions].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



371
372
373
374
375
# File 'lib/ifeelgoods/models/reward_details.rb', line 371

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



470
471
472
473
474
475
476
477
478
479
480
481
482
# File 'lib/ifeelgoods/models/reward_details.rb', line 470

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



379
380
381
382
383
384
# File 'lib/ifeelgoods/models/reward_details.rb', line 379

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  conditions_of_sale_validator = EnumAttributeValidator.new('String', ["on_demand", "special_order_only"])
  return false unless conditions_of_sale_validator.valid?(@conditions_of_sale)
  true
end