Class: FdxV660Api::RewardProgramMembershipEntity

Inherits:
BaseModel
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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 =  unless  == SKIP
  @account_id =  unless  == 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_idString

A single accountId associated to the reward program

Returns:

  • (String)


19
20
21
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 19

def 
  @account_id
end

#account_idsArray[String]

Array of accountIds associated to the reward program. Deprecated in release v6.5 in favor of single accountId for these balances

Returns:

  • (Array[String])


15
16
17
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 15

def 
  @account_ids
end

#balancesArray[RewardBalanceEntity]

Array of balances

Returns:



43
44
45
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 43

def balances
  @balances
end

#business_or_consumerBusinessOrConsumerType1

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_idString

Long-term persistent identity of the associated Customer

Returns:

  • (String)


23
24
25
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 23

def customer_id
  @customer_id
end

#member_idString

Long term persistent identity of the program member

Returns:

  • (String)


27
28
29
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 27

def member_id
  @member_id
end

#member_numberString

Reward program membership number

Returns:

  • (String)


31
32
33
# File 'lib/fdx_v660_api/models/reward_program_membership_entity.rb', line 31

def member_number
  @member_number
end

#member_tierString

If the reward program is tiered, member's current tier

Returns:

  • (String)


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.
   = hash.key?('accountIds') ? hash['accountIds'] : SKIP
   = 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_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

.namesObject

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

.nullablesObject

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

.optionalsObject

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

#inspectObject

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_sObject

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