Class: LoyaltyApIs::RedemptionResponseItem
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- LoyaltyApIs::RedemptionResponseItem
- Defined in:
- lib/loyalty_ap_is/models/redemption_response_item.rb
Overview
RedemptionResponseItem Model.
Instance Attribute Summary collapse
-
#item_id ⇒ String
Unique Item ID for the transaction from the partner.
-
#points ⇒ Integer
The number of points that will be redemmed from the Shell Loyalty Platform.
-
#quantity ⇒ Integer
The quantity of the items required.
-
#reason_for_redemption ⇒ String
The reason for the points redemption.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(item_id: SKIP, quantity: SKIP, points: SKIP, reason_for_redemption: SKIP, additional_properties: nil) ⇒ RedemptionResponseItem
constructor
A new instance of RedemptionResponseItem.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(item_id: SKIP, quantity: SKIP, points: SKIP, reason_for_redemption: SKIP, additional_properties: nil) ⇒ RedemptionResponseItem
Returns a new instance of RedemptionResponseItem.
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/loyalty_ap_is/models/redemption_response_item.rb', line 57 def initialize(item_id: SKIP, quantity: SKIP, points: SKIP, reason_for_redemption: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @item_id = item_id unless item_id == SKIP @quantity = quantity unless quantity == SKIP @points = points unless points == SKIP @reason_for_redemption = reason_for_redemption unless reason_for_redemption == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#item_id ⇒ String
Unique Item ID for the transaction from the partner. Used to identify the catalogue item in the Shell Loyalty Platform. Each Partner will have one or more items set up in the Shell Loyalty Platform.
16 17 18 |
# File 'lib/loyalty_ap_is/models/redemption_response_item.rb', line 16 def item_id @item_id end |
#points ⇒ Integer
The number of points that will be redemmed from the Shell Loyalty Platform.
25 26 27 |
# File 'lib/loyalty_ap_is/models/redemption_response_item.rb', line 25 def points @points end |
#quantity ⇒ Integer
The quantity of the items required.
20 21 22 |
# File 'lib/loyalty_ap_is/models/redemption_response_item.rb', line 20 def quantity @quantity end |
#reason_for_redemption ⇒ String
The reason for the points redemption. This attribute will be shown in the Transaction History feture.
30 31 32 |
# File 'lib/loyalty_ap_is/models/redemption_response_item.rb', line 30 def reason_for_redemption @reason_for_redemption end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/loyalty_ap_is/models/redemption_response_item.rb', line 70 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. item_id = hash.key?('itemId') ? hash['itemId'] : SKIP quantity = hash.key?('quantity') ? hash['quantity'] : SKIP points = hash.key?('points') ? hash['points'] : SKIP reason_for_redemption = hash.key?('reasonForRedemption') ? hash['reasonForRedemption'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. RedemptionResponseItem.new(item_id: item_id, quantity: quantity, points: points, reason_for_redemption: reason_for_redemption, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 |
# File 'lib/loyalty_ap_is/models/redemption_response_item.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['item_id'] = 'itemId' @_hash['quantity'] = 'quantity' @_hash['points'] = 'points' @_hash['reason_for_redemption'] = 'reasonForRedemption' @_hash end |
.nullables ⇒ Object
An array for nullable fields
53 54 55 |
# File 'lib/loyalty_ap_is/models/redemption_response_item.rb', line 53 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 48 49 50 |
# File 'lib/loyalty_ap_is/models/redemption_response_item.rb', line 43 def self.optionals %w[ item_id quantity points reason_for_redemption ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
104 105 106 107 108 109 |
# File 'lib/loyalty_ap_is/models/redemption_response_item.rb', line 104 def inspect class_name = self.class.name.split('::').last "<#{class_name} item_id: #{@item_id.inspect}, quantity: #{@quantity.inspect}, points:"\ " #{@points.inspect}, reason_for_redemption: #{@reason_for_redemption.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
96 97 98 99 100 101 |
# File 'lib/loyalty_ap_is/models/redemption_response_item.rb', line 96 def to_s class_name = self.class.name.split('::').last "<#{class_name} item_id: #{@item_id}, quantity: #{@quantity}, points: #{@points},"\ " reason_for_redemption: #{@reason_for_redemption}, additional_properties:"\ " #{@additional_properties}>" end |