Class: ThePlaidApi::CraLoanApplication

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

Overview

Contains loan application data.

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(user_token:, application_id:, type:, decision:, application_date: SKIP, decision_date: SKIP, additional_properties: nil) ⇒ CraLoanApplication

Returns a new instance of CraLoanApplication.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/the_plaid_api/models/cra_loan_application.rb', line 65

def initialize(user_token:, application_id:, type:, decision:,
               application_date: SKIP, decision_date: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @user_token = user_token
  @application_id = application_id
  @type = type
  @decision = decision
  @application_date = application_date unless application_date == SKIP
  @decision_date = decision_date unless decision_date == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#application_dateDate

The date the user applied for the loan. The date should be in ISO 8601 format (YYYY-MM-DD).

Returns:

  • (Date)


33
34
35
# File 'lib/the_plaid_api/models/cra_loan_application.rb', line 33

def application_date
  @application_date
end

#application_idString

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

Returns:

  • (String)


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

def application_id
  @application_id
end

#decisionCraLoanApplicationDecision

The decision of the loan application.



28
29
30
# File 'lib/the_plaid_api/models/cra_loan_application.rb', line 28

def decision
  @decision
end

#decision_dateDate

The date when the loan application’s decision was made. The date should be in ISO 8601 format (YYYY-MM-DD).

Returns:

  • (Date)


38
39
40
# File 'lib/the_plaid_api/models/cra_loan_application.rb', line 38

def decision_date
  @decision_date
end

#typeCraLoanType

The type of loan the user applied for.

Returns:



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

def type
  @type
end

#user_tokenString

The user token for the user associated with the loan.

Returns:

  • (String)


14
15
16
# File 'lib/the_plaid_api/models/cra_loan_application.rb', line 14

def user_token
  @user_token
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
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
# File 'lib/the_plaid_api/models/cra_loan_application.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  user_token = hash.key?('user_token') ? hash['user_token'] : nil
  application_id =
    hash.key?('application_id') ? hash['application_id'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  decision = hash.key?('decision') ? hash['decision'] : nil
  application_date =
    hash.key?('application_date') ? hash['application_date'] : SKIP
  decision_date = hash.key?('decision_date') ? hash['decision_date'] : 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.
  CraLoanApplication.new(user_token: user_token,
                         application_id: application_id,
                         type: type,
                         decision: decision,
                         application_date: application_date,
                         decision_date: decision_date,
                         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/the_plaid_api/models/cra_loan_application.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['user_token'] = 'user_token'
  @_hash['application_id'] = 'application_id'
  @_hash['type'] = 'type'
  @_hash['decision'] = 'decision'
  @_hash['application_date'] = 'application_date'
  @_hash['decision_date'] = 'decision_date'
  @_hash
end

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/the_plaid_api/models/cra_loan_application.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



53
54
55
56
57
58
# File 'lib/the_plaid_api/models/cra_loan_application.rb', line 53

def self.optionals
  %w[
    application_date
    decision_date
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



120
121
122
123
124
125
126
# File 'lib/the_plaid_api/models/cra_loan_application.rb', line 120

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} user_token: #{@user_token.inspect}, application_id:"\
  " #{@application_id.inspect}, type: #{@type.inspect}, decision: #{@decision.inspect},"\
  " application_date: #{@application_date.inspect}, decision_date: #{@decision_date.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



112
113
114
115
116
117
# File 'lib/the_plaid_api/models/cra_loan_application.rb', line 112

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} user_token: #{@user_token}, application_id: #{@application_id}, type:"\
  " #{@type}, decision: #{@decision}, application_date: #{@application_date}, decision_date:"\
  " #{@decision_date}, additional_properties: #{@additional_properties}>"
end