Class: ThePlaidApi::CreditW2
- Defined in:
- lib/the_plaid_api/models/credit_w2.rb
Overview
W2 is an object that represents income data taken from a W2 tax document.
Instance Attribute Summary collapse
-
#allocated_tips ⇒ String
Allocated tips.
-
#box_12 ⇒ Array[W2Box12]
Nonqualified plans.
-
#box_9 ⇒ String
Contents from box 9 on the W2.
-
#dependent_care_benefits ⇒ String
Dependent care benefits.
-
#document_id ⇒ String
An identifier of the document referenced by the document metadata.
-
#document_metadata ⇒ CreditDocumentMetadata
Object representing metadata pertaining to the document.
-
#employee ⇒ CreditPayStubEmployee
Data about the employee.
-
#employer ⇒ CreditPayStubEmployer
Information about the employer on the pay stub.
-
#employer_id_number ⇒ String
An employee identification number or EIN.
-
#federal_income_tax_withheld ⇒ String
Federal income tax withheld for the tax year.
-
#medicare_tax_withheld ⇒ String
Medicare tax withheld for the tax year.
-
#medicare_wages_and_tips ⇒ String
Wages and tips from medicare.
-
#nonqualified_plans ⇒ String
Nonqualified plans.
-
#other ⇒ String
Other.
-
#retirement_plan ⇒ String
Retirement plan.
-
#social_security_tax_withheld ⇒ String
Social security tax withheld for the tax year.
-
#social_security_tips ⇒ String
Tips from social security.
-
#social_security_wages ⇒ String
Wages from social security.
-
#state_and_local_wages ⇒ Array[W2StateAndLocalWages]
Other.
-
#statutory_employee ⇒ String
Statutory employee.
-
#tax_year ⇒ String
The tax year of the W2 document.
-
#third_party_sick_pay ⇒ String
Third party sick pay.
-
#wages_tips_other_comp ⇒ String
Wages from tips and other compensation.
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(document_metadata:, document_id:, employer:, employee:, tax_year:, employer_id_number:, wages_tips_other_comp:, federal_income_tax_withheld:, social_security_wages:, social_security_tax_withheld:, medicare_wages_and_tips:, medicare_tax_withheld:, social_security_tips:, allocated_tips:, box_9:, dependent_care_benefits:, nonqualified_plans:, box_12:, statutory_employee:, retirement_plan:, third_party_sick_pay:, other:, state_and_local_wages:, additional_properties: nil) ⇒ CreditW2
constructor
A new instance of CreditW2.
-
#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(document_metadata:, document_id:, employer:, employee:, tax_year:, employer_id_number:, wages_tips_other_comp:, federal_income_tax_withheld:, social_security_wages:, social_security_tax_withheld:, medicare_wages_and_tips:, medicare_tax_withheld:, social_security_tips:, allocated_tips:, box_9:, dependent_care_benefits:, nonqualified_plans:, box_12:, statutory_employee:, retirement_plan:, third_party_sick_pay:, other:, state_and_local_wages:, additional_properties: nil) ⇒ CreditW2
Returns a new instance of CreditW2.
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 161 def initialize(document_metadata:, document_id:, employer:, employee:, tax_year:, employer_id_number:, wages_tips_other_comp:, federal_income_tax_withheld:, social_security_wages:, social_security_tax_withheld:, medicare_wages_and_tips:, medicare_tax_withheld:, social_security_tips:, allocated_tips:, box_9:, dependent_care_benefits:, nonqualified_plans:, box_12:, statutory_employee:, retirement_plan:, third_party_sick_pay:, other:, state_and_local_wages:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @document_metadata = @document_id = document_id @employer = employer @employee = employee @tax_year = tax_year @employer_id_number = employer_id_number @wages_tips_other_comp = wages_tips_other_comp @federal_income_tax_withheld = federal_income_tax_withheld @social_security_wages = @social_security_tax_withheld = @medicare_wages_and_tips = medicare_wages_and_tips @medicare_tax_withheld = medicare_tax_withheld @social_security_tips = @allocated_tips = allocated_tips @box_9 = box_9 @dependent_care_benefits = dependent_care_benefits @nonqualified_plans = nonqualified_plans @box_12 = box_12 @statutory_employee = statutory_employee @retirement_plan = retirement_plan @third_party_sick_pay = third_party_sick_pay @other = other @state_and_local_wages = state_and_local_wages @additional_properties = additional_properties end |
Instance Attribute Details
#allocated_tips ⇒ String
Allocated tips.
66 67 68 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 66 def allocated_tips @allocated_tips end |
#box_12 ⇒ Array[W2Box12]
Nonqualified plans.
82 83 84 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 82 def box_12 @box_12 end |
#box_9 ⇒ String
Contents from box 9 on the W2.
70 71 72 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 70 def box_9 @box_9 end |
#dependent_care_benefits ⇒ String
Dependent care benefits.
74 75 76 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 74 def dependent_care_benefits @dependent_care_benefits end |
#document_id ⇒ String
An identifier of the document referenced by the document metadata.
18 19 20 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 18 def document_id @document_id end |
#document_metadata ⇒ CreditDocumentMetadata
Object representing metadata pertaining to the document.
14 15 16 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 14 def @document_metadata end |
#employee ⇒ CreditPayStubEmployee
Data about the employee.
26 27 28 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 26 def employee @employee end |
#employer ⇒ CreditPayStubEmployer
Information about the employer on the pay stub.
22 23 24 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 22 def employer @employer end |
#employer_id_number ⇒ String
An employee identification number or EIN.
34 35 36 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 34 def employer_id_number @employer_id_number end |
#federal_income_tax_withheld ⇒ String
Federal income tax withheld for the tax year.
42 43 44 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 42 def federal_income_tax_withheld @federal_income_tax_withheld end |
#medicare_tax_withheld ⇒ String
Medicare tax withheld for the tax year.
58 59 60 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 58 def medicare_tax_withheld @medicare_tax_withheld end |
#medicare_wages_and_tips ⇒ String
Wages and tips from medicare.
54 55 56 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 54 def medicare_wages_and_tips @medicare_wages_and_tips end |
#nonqualified_plans ⇒ String
Nonqualified plans.
78 79 80 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 78 def nonqualified_plans @nonqualified_plans end |
#other ⇒ String
Other.
98 99 100 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 98 def other @other end |
#retirement_plan ⇒ String
Retirement plan.
90 91 92 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 90 def retirement_plan @retirement_plan end |
#social_security_tax_withheld ⇒ String
Social security tax withheld for the tax year.
50 51 52 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 50 def @social_security_tax_withheld end |
#social_security_tips ⇒ String
Tips from social security.
62 63 64 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 62 def @social_security_tips end |
#social_security_wages ⇒ String
Wages from social security.
46 47 48 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 46 def @social_security_wages end |
#state_and_local_wages ⇒ Array[W2StateAndLocalWages]
Other.
102 103 104 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 102 def state_and_local_wages @state_and_local_wages end |
#statutory_employee ⇒ String
Statutory employee.
86 87 88 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 86 def statutory_employee @statutory_employee end |
#tax_year ⇒ String
The tax year of the W2 document.
30 31 32 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 30 def tax_year @tax_year end |
#third_party_sick_pay ⇒ String
Third party sick pay.
94 95 96 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 94 def third_party_sick_pay @third_party_sick_pay end |
#wages_tips_other_comp ⇒ String
Wages from tips and other compensation.
38 39 40 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 38 def wages_tips_other_comp @wages_tips_other_comp end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 200 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. = CreditDocumentMetadata.from_hash(hash['document_metadata']) if hash['document_metadata'] document_id = hash.key?('document_id') ? hash['document_id'] : nil employer = CreditPayStubEmployer.from_hash(hash['employer']) if hash['employer'] employee = CreditPayStubEmployee.from_hash(hash['employee']) if hash['employee'] tax_year = hash.key?('tax_year') ? hash['tax_year'] : nil employer_id_number = hash.key?('employer_id_number') ? hash['employer_id_number'] : nil wages_tips_other_comp = hash.key?('wages_tips_other_comp') ? hash['wages_tips_other_comp'] : nil federal_income_tax_withheld = hash.key?('federal_income_tax_withheld') ? hash['federal_income_tax_withheld'] : nil = hash.key?('social_security_wages') ? hash['social_security_wages'] : nil = hash.key?('social_security_tax_withheld') ? hash['social_security_tax_withheld'] : nil medicare_wages_and_tips = hash.key?('medicare_wages_and_tips') ? hash['medicare_wages_and_tips'] : nil medicare_tax_withheld = hash.key?('medicare_tax_withheld') ? hash['medicare_tax_withheld'] : nil = hash.key?('social_security_tips') ? hash['social_security_tips'] : nil allocated_tips = hash.key?('allocated_tips') ? hash['allocated_tips'] : nil box_9 = hash.key?('box_9') ? hash['box_9'] : nil dependent_care_benefits = hash.key?('dependent_care_benefits') ? hash['dependent_care_benefits'] : nil nonqualified_plans = hash.key?('nonqualified_plans') ? hash['nonqualified_plans'] : nil # Parameter is an array, so we need to iterate through it box_12 = nil unless hash['box_12'].nil? box_12 = [] hash['box_12'].each do |structure| box_12 << (W2Box12.from_hash(structure) if structure) end end box_12 = nil unless hash.key?('box_12') statutory_employee = hash.key?('statutory_employee') ? hash['statutory_employee'] : nil retirement_plan = hash.key?('retirement_plan') ? hash['retirement_plan'] : nil third_party_sick_pay = hash.key?('third_party_sick_pay') ? hash['third_party_sick_pay'] : nil other = hash.key?('other') ? hash['other'] : nil # Parameter is an array, so we need to iterate through it state_and_local_wages = nil unless hash['state_and_local_wages'].nil? state_and_local_wages = [] hash['state_and_local_wages'].each do |structure| state_and_local_wages << (W2StateAndLocalWages.from_hash(structure) if structure) end end state_and_local_wages = nil unless hash.key?('state_and_local_wages') # 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. CreditW2.new(document_metadata: , document_id: document_id, employer: employer, employee: employee, tax_year: tax_year, employer_id_number: employer_id_number, wages_tips_other_comp: wages_tips_other_comp, federal_income_tax_withheld: federal_income_tax_withheld, social_security_wages: , social_security_tax_withheld: , medicare_wages_and_tips: medicare_wages_and_tips, medicare_tax_withheld: medicare_tax_withheld, social_security_tips: , allocated_tips: allocated_tips, box_9: box_9, dependent_care_benefits: dependent_care_benefits, nonqualified_plans: nonqualified_plans, box_12: box_12, statutory_employee: statutory_employee, retirement_plan: retirement_plan, third_party_sick_pay: third_party_sick_pay, other: other, state_and_local_wages: state_and_local_wages, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
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 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 105 def self.names @_hash = {} if @_hash.nil? @_hash['document_metadata'] = 'document_metadata' @_hash['document_id'] = 'document_id' @_hash['employer'] = 'employer' @_hash['employee'] = 'employee' @_hash['tax_year'] = 'tax_year' @_hash['employer_id_number'] = 'employer_id_number' @_hash['wages_tips_other_comp'] = 'wages_tips_other_comp' @_hash['federal_income_tax_withheld'] = 'federal_income_tax_withheld' @_hash['social_security_wages'] = 'social_security_wages' @_hash['social_security_tax_withheld'] = 'social_security_tax_withheld' @_hash['medicare_wages_and_tips'] = 'medicare_wages_and_tips' @_hash['medicare_tax_withheld'] = 'medicare_tax_withheld' @_hash['social_security_tips'] = 'social_security_tips' @_hash['allocated_tips'] = 'allocated_tips' @_hash['box_9'] = 'box_9' @_hash['dependent_care_benefits'] = 'dependent_care_benefits' @_hash['nonqualified_plans'] = 'nonqualified_plans' @_hash['box_12'] = 'box_12' @_hash['statutory_employee'] = 'statutory_employee' @_hash['retirement_plan'] = 'retirement_plan' @_hash['third_party_sick_pay'] = 'third_party_sick_pay' @_hash['other'] = 'other' @_hash['state_and_local_wages'] = 'state_and_local_wages' @_hash end |
.nullables ⇒ Object
An array for nullable fields
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 139 def self.nullables %w[ tax_year employer_id_number wages_tips_other_comp federal_income_tax_withheld social_security_wages social_security_tax_withheld medicare_wages_and_tips medicare_tax_withheld social_security_tips allocated_tips box_9 dependent_care_benefits nonqualified_plans statutory_employee retirement_plan third_party_sick_pay other ] end |
.optionals ⇒ Object
An array for optional fields
134 135 136 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 134 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 314 def inspect class_name = self.class.name.split('::').last "<#{class_name} document_metadata: #{@document_metadata.inspect}, document_id:"\ " #{@document_id.inspect}, employer: #{@employer.inspect}, employee: #{@employee.inspect},"\ " tax_year: #{@tax_year.inspect}, employer_id_number: #{@employer_id_number.inspect},"\ " wages_tips_other_comp: #{@wages_tips_other_comp.inspect}, federal_income_tax_withheld:"\ " #{@federal_income_tax_withheld.inspect}, social_security_wages:"\ " #{@social_security_wages.inspect}, social_security_tax_withheld:"\ " #{@social_security_tax_withheld.inspect}, medicare_wages_and_tips:"\ " #{@medicare_wages_and_tips.inspect}, medicare_tax_withheld:"\ " #{@medicare_tax_withheld.inspect}, social_security_tips: #{@social_security_tips.inspect},"\ " allocated_tips: #{@allocated_tips.inspect}, box_9: #{@box_9.inspect},"\ " dependent_care_benefits: #{@dependent_care_benefits.inspect}, nonqualified_plans:"\ " #{@nonqualified_plans.inspect}, box_12: #{@box_12.inspect}, statutory_employee:"\ " #{@statutory_employee.inspect}, retirement_plan: #{@retirement_plan.inspect},"\ " third_party_sick_pay: #{@third_party_sick_pay.inspect}, other: #{@other.inspect},"\ " state_and_local_wages: #{@state_and_local_wages.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/the_plaid_api/models/credit_w2.rb', line 296 def to_s class_name = self.class.name.split('::').last "<#{class_name} document_metadata: #{@document_metadata}, document_id: #{@document_id},"\ " employer: #{@employer}, employee: #{@employee}, tax_year: #{@tax_year},"\ " employer_id_number: #{@employer_id_number}, wages_tips_other_comp:"\ " #{@wages_tips_other_comp}, federal_income_tax_withheld: #{@federal_income_tax_withheld},"\ " social_security_wages: #{@social_security_wages}, social_security_tax_withheld:"\ " #{@social_security_tax_withheld}, medicare_wages_and_tips: #{@medicare_wages_and_tips},"\ " medicare_tax_withheld: #{@medicare_tax_withheld}, social_security_tips:"\ " #{@social_security_tips}, allocated_tips: #{@allocated_tips}, box_9: #{@box_9},"\ " dependent_care_benefits: #{@dependent_care_benefits}, nonqualified_plans:"\ " #{@nonqualified_plans}, box_12: #{@box_12}, statutory_employee: #{@statutory_employee},"\ " retirement_plan: #{@retirement_plan}, third_party_sick_pay: #{@third_party_sick_pay},"\ " other: #{@other}, state_and_local_wages: #{@state_and_local_wages}, additional_properties:"\ " #{@additional_properties}>" end |