Class: ThePlaidApi::PayrollItem
- Defined in:
- lib/the_plaid_api/models/payroll_item.rb
Overview
An object containing information about the payroll item.
Instance Attribute Summary collapse
-
#accounts ⇒ Array[PayrollIncomeAccountData]
The name of the institution associated with the Item.
-
#institution_id ⇒ String
The unique identifier of the institution associated with the Item.
-
#institution_name ⇒ String
The name of the institution associated with the Item.
-
#item_id ⇒ String
The ‘item_id` of the Item associated with this webhook, warning, or error.
-
#payroll_income ⇒ Array[PayrollIncomeObject]
The name of the institution associated with the Item.
-
#status ⇒ PayrollItemStatus
Details about the status of the payroll item.
-
#updated_at ⇒ DateTime
Timestamp in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DDTHH:mm:ssZ) indicating the last time that the Item was updated.
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(item_id:, institution_id:, institution_name:, accounts:, payroll_income:, status:, updated_at:, additional_properties: nil) ⇒ PayrollItem
constructor
A new instance of PayrollItem.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_updated_at ⇒ 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(item_id:, institution_id:, institution_name:, accounts:, payroll_income:, status:, updated_at:, additional_properties: nil) ⇒ PayrollItem
Returns a new instance of PayrollItem.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 68 def initialize(item_id:, institution_id:, institution_name:, accounts:, payroll_income:, status:, updated_at:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @item_id = item_id @institution_id = institution_id @institution_name = institution_name @accounts = accounts @payroll_income = payroll_income @status = status @updated_at = updated_at @additional_properties = additional_properties end |
Instance Attribute Details
#accounts ⇒ Array[PayrollIncomeAccountData]
The name of the institution associated with the Item.
27 28 29 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 27 def accounts @accounts end |
#institution_id ⇒ String
The unique identifier of the institution associated with the Item.
19 20 21 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 19 def institution_id @institution_id end |
#institution_name ⇒ String
The name of the institution associated with the Item.
23 24 25 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 23 def institution_name @institution_name end |
#item_id ⇒ String
The ‘item_id` of the Item associated with this webhook, warning, or error
15 16 17 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 15 def item_id @item_id end |
#payroll_income ⇒ Array[PayrollIncomeObject]
The name of the institution associated with the Item.
31 32 33 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 31 def payroll_income @payroll_income end |
#status ⇒ PayrollItemStatus
Details about the status of the payroll item.
35 36 37 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 35 def status @status end |
#updated_at ⇒ DateTime
Timestamp in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DDTHH:mm:ssZ) indicating the last time that the Item was updated.
40 41 42 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 40 def updated_at @updated_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 85 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. item_id = hash.key?('item_id') ? hash['item_id'] : nil institution_id = hash.key?('institution_id') ? hash['institution_id'] : nil institution_name = hash.key?('institution_name') ? hash['institution_name'] : nil # Parameter is an array, so we need to iterate through it accounts = nil unless hash['accounts'].nil? accounts = [] hash['accounts'].each do |structure| accounts << (PayrollIncomeAccountData.from_hash(structure) if structure) end end accounts = nil unless hash.key?('accounts') # Parameter is an array, so we need to iterate through it payroll_income = nil unless hash['payroll_income'].nil? payroll_income = [] hash['payroll_income'].each do |structure| payroll_income << (PayrollIncomeObject.from_hash(structure) if structure) end end payroll_income = nil unless hash.key?('payroll_income') status = PayrollItemStatus.from_hash(hash['status']) if hash['status'] updated_at = if hash.key?('updated_at') (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at']) end # 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. PayrollItem.new(item_id: item_id, institution_id: institution_id, institution_name: institution_name, accounts: accounts, payroll_income: payroll_income, status: status, updated_at: updated_at, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 43 def self.names @_hash = {} if @_hash.nil? @_hash['item_id'] = 'item_id' @_hash['institution_id'] = 'institution_id' @_hash['institution_name'] = 'institution_name' @_hash['accounts'] = 'accounts' @_hash['payroll_income'] = 'payroll_income' @_hash['status'] = 'status' @_hash['updated_at'] = 'updated_at' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 64 65 66 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 61 def self.nullables %w[ status updated_at ] end |
.optionals ⇒ Object
An array for optional fields
56 57 58 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 56 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
150 151 152 153 154 155 156 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 150 def inspect class_name = self.class.name.split('::').last "<#{class_name} item_id: #{@item_id.inspect}, institution_id: #{@institution_id.inspect},"\ " institution_name: #{@institution_name.inspect}, accounts: #{@accounts.inspect},"\ " payroll_income: #{@payroll_income.inspect}, status: #{@status.inspect}, updated_at:"\ " #{@updated_at.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_updated_at ⇒ Object
137 138 139 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 137 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
142 143 144 145 146 147 |
# File 'lib/the_plaid_api/models/payroll_item.rb', line 142 def to_s class_name = self.class.name.split('::').last "<#{class_name} item_id: #{@item_id}, institution_id: #{@institution_id}, institution_name:"\ " #{@institution_name}, accounts: #{@accounts}, payroll_income: #{@payroll_income}, status:"\ " #{@status}, updated_at: #{@updated_at}, additional_properties: #{@additional_properties}>" end |