Class: FdxV660Api::InvestmentLoanEntity

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

Overview

Any loan information against an investment account

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(loan_id: SKIP, loan_description: SKIP, initial_loan_balance: SKIP, loan_start_date: SKIP, current_loan_balance: SKIP, date_as_of: SKIP, loan_rate: SKIP, loan_payment_amount: SKIP, loan_payment_frequency: SKIP, loan_payment_initial: SKIP, loan_payments_remaining: SKIP, loan_maturity_date: SKIP, loan_interest_to_date: SKIP, loan_total_projected_interest: SKIP, loan_next_payment_date: SKIP, additional_properties: nil) ⇒ InvestmentLoanEntity

Returns a new instance of InvestmentLoanEntity.



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 120

def initialize(loan_id: SKIP, loan_description: SKIP,
               initial_loan_balance: SKIP, loan_start_date: SKIP,
               current_loan_balance: SKIP, date_as_of: SKIP,
               loan_rate: SKIP, loan_payment_amount: SKIP,
               loan_payment_frequency: SKIP, loan_payment_initial: SKIP,
               loan_payments_remaining: SKIP, loan_maturity_date: SKIP,
               loan_interest_to_date: SKIP,
               loan_total_projected_interest: SKIP,
               loan_next_payment_date: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @loan_id = loan_id unless loan_id == SKIP
  @loan_description = loan_description unless loan_description == SKIP
  @initial_loan_balance = initial_loan_balance unless initial_loan_balance == SKIP
  @loan_start_date = loan_start_date unless loan_start_date == SKIP
  @current_loan_balance = current_loan_balance unless current_loan_balance == SKIP
  @date_as_of = date_as_of unless date_as_of == SKIP
  @loan_rate = loan_rate unless loan_rate == SKIP
  @loan_payment_amount = loan_payment_amount unless loan_payment_amount == SKIP
  @loan_payment_frequency = loan_payment_frequency unless loan_payment_frequency == SKIP
  @loan_payment_initial = loan_payment_initial unless loan_payment_initial == SKIP
  @loan_payments_remaining = loan_payments_remaining unless loan_payments_remaining == SKIP
  @loan_maturity_date = loan_maturity_date unless loan_maturity_date == SKIP
  @loan_interest_to_date = loan_interest_to_date unless loan_interest_to_date == SKIP
  unless loan_total_projected_interest == SKIP
    @loan_total_projected_interest =
      loan_total_projected_interest
  end
  @loan_next_payment_date = loan_next_payment_date unless loan_next_payment_date == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#current_loan_balanceFloat

Current loan principal balance amount

Returns:

  • (Float)


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

def current_loan_balance
  @current_loan_balance
end

#date_as_ofDateTime

Date and time of current loan balance

Returns:

  • (DateTime)


35
36
37
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 35

def date_as_of
  @date_as_of
end

#initial_loan_balanceFloat

Initial loan balance amount

Returns:

  • (Float)


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

def initial_loan_balance
  @initial_loan_balance
end

#loan_descriptionString

Description of loan

Returns:

  • (String)


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

def loan_description
  @loan_description
end

#loan_idString

Unique identifier for this loan

Returns:

  • (String)


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

def loan_id
  @loan_id
end

#loan_interest_to_dateFloat

Total interest paid to date on this loan

Returns:

  • (Float)


63
64
65
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 63

def loan_interest_to_date
  @loan_interest_to_date
end

#loan_maturity_dateDate

Expected loan end date

Returns:

  • (Date)


59
60
61
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 59

def loan_maturity_date
  @loan_maturity_date
end

#loan_next_payment_dateDate

The next payment date for the loan

Returns:

  • (Date)


71
72
73
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 71

def loan_next_payment_date
  @loan_next_payment_date
end

#loan_payment_amountFloat

Loan payment amount

Returns:

  • (Float)


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

def loan_payment_amount
  @loan_payment_amount
end

#loan_payment_frequencyEventFrequency2

Defines how often the loan payment repeats

Returns:



47
48
49
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 47

def loan_payment_frequency
  @loan_payment_frequency
end

#loan_payment_initialFloat

Initial number of loan payments

Returns:

  • (Float)


51
52
53
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 51

def loan_payment_initial
  @loan_payment_initial
end

#loan_payments_remainingInteger

Remaining number of loan payments

Returns:

  • (Integer)


55
56
57
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 55

def loan_payments_remaining
  @loan_payments_remaining
end

#loan_rateFloat

Loan annual interest rate for the loan

Returns:

  • (Float)


39
40
41
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 39

def loan_rate
  @loan_rate
end

#loan_start_dateDate

Start date of the loan

Returns:

  • (Date)


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

def loan_start_date
  @loan_start_date
end

#loan_total_projected_interestFloat

Total projected interest to be paid on this loan

Returns:

  • (Float)


67
68
69
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 67

def loan_total_projected_interest
  @loan_total_projected_interest
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 154

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  loan_id = hash.key?('loanId') ? hash['loanId'] : SKIP
  loan_description =
    hash.key?('loanDescription') ? hash['loanDescription'] : SKIP
  initial_loan_balance =
    hash.key?('initialLoanBalance') ? hash['initialLoanBalance'] : SKIP
  loan_start_date =
    hash.key?('loanStartDate') ? hash['loanStartDate'] : SKIP
  current_loan_balance =
    hash.key?('currentLoanBalance') ? hash['currentLoanBalance'] : SKIP
  date_as_of = if hash.key?('dateAsOf')
                 (DateTimeHelper.from_rfc3339(hash['dateAsOf']) if hash['dateAsOf'])
               else
                 SKIP
               end
  loan_rate = hash.key?('loanRate') ? hash['loanRate'] : SKIP
  loan_payment_amount =
    hash.key?('loanPaymentAmount') ? hash['loanPaymentAmount'] : SKIP
  loan_payment_frequency =
    hash.key?('loanPaymentFrequency') ? hash['loanPaymentFrequency'] : SKIP
  loan_payment_initial =
    hash.key?('loanPaymentInitial') ? hash['loanPaymentInitial'] : SKIP
  loan_payments_remaining =
    hash.key?('loanPaymentsRemaining') ? hash['loanPaymentsRemaining'] : SKIP
  loan_maturity_date =
    hash.key?('loanMaturityDate') ? hash['loanMaturityDate'] : SKIP
  loan_interest_to_date =
    hash.key?('loanInterestToDate') ? hash['loanInterestToDate'] : SKIP
  loan_total_projected_interest =
    hash.key?('loanTotalProjectedInterest') ? hash['loanTotalProjectedInterest'] : SKIP
  loan_next_payment_date =
    hash.key?('loanNextPaymentDate') ? hash['loanNextPaymentDate'] : 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.
  InvestmentLoanEntity.new(loan_id: loan_id,
                           loan_description: loan_description,
                           initial_loan_balance: initial_loan_balance,
                           loan_start_date: loan_start_date,
                           current_loan_balance: current_loan_balance,
                           date_as_of: date_as_of,
                           loan_rate: loan_rate,
                           loan_payment_amount: loan_payment_amount,
                           loan_payment_frequency: loan_payment_frequency,
                           loan_payment_initial: loan_payment_initial,
                           loan_payments_remaining: loan_payments_remaining,
                           loan_maturity_date: loan_maturity_date,
                           loan_interest_to_date: loan_interest_to_date,
                           loan_total_projected_interest: loan_total_projected_interest,
                           loan_next_payment_date: loan_next_payment_date,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 74

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['loan_id'] = 'loanId'
  @_hash['loan_description'] = 'loanDescription'
  @_hash['initial_loan_balance'] = 'initialLoanBalance'
  @_hash['loan_start_date'] = 'loanStartDate'
  @_hash['current_loan_balance'] = 'currentLoanBalance'
  @_hash['date_as_of'] = 'dateAsOf'
  @_hash['loan_rate'] = 'loanRate'
  @_hash['loan_payment_amount'] = 'loanPaymentAmount'
  @_hash['loan_payment_frequency'] = 'loanPaymentFrequency'
  @_hash['loan_payment_initial'] = 'loanPaymentInitial'
  @_hash['loan_payments_remaining'] = 'loanPaymentsRemaining'
  @_hash['loan_maturity_date'] = 'loanMaturityDate'
  @_hash['loan_interest_to_date'] = 'loanInterestToDate'
  @_hash['loan_total_projected_interest'] = 'loanTotalProjectedInterest'
  @_hash['loan_next_payment_date'] = 'loanNextPaymentDate'
  @_hash
end

.nullablesObject

An array for nullable fields



116
117
118
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 116

def self.nullables
  []
end

.optionalsObject

An array for optional fields



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 95

def self.optionals
  %w[
    loan_id
    loan_description
    initial_loan_balance
    loan_start_date
    current_loan_balance
    date_as_of
    loan_rate
    loan_payment_amount
    loan_payment_frequency
    loan_payment_initial
    loan_payments_remaining
    loan_maturity_date
    loan_interest_to_date
    loan_total_projected_interest
    loan_next_payment_date
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



222
223
224
225
226
227
228
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 222

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 245

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} loan_id: #{@loan_id.inspect}, loan_description:"\
  " #{@loan_description.inspect}, initial_loan_balance: #{@initial_loan_balance.inspect},"\
  " loan_start_date: #{@loan_start_date.inspect}, current_loan_balance:"\
  " #{@current_loan_balance.inspect}, date_as_of: #{@date_as_of.inspect}, loan_rate:"\
  " #{@loan_rate.inspect}, loan_payment_amount: #{@loan_payment_amount.inspect},"\
  " loan_payment_frequency: #{@loan_payment_frequency.inspect}, loan_payment_initial:"\
  " #{@loan_payment_initial.inspect}, loan_payments_remaining:"\
  " #{@loan_payments_remaining.inspect}, loan_maturity_date: #{@loan_maturity_date.inspect},"\
  " loan_interest_to_date: #{@loan_interest_to_date.inspect}, loan_total_projected_interest:"\
  " #{@loan_total_projected_interest.inspect}, loan_next_payment_date:"\
  " #{@loan_next_payment_date.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_date_as_ofObject



216
217
218
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 216

def to_custom_date_as_of
  DateTimeHelper.to_rfc3339(date_as_of)
end

#to_sObject

Provides a human-readable string representation of the object.



231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/fdx_v660_api/models/investment_loan_entity.rb', line 231

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} loan_id: #{@loan_id}, loan_description: #{@loan_description},"\
  " initial_loan_balance: #{@initial_loan_balance}, loan_start_date: #{@loan_start_date},"\
  " current_loan_balance: #{@current_loan_balance}, date_as_of: #{@date_as_of}, loan_rate:"\
  " #{@loan_rate}, loan_payment_amount: #{@loan_payment_amount}, loan_payment_frequency:"\
  " #{@loan_payment_frequency}, loan_payment_initial: #{@loan_payment_initial},"\
  " loan_payments_remaining: #{@loan_payments_remaining}, loan_maturity_date:"\
  " #{@loan_maturity_date}, loan_interest_to_date: #{@loan_interest_to_date},"\
  " loan_total_projected_interest: #{@loan_total_projected_interest}, loan_next_payment_date:"\
  " #{@loan_next_payment_date}, additional_properties: #{@additional_properties}>"
end