Class: FdxV660Api::BaseDepositAccountTermsAndConditions

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/base_deposit_account_terms_and_conditions.rb

Overview

Base type for initial and current terms and conditions for deposit accounts

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_category:, product_id: SKIP, uris: SKIP, rewards_terms_and_conditions: SKIP, initial: SKIP, current: SKIP, additional_properties: nil) ⇒ BaseDepositAccountTermsAndConditions

Returns a new instance of BaseDepositAccountTermsAndConditions.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/fdx_v660_api/models/base_deposit_account_terms_and_conditions.rb', line 68

def initialize(account_category:, product_id: SKIP, uris: SKIP,
               rewards_terms_and_conditions: SKIP, initial: SKIP,
               current: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @product_id = product_id unless product_id == SKIP
  @uris = uris unless uris == SKIP
  unless rewards_terms_and_conditions == SKIP
    @rewards_terms_and_conditions =
      rewards_terms_and_conditions
  end
  @account_category = 
  @initial = initial unless initial == SKIP
  @current = current unless current == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_categoryAccountCategoryDepositType2

The specific Account types which have Deposit Terms and Conditions



29
30
31
# File 'lib/fdx_v660_api/models/base_deposit_account_terms_and_conditions.rb', line 29

def 
  @account_category
end

#currentDepositAccountTermsAndConditionsEntity1

Any data elements which have been updated since original Terms and Conditions



38
39
40
# File 'lib/fdx_v660_api/models/base_deposit_account_terms_and_conditions.rb', line 38

def current
  @current
end

#initialDepositAccountTermsAndConditionsEntity3

The initial Terms and Conditions for this deposit account



33
34
35
# File 'lib/fdx_v660_api/models/base_deposit_account_terms_and_conditions.rb', line 33

def initial
  @initial
end

#product_idString

Unique ID of the marketed product for which these are the Terms and Conditions

Returns:

  • (String)


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

def product_id
  @product_id
end

#rewards_terms_and_conditionsRewardsTermsAndConditionsEntity2

The PDFs or JSON data elements for the terms and conditions for the account's reward program (and reward categories, if any)



25
26
27
# File 'lib/fdx_v660_api/models/base_deposit_account_terms_and_conditions.rb', line 25

def rewards_terms_and_conditions
  @rewards_terms_and_conditions
end

#urisArray[TermsAndConditionsUriEntity]

Static public-facing URIs which return initial or latest account terms and conditions as PDF files or web content

Returns:



20
21
22
# File 'lib/fdx_v660_api/models/base_deposit_account_terms_and_conditions.rb', line 20

def uris
  @uris
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
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
126
127
# File 'lib/fdx_v660_api/models/base_deposit_account_terms_and_conditions.rb', line 87

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   =
    hash.key?('accountCategory') ? hash['accountCategory'] : nil
  product_id = hash.key?('productId') ? hash['productId'] : SKIP
  # Parameter is an array, so we need to iterate through it
  uris = nil
  unless hash['uris'].nil?
    uris = []
    hash['uris'].each do |structure|
      uris << (TermsAndConditionsUriEntity.from_hash(structure) if structure)
    end
  end

  uris = SKIP unless hash.key?('uris')
  if hash['rewardsTermsAndConditions']
    rewards_terms_and_conditions = RewardsTermsAndConditionsEntity2.from_hash(hash['rewardsTermsAndConditions'])
  end
  initial = DepositAccountTermsAndConditionsEntity3.from_hash(hash['initial']) if
    hash['initial']
  current = DepositAccountTermsAndConditionsEntity1.from_hash(hash['current']) if
    hash['current']

  # 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.
  BaseDepositAccountTermsAndConditions.new(account_category: ,
                                           product_id: product_id,
                                           uris: uris,
                                           rewards_terms_and_conditions: rewards_terms_and_conditions,
                                           initial: initial,
                                           current: current,
                                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
# File 'lib/fdx_v660_api/models/base_deposit_account_terms_and_conditions.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['product_id'] = 'productId'
  @_hash['uris'] = 'uris'
  @_hash['rewards_terms_and_conditions'] = 'rewardsTermsAndConditions'
  @_hash['account_category'] = 'accountCategory'
  @_hash['initial'] = 'initial'
  @_hash['current'] = 'current'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
# File 'lib/fdx_v660_api/models/base_deposit_account_terms_and_conditions.rb', line 64

def self.nullables
  []
end

.optionalsObject

An array for optional fields



53
54
55
56
57
58
59
60
61
# File 'lib/fdx_v660_api/models/base_deposit_account_terms_and_conditions.rb', line 53

def self.optionals
  %w[
    product_id
    uris
    rewards_terms_and_conditions
    initial
    current
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



131
132
133
134
135
136
137
138
139
140
141
# File 'lib/fdx_v660_api/models/base_deposit_account_terms_and_conditions.rb', line 131

def self.validate(value)
  if value.instance_of? self
    return APIHelper.valid_type?(value.,
                                 ->(val) { AccountCategoryDepositType2.validate(val) })
  end

  return false unless value.instance_of? Hash

  APIHelper.valid_type?(value['accountCategory'],
                        ->(val) { AccountCategoryDepositType2.validate(val) })
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



152
153
154
155
156
157
158
# File 'lib/fdx_v660_api/models/base_deposit_account_terms_and_conditions.rb', line 152

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} product_id: #{@product_id.inspect}, uris: #{@uris.inspect},"\
  " rewards_terms_and_conditions: #{@rewards_terms_and_conditions.inspect}, account_category:"\
  " #{@account_category.inspect}, initial: #{@initial.inspect}, current: #{@current.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



144
145
146
147
148
149
# File 'lib/fdx_v660_api/models/base_deposit_account_terms_and_conditions.rb', line 144

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} product_id: #{@product_id}, uris: #{@uris}, rewards_terms_and_conditions:"\
  " #{@rewards_terms_and_conditions}, account_category: #{@account_category}, initial:"\
  " #{@initial}, current: #{@current}, additional_properties: #{@additional_properties}>"
end