Class: ThePlaidApi::PayrollIncomeObject
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::PayrollIncomeObject
- Defined in:
- lib/the_plaid_api/models/payroll_income_object.rb
Overview
An object representing payroll data.
Instance Attribute Summary collapse
-
#account_id ⇒ String
ID of the payroll provider account.
-
#form1099s ⇒ Array[Credit1099]
Array of tax form 1099s.
-
#pay_stubs ⇒ Array[CreditPayStub]
Array of pay stubs for the user.
-
#w2s ⇒ Array[CreditW2]
Array of tax form W-2s.
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(account_id:, pay_stubs:, w2s:, form1099s:, additional_properties: nil) ⇒ PayrollIncomeObject
constructor
A new instance of PayrollIncomeObject.
-
#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(account_id:, pay_stubs:, w2s:, form1099s:, additional_properties: nil) ⇒ PayrollIncomeObject
Returns a new instance of PayrollIncomeObject.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/the_plaid_api/models/payroll_income_object.rb', line 50 def initialize(account_id:, pay_stubs:, w2s:, form1099s:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @account_id = account_id @pay_stubs = pay_stubs @w2s = w2s @form1099s = form1099s @additional_properties = additional_properties end |
Instance Attribute Details
#account_id ⇒ String
ID of the payroll provider account.
14 15 16 |
# File 'lib/the_plaid_api/models/payroll_income_object.rb', line 14 def account_id @account_id end |
#form1099s ⇒ Array[Credit1099]
Array of tax form 1099s.
26 27 28 |
# File 'lib/the_plaid_api/models/payroll_income_object.rb', line 26 def form1099s @form1099s end |
#pay_stubs ⇒ Array[CreditPayStub]
Array of pay stubs for the user.
18 19 20 |
# File 'lib/the_plaid_api/models/payroll_income_object.rb', line 18 def pay_stubs @pay_stubs end |
#w2s ⇒ Array[CreditW2]
Array of tax form W-2s.
22 23 24 |
# File 'lib/the_plaid_api/models/payroll_income_object.rb', line 22 def w2s @w2s end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
63 64 65 66 67 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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/the_plaid_api/models/payroll_income_object.rb', line 63 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_id = hash.key?('account_id') ? hash['account_id'] : nil # Parameter is an array, so we need to iterate through it pay_stubs = nil unless hash['pay_stubs'].nil? pay_stubs = [] hash['pay_stubs'].each do |structure| pay_stubs << (CreditPayStub.from_hash(structure) if structure) end end pay_stubs = nil unless hash.key?('pay_stubs') # Parameter is an array, so we need to iterate through it w2s = nil unless hash['w2s'].nil? w2s = [] hash['w2s'].each do |structure| w2s << (CreditW2.from_hash(structure) if structure) end end w2s = nil unless hash.key?('w2s') # Parameter is an array, so we need to iterate through it form1099s = nil unless hash['form1099s'].nil? form1099s = [] hash['form1099s'].each do |structure| form1099s << (Credit1099.from_hash(structure) if structure) end end form1099s = nil unless hash.key?('form1099s') # 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. PayrollIncomeObject.new(account_id: account_id, pay_stubs: pay_stubs, w2s: w2s, form1099s: form1099s, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/the_plaid_api/models/payroll_income_object.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['account_id'] = 'account_id' @_hash['pay_stubs'] = 'pay_stubs' @_hash['w2s'] = 'w2s' @_hash['form1099s'] = 'form1099s' @_hash end |
.nullables ⇒ Object
An array for nullable fields
44 45 46 47 48 |
# File 'lib/the_plaid_api/models/payroll_income_object.rb', line 44 def self.nullables %w[ account_id ] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 |
# File 'lib/the_plaid_api/models/payroll_income_object.rb', line 39 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
122 123 124 125 126 127 |
# File 'lib/the_plaid_api/models/payroll_income_object.rb', line 122 def inspect class_name = self.class.name.split('::').last "<#{class_name} account_id: #{@account_id.inspect}, pay_stubs: #{@pay_stubs.inspect}, w2s:"\ " #{@w2s.inspect}, form1099s: #{@form1099s.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
115 116 117 118 119 |
# File 'lib/the_plaid_api/models/payroll_income_object.rb', line 115 def to_s class_name = self.class.name.split('::').last "<#{class_name} account_id: #{@account_id}, pay_stubs: #{@pay_stubs}, w2s: #{@w2s},"\ " form1099s: #{@form1099s}, additional_properties: #{@additional_properties}>" end |