Class: ThePlaidApi::CraLendScoreReport

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

Overview

Contains data for the CRA LendScore Report.

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(report_id:, generated_time:, lend_score: SKIP, additional_properties: nil) ⇒ CraLendScoreReport

Returns a new instance of CraLendScoreReport.



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

def initialize(report_id:, generated_time:, lend_score: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @report_id = report_id
  @generated_time = generated_time
  @lend_score = lend_score unless lend_score == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#generated_timeDateTime

The time when the report was generated.

Returns:

  • (DateTime)


19
20
21
# File 'lib/the_plaid_api/models/cra_lend_score_report.rb', line 19

def generated_time
  @generated_time
end

#lend_scoreLendScore

The results of the LendScore

Returns:



23
24
25
# File 'lib/the_plaid_api/models/cra_lend_score_report.rb', line 23

def lend_score
  @lend_score
end

#report_idString

The unique identifier associated with the report object.

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/cra_lend_score_report.rb', line 15

def report_id
  @report_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/the_plaid_api/models/cra_lend_score_report.rb', line 60

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  report_id = hash.key?('report_id') ? hash['report_id'] : nil
  generated_time = if hash.key?('generated_time')
                     (DateTimeHelper.from_rfc3339(hash['generated_time']) if hash['generated_time'])
                   end
  lend_score = LendScore.from_hash(hash['lend_score']) if hash['lend_score']

  # 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.
  CraLendScoreReport.new(report_id: report_id,
                         generated_time: generated_time,
                         lend_score: lend_score,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['report_id'] = 'report_id'
  @_hash['generated_time'] = 'generated_time'
  @_hash['lend_score'] = 'lend_score'
  @_hash
end

.nullablesObject

An array for nullable fields



42
43
44
45
46
# File 'lib/the_plaid_api/models/cra_lend_score_report.rb', line 42

def self.nullables
  %w[
    lend_score
  ]
end

.optionalsObject

An array for optional fields



35
36
37
38
39
# File 'lib/the_plaid_api/models/cra_lend_score_report.rb', line 35

def self.optionals
  %w[
    lend_score
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



96
97
98
99
100
101
# File 'lib/the_plaid_api/models/cra_lend_score_report.rb', line 96

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

#to_custom_generated_timeObject



84
85
86
# File 'lib/the_plaid_api/models/cra_lend_score_report.rb', line 84

def to_custom_generated_time
  DateTimeHelper.to_rfc3339(generated_time)
end

#to_sObject

Provides a human-readable string representation of the object.



89
90
91
92
93
# File 'lib/the_plaid_api/models/cra_lend_score_report.rb', line 89

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