Class: ThePlaidApi::CreditPayrollIncomeGetResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::CreditPayrollIncomeGetResponse
- Defined in:
- lib/the_plaid_api/models/credit_payroll_income_get_response.rb
Overview
Defines the response body for ‘/credit/payroll_income/get`.
Instance Attribute Summary collapse
-
#error ⇒ Error
Errors are identified by ‘error_code` and categorized by `error_type`.
-
#items ⇒ Array[PayrollItem]
Array of payroll items.
-
#request_id ⇒ String
A unique identifier for the request, which can be used for troubleshooting.
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(items:, request_id:, error: SKIP, additional_properties: nil) ⇒ CreditPayrollIncomeGetResponse
constructor
A new instance of CreditPayrollIncomeGetResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(items:, request_id:, error: SKIP, additional_properties: nil) ⇒ CreditPayrollIncomeGetResponse
Returns a new instance of CreditPayrollIncomeGetResponse.
57 58 59 60 61 62 63 64 65 |
# File 'lib/the_plaid_api/models/credit_payroll_income_get_response.rb', line 57 def initialize(items:, request_id:, error: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @items = items @error = error unless error == SKIP @request_id = request_id @additional_properties = additional_properties end |
Instance Attribute Details
#error ⇒ Error
Errors are identified by ‘error_code` and categorized by `error_type`. Use these in preference to HTTP status codes to identify and handle specific errors. HTTP status codes are set and provide the broadest categorization of errors: 4xx codes are for developer- or user-related errors, and 5xx codes are for Plaid-related errors, and the status will be 2xx in non-error cases. An Item with a non-`null` error object will only be part of an API response when calling `/item/get` to view Item status. Otherwise, error fields will be `null` if no error has occurred; if an error has occurred, an error code will be returned instead.
26 27 28 |
# File 'lib/the_plaid_api/models/credit_payroll_income_get_response.rb', line 26 def error @error end |
#items ⇒ Array[PayrollItem]
Array of payroll items.
14 15 16 |
# File 'lib/the_plaid_api/models/credit_payroll_income_get_response.rb', line 14 def items @items end |
#request_id ⇒ String
A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.
32 33 34 |
# File 'lib/the_plaid_api/models/credit_payroll_income_get_response.rb', line 32 def request_id @request_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/the_plaid_api/models/credit_payroll_income_get_response.rb', line 68 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it items = nil unless hash['items'].nil? items = [] hash['items'].each do |structure| items << (PayrollItem.from_hash(structure) if structure) end end items = nil unless hash.key?('items') request_id = hash.key?('request_id') ? hash['request_id'] : nil error = Error.from_hash(hash['error']) if hash['error'] # 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. CreditPayrollIncomeGetResponse.new(items: items, request_id: request_id, error: error, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 |
# File 'lib/the_plaid_api/models/credit_payroll_income_get_response.rb', line 35 def self.names @_hash = {} if @_hash.nil? @_hash['items'] = 'items' @_hash['error'] = 'error' @_hash['request_id'] = 'request_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 54 55 |
# File 'lib/the_plaid_api/models/credit_payroll_income_get_response.rb', line 51 def self.nullables %w[ error ] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 |
# File 'lib/the_plaid_api/models/credit_payroll_income_get_response.rb', line 44 def self.optionals %w[ error ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
107 108 109 110 111 |
# File 'lib/the_plaid_api/models/credit_payroll_income_get_response.rb', line 107 def inspect class_name = self.class.name.split('::').last "<#{class_name} items: #{@items.inspect}, error: #{@error.inspect}, request_id:"\ " #{@request_id.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
100 101 102 103 104 |
# File 'lib/the_plaid_api/models/credit_payroll_income_get_response.rb', line 100 def to_s class_name = self.class.name.split('::').last "<#{class_name} items: #{@items}, error: #{@error}, request_id: #{@request_id},"\ " additional_properties: #{@additional_properties}>" end |