Class: FdxV660Api::RewardBalanceEntity
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- FdxV660Api::RewardBalanceEntity
- Defined in:
- lib/fdx_v660_api/models/reward_balance_entity.rb
Overview
Reward program balance
Instance Attribute Summary collapse
-
#accrued_ytd ⇒ Float
Total units accrued in the current program year at time of download.
-
#balance ⇒ Float
Total units available for redemption at time of download.
-
#fi_attributes ⇒ Array[FiAttributeEntity]
Array of FI-specific attributes.
-
#name ⇒ String
Name used to denominate the balance.
-
#qualifying ⇒ TrueClass | FalseClass
Balance used for qualifying purposes.
-
#redeemed_ytd ⇒ Float
Total units redeemed in the current program year at time of download.
-
#type ⇒ RewardType1
The type of the reward balance - CASHBACK, MILES, POINTS.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(name: SKIP, type: SKIP, balance: SKIP, accrued_ytd: SKIP, redeemed_ytd: SKIP, qualifying: false, fi_attributes: SKIP, additional_properties: nil) ⇒ RewardBalanceEntity
constructor
A new instance of RewardBalanceEntity.
-
#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(name: SKIP, type: SKIP, balance: SKIP, accrued_ytd: SKIP, redeemed_ytd: SKIP, qualifying: false, fi_attributes: SKIP, additional_properties: nil) ⇒ RewardBalanceEntity
Returns a new instance of RewardBalanceEntity.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 71 def initialize(name: SKIP, type: SKIP, balance: SKIP, accrued_ytd: SKIP, redeemed_ytd: SKIP, qualifying: false, fi_attributes: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @name = name unless name == SKIP @type = type unless type == SKIP @balance = balance unless balance == SKIP @accrued_ytd = accrued_ytd unless accrued_ytd == SKIP @redeemed_ytd = redeemed_ytd unless redeemed_ytd == SKIP @qualifying = unless == SKIP @fi_attributes = fi_attributes unless fi_attributes == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#accrued_ytd ⇒ Float
Total units accrued in the current program year at time of download
26 27 28 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 26 def accrued_ytd @accrued_ytd end |
#balance ⇒ Float
Total units available for redemption at time of download
22 23 24 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 22 def balance @balance end |
#fi_attributes ⇒ Array[FiAttributeEntity]
Array of FI-specific attributes
38 39 40 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 38 def fi_attributes @fi_attributes end |
#name ⇒ String
Name used to denominate the balance
14 15 16 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 14 def name @name end |
#qualifying ⇒ TrueClass | FalseClass
Balance used for qualifying purposes
34 35 36 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 34 def @qualifying end |
#redeemed_ytd ⇒ Float
Total units redeemed in the current program year at time of download
30 31 32 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 30 def redeemed_ytd @redeemed_ytd end |
#type ⇒ RewardType1
The type of the reward balance - CASHBACK, MILES, POINTS
18 19 20 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 18 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 88 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : SKIP type = hash.key?('type') ? hash['type'] : SKIP balance = hash.key?('balance') ? hash['balance'] : SKIP accrued_ytd = hash.key?('accruedYtd') ? hash['accruedYtd'] : SKIP redeemed_ytd = hash.key?('redeemedYtd') ? hash['redeemedYtd'] : SKIP = hash['qualifying'] ||= false # Parameter is an array, so we need to iterate through it fi_attributes = nil unless hash['fiAttributes'].nil? fi_attributes = [] hash['fiAttributes'].each do |structure| fi_attributes << (FiAttributeEntity.from_hash(structure) if structure) end end fi_attributes = SKIP unless hash.key?('fiAttributes') # 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. RewardBalanceEntity.new(name: name, type: type, balance: balance, accrued_ytd: accrued_ytd, redeemed_ytd: redeemed_ytd, qualifying: , fi_attributes: fi_attributes, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['type'] = 'type' @_hash['balance'] = 'balance' @_hash['accrued_ytd'] = 'accruedYtd' @_hash['redeemed_ytd'] = 'redeemedYtd' @_hash['qualifying'] = 'qualifying' @_hash['fi_attributes'] = 'fiAttributes' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 67 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 54 def self.optionals %w[ name type balance accrued_ytd redeemed_ytd qualifying fi_attributes ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
129 130 131 132 133 134 135 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 129 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
146 147 148 149 150 151 152 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 146 def inspect class_name = self.class.name.split('::').last "<#{class_name} name: #{@name.inspect}, type: #{@type.inspect}, balance:"\ " #{@balance.inspect}, accrued_ytd: #{@accrued_ytd.inspect}, redeemed_ytd:"\ " #{@redeemed_ytd.inspect}, qualifying: #{@qualifying.inspect}, fi_attributes:"\ " #{@fi_attributes.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
138 139 140 141 142 143 |
# File 'lib/fdx_v660_api/models/reward_balance_entity.rb', line 138 def to_s class_name = self.class.name.split('::').last "<#{class_name} name: #{@name}, type: #{@type}, balance: #{@balance}, accrued_ytd:"\ " #{@accrued_ytd}, redeemed_ytd: #{@redeemed_ytd}, qualifying: #{@qualifying},"\ " fi_attributes: #{@fi_attributes}, additional_properties: #{@additional_properties}>" end |