Class: FdxV660Api::RewardProgramMembershipEntity
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- FdxV660Api::RewardProgramMembershipEntity
- Defined in:
- lib/fdx_v660_api/models/reward_program_membership_entity.rb
Overview
Details of a single membership in a reward programs
Instance Attribute Summary collapse
-
#account_id ⇒ String
A single accountId associated to the reward program.
-
#account_ids ⇒ Array[String]
Array of accountIds associated to the reward program.
-
#balances ⇒ Array[RewardBalanceEntity]
Array of balances.
-
#business_or_consumer ⇒ BusinessOrConsumerType1
BUSINESS or CONSUMER membership.
-
#customer_id ⇒ String
Long-term persistent identity of the associated Customer.
-
#member_id ⇒ String
Long term persistent identity of the program member.
-
#member_number ⇒ String
Reward program membership number.
-
#member_tier ⇒ String
If the reward program is tiered, member's current tier.
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(account_ids: SKIP, account_id: SKIP, customer_id: SKIP, member_id: SKIP, member_number: SKIP, member_tier: SKIP, business_or_consumer: SKIP, balances: SKIP, additional_properties: nil) ⇒ RewardProgramMembershipEntity
constructor
A new instance of RewardProgramMembershipEntity.
-
#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(account_ids: SKIP, account_id: SKIP, customer_id: SKIP, member_id: SKIP, member_number: SKIP, member_tier: SKIP, business_or_consumer: SKIP, balances: SKIP, additional_properties: nil) ⇒ RewardProgramMembershipEntity
Returns a new instance of RewardProgramMembershipEntity.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 78 def initialize(account_ids: SKIP, account_id: SKIP, customer_id: SKIP, member_id: SKIP, member_number: SKIP, member_tier: SKIP, business_or_consumer: SKIP, balances: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @account_ids = account_ids unless account_ids == SKIP @account_id = account_id unless account_id == SKIP @customer_id = customer_id unless customer_id == SKIP @member_id = member_id unless member_id == SKIP @member_number = member_number unless member_number == SKIP @member_tier = member_tier unless member_tier == SKIP @business_or_consumer = business_or_consumer unless business_or_consumer == SKIP @balances = balances unless balances == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#account_id ⇒ String
A single accountId associated to the reward program
19 20 21 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 19 def account_id @account_id end |
#account_ids ⇒ Array[String]
Array of accountIds associated to the reward program. Deprecated in
release v6.5 in favor of single accountId for these balances
15 16 17 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 15 def account_ids @account_ids end |
#balances ⇒ Array[RewardBalanceEntity]
Array of balances
43 44 45 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 43 def balances @balances end |
#business_or_consumer ⇒ BusinessOrConsumerType1
BUSINESS or CONSUMER membership
39 40 41 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 39 def business_or_consumer @business_or_consumer end |
#customer_id ⇒ String
Long-term persistent identity of the associated Customer
23 24 25 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 23 def customer_id @customer_id end |
#member_id ⇒ String
Long term persistent identity of the program member
27 28 29 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 27 def member_id @member_id end |
#member_number ⇒ String
Reward program membership number
31 32 33 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 31 def member_number @member_number end |
#member_tier ⇒ String
If the reward program is tiered, member's current tier
35 36 37 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 35 def member_tier @member_tier end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 97 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_ids = hash.key?('accountIds') ? hash['accountIds'] : SKIP account_id = hash.key?('accountId') ? hash['accountId'] : SKIP customer_id = hash.key?('customerId') ? hash['customerId'] : SKIP member_id = hash.key?('memberId') ? hash['memberId'] : SKIP member_number = hash.key?('memberNumber') ? hash['memberNumber'] : SKIP member_tier = hash.key?('memberTier') ? hash['memberTier'] : SKIP business_or_consumer = hash.key?('businessOrConsumer') ? hash['businessOrConsumer'] : SKIP # Parameter is an array, so we need to iterate through it balances = nil unless hash['balances'].nil? balances = [] hash['balances'].each do |structure| balances << (RewardBalanceEntity.from_hash(structure) if structure) end end balances = SKIP unless hash.key?('balances') # 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. RewardProgramMembershipEntity.new(account_ids: account_ids, account_id: account_id, customer_id: customer_id, member_id: member_id, member_number: member_number, member_tier: member_tier, business_or_consumer: business_or_consumer, balances: balances, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 46 def self.names @_hash = {} if @_hash.nil? @_hash['account_ids'] = 'accountIds' @_hash['account_id'] = 'accountId' @_hash['customer_id'] = 'customerId' @_hash['member_id'] = 'memberId' @_hash['member_number'] = 'memberNumber' @_hash['member_tier'] = 'memberTier' @_hash['business_or_consumer'] = 'businessOrConsumer' @_hash['balances'] = 'balances' @_hash end |
.nullables ⇒ Object
An array for nullable fields
74 75 76 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 74 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 60 def self.optionals %w[ account_ids account_id customer_id member_id member_number member_tier business_or_consumer balances ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
149 150 151 152 153 154 155 156 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 149 def inspect class_name = self.class.name.split('::').last "<#{class_name} account_ids: #{@account_ids.inspect}, account_id: #{@account_id.inspect},"\ " customer_id: #{@customer_id.inspect}, member_id: #{@member_id.inspect}, member_number:"\ " #{@member_number.inspect}, member_tier: #{@member_tier.inspect}, business_or_consumer:"\ " #{@business_or_consumer.inspect}, balances: #{@balances.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
140 141 142 143 144 145 146 |
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 140 def to_s class_name = self.class.name.split('::').last "<#{class_name} account_ids: #{@account_ids}, account_id: #{@account_id}, customer_id:"\ " #{@customer_id}, member_id: #{@member_id}, member_number: #{@member_number}, member_tier:"\ " #{@member_tier}, business_or_consumer: #{@business_or_consumer}, balances: #{@balances},"\ " additional_properties: #{@additional_properties}>" end |