Class: ThePlaidApi::CraLoanUpdate

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/cra_loan_update.rb

Overview

Contains loan data to update.

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, status_history: SKIP, payment_history: SKIP, additional_properties: nil) ⇒ CraLoanUpdate

Returns a new instance of CraLoanUpdate.



49
50
51
52
53
54
55
56
57
58
# File 'lib/the_plaid_api/models/cra_loan_update.rb', line 49

def initialize(loan_id: SKIP, status_history: SKIP, payment_history: 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
  @status_history = status_history unless status_history == SKIP
  @payment_history = payment_history unless payment_history == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#loan_idString

A unique identifier for the loan. Personally identifiable information, such as an email address or phone number, should not be used in the ‘loan_id`.

Returns:

  • (String)


16
17
18
# File 'lib/the_plaid_api/models/cra_loan_update.rb', line 16

def loan_id
  @loan_id
end

#payment_historyArray[CraLoanPaymentHistory]

The updates to the payment history for the loan.

Returns:



24
25
26
# File 'lib/the_plaid_api/models/cra_loan_update.rb', line 24

def payment_history
  @payment_history
end

#status_historyArray[CraLoanStatusHistoryUpdate]

A list of status update history of the loan.

Returns:



20
21
22
# File 'lib/the_plaid_api/models/cra_loan_update.rb', line 20

def status_history
  @status_history
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/the_plaid_api/models/cra_loan_update.rb', line 61

def self.from_hash(hash)
  return nil unless hash

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

  status_history = SKIP unless hash.key?('status_history')
  # Parameter is an array, so we need to iterate through it
  payment_history = nil
  unless hash['payment_history'].nil?
    payment_history = []
    hash['payment_history'].each do |structure|
      payment_history << (CraLoanPaymentHistory.from_hash(structure) if structure)
    end
  end

  payment_history = SKIP unless hash.key?('payment_history')

  # 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.
  CraLoanUpdate.new(loan_id: loan_id,
                    status_history: status_history,
                    payment_history: payment_history,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



27
28
29
30
31
32
33
# File 'lib/the_plaid_api/models/cra_loan_update.rb', line 27

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['loan_id'] = 'loan_id'
  @_hash['status_history'] = 'status_history'
  @_hash['payment_history'] = 'payment_history'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/the_plaid_api/models/cra_loan_update.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



36
37
38
39
40
41
42
# File 'lib/the_plaid_api/models/cra_loan_update.rb', line 36

def self.optionals
  %w[
    loan_id
    status_history
    payment_history
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



109
110
111
112
113
114
# File 'lib/the_plaid_api/models/cra_loan_update.rb', line 109

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} loan_id: #{@loan_id.inspect}, status_history: #{@status_history.inspect},"\
  " payment_history: #{@payment_history.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



102
103
104
105
106
# File 'lib/the_plaid_api/models/cra_loan_update.rb', line 102

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} loan_id: #{@loan_id}, status_history: #{@status_history}, payment_history:"\
  " #{@payment_history}, additional_properties: #{@additional_properties}>"
end