Class: FdxV660Api::PaymentDetailsEntity1

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

Overview

Breakdown of payment details

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(principal_amount: SKIP, interest_amount: SKIP, insurance_amount: SKIP, escrow_amount: SKIP, pmi_amount: SKIP, fees_amount: SKIP, additional_properties: nil) ⇒ PaymentDetailsEntity1

Returns a new instance of PaymentDetailsEntity1.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/fdx_v660_api/models/payment_details_entity1.rb', line 66

def initialize(principal_amount: SKIP, interest_amount: SKIP,
               insurance_amount: SKIP, escrow_amount: SKIP,
               pmi_amount: SKIP, fees_amount: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @principal_amount = principal_amount unless principal_amount == SKIP
  @interest_amount = interest_amount unless interest_amount == SKIP
  @insurance_amount = insurance_amount unless insurance_amount == SKIP
  @escrow_amount = escrow_amount unless escrow_amount == SKIP
  @pmi_amount = pmi_amount unless pmi_amount == SKIP
  @fees_amount = fees_amount unless fees_amount == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#escrow_amountFloat

The amount of payment applied to escrow

Returns:

  • (Float)


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

def escrow_amount
  @escrow_amount
end

#fees_amountFloat

The amount of payment applied to fees

Returns:

  • (Float)


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

def fees_amount
  @fees_amount
end

#insurance_amountFloat

The amount of payment applied to life/health/accident insurance on the loan

Returns:

  • (Float)


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

def insurance_amount
  @insurance_amount
end

#interest_amountFloat

The amount of payment applied to interest

Returns:

  • (Float)


18
19
20
# File 'lib/fdx_v660_api/models/payment_details_entity1.rb', line 18

def interest_amount
  @interest_amount
end

#pmi_amountFloat

The amount of payment applied to PMI

Returns:

  • (Float)


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

def pmi_amount
  @pmi_amount
end

#principal_amountFloat

The amount of payment applied to principal

Returns:

  • (Float)


14
15
16
# File 'lib/fdx_v660_api/models/payment_details_entity1.rb', line 14

def principal_amount
  @principal_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



83
84
85
86
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
# File 'lib/fdx_v660_api/models/payment_details_entity1.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  principal_amount =
    hash.key?('principalAmount') ? hash['principalAmount'] : SKIP
  interest_amount =
    hash.key?('interestAmount') ? hash['interestAmount'] : SKIP
  insurance_amount =
    hash.key?('insuranceAmount') ? hash['insuranceAmount'] : SKIP
  escrow_amount = hash.key?('escrowAmount') ? hash['escrowAmount'] : SKIP
  pmi_amount = hash.key?('pmiAmount') ? hash['pmiAmount'] : SKIP
  fees_amount = hash.key?('feesAmount') ? hash['feesAmount'] : 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.
  PaymentDetailsEntity1.new(principal_amount: principal_amount,
                            interest_amount: interest_amount,
                            insurance_amount: insurance_amount,
                            escrow_amount: escrow_amount,
                            pmi_amount: pmi_amount,
                            fees_amount: fees_amount,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
# File 'lib/fdx_v660_api/models/payment_details_entity1.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['principal_amount'] = 'principalAmount'
  @_hash['interest_amount'] = 'interestAmount'
  @_hash['insurance_amount'] = 'insuranceAmount'
  @_hash['escrow_amount'] = 'escrowAmount'
  @_hash['pmi_amount'] = 'pmiAmount'
  @_hash['fees_amount'] = 'feesAmount'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/fdx_v660_api/models/payment_details_entity1.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
57
58
59
# File 'lib/fdx_v660_api/models/payment_details_entity1.rb', line 50

def self.optionals
  %w[
    principal_amount
    interest_amount
    insurance_amount
    escrow_amount
    pmi_amount
    fees_amount
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



116
117
118
119
120
121
122
# File 'lib/fdx_v660_api/models/payment_details_entity1.rb', line 116

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.



134
135
136
137
138
139
140
# File 'lib/fdx_v660_api/models/payment_details_entity1.rb', line 134

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} principal_amount: #{@principal_amount.inspect}, interest_amount:"\
  " #{@interest_amount.inspect}, insurance_amount: #{@insurance_amount.inspect},"\
  " escrow_amount: #{@escrow_amount.inspect}, pmi_amount: #{@pmi_amount.inspect}, fees_amount:"\
  " #{@fees_amount.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



125
126
127
128
129
130
131
# File 'lib/fdx_v660_api/models/payment_details_entity1.rb', line 125

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} principal_amount: #{@principal_amount}, interest_amount:"\
  " #{@interest_amount}, insurance_amount: #{@insurance_amount}, escrow_amount:"\
  " #{@escrow_amount}, pmi_amount: #{@pmi_amount}, fees_amount: #{@fees_amount},"\
  " additional_properties: #{@additional_properties}>"
end