Class: ThePlaidApi::AssetReport
- Defined in:
- lib/the_plaid_api/models/asset_report.rb
Overview
An object representing an Asset Report
Instance Attribute Summary collapse
-
#asset_report_id ⇒ String
A unique ID identifying an Asset Report.
-
#client_report_id ⇒ String
An identifier you determine and submit for the Asset Report.
-
#date_generated ⇒ DateTime
The date and time when the Asset Report was created, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (e.g. “2018-04-12T03:32:11Z”).
-
#days_requested ⇒ Float
The duration of transaction history you requested.
-
#insights ⇒ AccountInsights
This is a container object for all lending-related insights.
-
#items ⇒ Array[AssetReportItem]
Data returned by Plaid about each of the Items included in the Asset Report.
-
#user ⇒ AssetReportUser
The user object allows you to provide additional information about the user to be appended to the Asset Report.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(asset_report_id:, client_report_id:, date_generated:, days_requested:, user:, items:, insights: SKIP, additional_properties: nil) ⇒ AssetReport
constructor
A new instance of AssetReport.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_date_generated ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(asset_report_id:, client_report_id:, date_generated:, days_requested:, user:, items:, insights: SKIP, additional_properties: nil) ⇒ AssetReport
Returns a new instance of AssetReport.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 77 def initialize(asset_report_id:, client_report_id:, date_generated:, days_requested:, user:, items:, insights: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @asset_report_id = asset_report_id @insights = insights unless insights == SKIP @client_report_id = client_report_id @date_generated = date_generated @days_requested = days_requested @user = user @items = items @additional_properties = additional_properties end |
Instance Attribute Details
#asset_report_id ⇒ String
A unique ID identifying an Asset Report. Like all Plaid identifiers, this ID is case sensitive.
16 17 18 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 16 def asset_report_id @asset_report_id end |
#client_report_id ⇒ String
An identifier you determine and submit for the Asset Report.
25 26 27 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 25 def client_report_id @client_report_id end |
#date_generated ⇒ DateTime
The date and time when the Asset Report was created, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (e.g. “2018-04-12T03:32:11Z”).
31 32 33 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 31 def date_generated @date_generated end |
#days_requested ⇒ Float
The duration of transaction history you requested
35 36 37 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 35 def days_requested @days_requested end |
#insights ⇒ AccountInsights
This is a container object for all lending-related insights. This field will be returned only for European customers.
21 22 23 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 21 def insights @insights end |
#items ⇒ Array[AssetReportItem]
Data returned by Plaid about each of the Items included in the Asset Report.
47 48 49 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 47 def items @items end |
#user ⇒ AssetReportUser
The user object allows you to provide additional information about the user to be appended to the Asset Report. All fields are optional. The ‘first_name`, `last_name`, and `ssn` fields are required if you would like the Report to be eligible for Fannie Mae’s Day 1 Certainty™ program.
42 43 44 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 42 def user @user end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 130 131 132 133 134 135 136 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 94 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. asset_report_id = hash.key?('asset_report_id') ? hash['asset_report_id'] : nil client_report_id = hash.key?('client_report_id') ? hash['client_report_id'] : nil date_generated = if hash.key?('date_generated') (DateTimeHelper.from_rfc3339(hash['date_generated']) if hash['date_generated']) end days_requested = hash.key?('days_requested') ? hash['days_requested'] : nil user = AssetReportUser.from_hash(hash['user']) if hash['user'] # Parameter is an array, so we need to iterate through it items = nil unless hash['items'].nil? items = [] hash['items'].each do |structure| items << (AssetReportItem.from_hash(structure) if structure) end end items = nil unless hash.key?('items') insights = AccountInsights.from_hash(hash['insights']) if hash['insights'] # 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. AssetReport.new(asset_report_id: asset_report_id, client_report_id: client_report_id, date_generated: date_generated, days_requested: days_requested, user: user, items: items, insights: insights, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 50 def self.names @_hash = {} if @_hash.nil? @_hash['asset_report_id'] = 'asset_report_id' @_hash['insights'] = 'insights' @_hash['client_report_id'] = 'client_report_id' @_hash['date_generated'] = 'date_generated' @_hash['days_requested'] = 'days_requested' @_hash['user'] = 'user' @_hash['items'] = 'items' @_hash end |
.nullables ⇒ Object
An array for nullable fields
70 71 72 73 74 75 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 70 def self.nullables %w[ insights client_report_id ] end |
.optionals ⇒ Object
An array for optional fields
63 64 65 66 67 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 63 def self.optionals %w[ insights ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
152 153 154 155 156 157 158 159 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 152 def inspect class_name = self.class.name.split('::').last "<#{class_name} asset_report_id: #{@asset_report_id.inspect}, insights:"\ " #{@insights.inspect}, client_report_id: #{@client_report_id.inspect}, date_generated:"\ " #{@date_generated.inspect}, days_requested: #{@days_requested.inspect}, user:"\ " #{@user.inspect}, items: #{@items.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_date_generated ⇒ Object
138 139 140 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 138 def to_custom_date_generated DateTimeHelper.to_rfc3339(date_generated) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
143 144 145 146 147 148 149 |
# File 'lib/the_plaid_api/models/asset_report.rb', line 143 def to_s class_name = self.class.name.split('::').last "<#{class_name} asset_report_id: #{@asset_report_id}, insights: #{@insights},"\ " client_report_id: #{@client_report_id}, date_generated: #{@date_generated},"\ " days_requested: #{@days_requested}, user: #{@user}, items: #{@items},"\ " additional_properties: #{@additional_properties}>" end |