Class: ThePlaidApi::CraPartnerInsights

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

Overview

The Partner Insights report of the bank data for an end user.

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: SKIP, generated_time: SKIP, client_report_id: SKIP, fico: SKIP, prism: SKIP, items: SKIP, additional_properties: nil) ⇒ CraPartnerInsights

Returns a new instance of CraPartnerInsights.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/the_plaid_api/models/cra_partner_insights.rb', line 73

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

  @report_id = report_id unless report_id == SKIP
  @generated_time = generated_time unless generated_time == SKIP
  @client_report_id = client_report_id unless client_report_id == SKIP
  @fico = fico unless fico == SKIP
  @prism = prism unless prism == SKIP
  @items = items unless items == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#client_report_idString

Client-generated identifier, which can be used by lenders to track loan applications.

Returns:

  • (String)


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

def client_report_id
  @client_report_id
end

#ficoCraPartnerInsightsFicoResults

The calculated UltraFICO scores returned as part of the Partner Insights report.



29
30
31
# File 'lib/the_plaid_api/models/cra_partner_insights.rb', line 29

def fico
  @fico
end

#generated_timeDateTime

The time when the Partner Insights report was generated.

Returns:

  • (DateTime)


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

def generated_time
  @generated_time
end

#itemsArray[CraPartnerInsightsItem]

The list of Items used in the report along with the associated metadata about the Item.

Returns:



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

def items
  @items
end

#prismCraPartnerInsightsPrism

The Prism Data insights for the user.



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

def prism
  @prism
end

#report_idString

A unique identifier associated with the Partner Insights object.

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/cra_partner_insights.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.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/the_plaid_api/models/cra_partner_insights.rb', line 89

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  report_id = hash.key?('report_id') ? hash['report_id'] : SKIP
  generated_time = if hash.key?('generated_time')
                     (DateTimeHelper.from_rfc3339(hash['generated_time']) if hash['generated_time'])
                   else
                     SKIP
                   end
  client_report_id =
    hash.key?('client_report_id') ? hash['client_report_id'] : SKIP
  fico = CraPartnerInsightsFicoResults.from_hash(hash['fico']) if hash['fico']
  prism = CraPartnerInsightsPrism.from_hash(hash['prism']) if hash['prism']
  # Parameter is an array, so we need to iterate through it
  items = nil
  unless hash['items'].nil?
    items = []
    hash['items'].each do |structure|
      items << (CraPartnerInsightsItem.from_hash(structure) if structure)
    end
  end

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

  # 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.
  CraPartnerInsights.new(report_id: report_id,
                         generated_time: generated_time,
                         client_report_id: client_report_id,
                         fico: fico,
                         prism: prism,
                         items: items,
                         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_partner_insights.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['report_id'] = 'report_id'
  @_hash['generated_time'] = 'generated_time'
  @_hash['client_report_id'] = 'client_report_id'
  @_hash['fico'] = 'fico'
  @_hash['prism'] = 'prism'
  @_hash['items'] = 'items'
  @_hash
end

.nullablesObject

An array for nullable fields



65
66
67
68
69
70
71
# File 'lib/the_plaid_api/models/cra_partner_insights.rb', line 65

def self.nullables
  %w[
    client_report_id
    fico
    prism
  ]
end

.optionalsObject

An array for optional fields



53
54
55
56
57
58
59
60
61
62
# File 'lib/the_plaid_api/models/cra_partner_insights.rb', line 53

def self.optionals
  %w[
    report_id
    generated_time
    client_report_id
    fico
    prism
    items
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



144
145
146
147
148
149
150
# File 'lib/the_plaid_api/models/cra_partner_insights.rb', line 144

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

#to_custom_generated_timeObject



131
132
133
# File 'lib/the_plaid_api/models/cra_partner_insights.rb', line 131

def to_custom_generated_time
  DateTimeHelper.to_rfc3339(generated_time)
end

#to_sObject

Provides a human-readable string representation of the object.



136
137
138
139
140
141
# File 'lib/the_plaid_api/models/cra_partner_insights.rb', line 136

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