Class: Plaid::W2Override
- Inherits:
-
Object
- Object
- Plaid::W2Override
- Defined in:
- lib/plaid/models/w2_override.rb
Overview
W2 is an object that represents income data taken from a W2 tax document.
Instance Attribute Summary collapse
-
#allocated_tips ⇒ Object
Allocated tips.
-
#box_12 ⇒ Object
Returns the value of attribute box_12.
-
#box_9 ⇒ Object
Contents from box 9 on the W2.
-
#dependent_care_benefits ⇒ Object
Dependent care benefits.
-
#employee ⇒ Object
Returns the value of attribute employee.
-
#employer ⇒ Object
Returns the value of attribute employer.
-
#employer_id_number ⇒ Object
An employer identification number or EIN.
-
#federal_income_tax_withheld ⇒ Object
Federal income tax withheld for the tax year.
-
#medicare_tax_withheld ⇒ Object
Medicare tax withheld for the tax year.
-
#medicare_wages_and_tips ⇒ Object
Wages and tips from medicare.
-
#nonqualified_plans ⇒ Object
Nonqualified plans.
-
#other ⇒ Object
Other.
-
#retirement_plan ⇒ Object
Retirement plan.
-
#social_security_tax_withheld ⇒ Object
Social security tax withheld for the tax year.
-
#social_security_tips ⇒ Object
Tips from social security.
-
#social_security_wages ⇒ Object
Wages from social security.
-
#state_and_local_wages ⇒ Object
Returns the value of attribute state_and_local_wages.
-
#statutory_employee ⇒ Object
Statutory employee.
-
#tax_year ⇒ Object
The tax year of the W2 document.
-
#third_party_sick_pay ⇒ Object
Third party sick pay.
-
#wages_tips_other_comp ⇒ Object
Wages from tips and other compensation.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ W2Override
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ W2Override
Initializes the object
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 198 199 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 |
# File 'lib/plaid/models/w2_override.rb', line 162 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Plaid::W2Override` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Plaid::W2Override`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'employer') self.employer = attributes[:'employer'] end if attributes.key?(:'employee') self.employee = attributes[:'employee'] end if attributes.key?(:'tax_year') self.tax_year = attributes[:'tax_year'] end if attributes.key?(:'employer_id_number') self.employer_id_number = attributes[:'employer_id_number'] end if attributes.key?(:'wages_tips_other_comp') self.wages_tips_other_comp = attributes[:'wages_tips_other_comp'] end if attributes.key?(:'federal_income_tax_withheld') self.federal_income_tax_withheld = attributes[:'federal_income_tax_withheld'] end if attributes.key?(:'social_security_wages') self. = attributes[:'social_security_wages'] end if attributes.key?(:'social_security_tax_withheld') self. = attributes[:'social_security_tax_withheld'] end if attributes.key?(:'medicare_wages_and_tips') self.medicare_wages_and_tips = attributes[:'medicare_wages_and_tips'] end if attributes.key?(:'medicare_tax_withheld') self.medicare_tax_withheld = attributes[:'medicare_tax_withheld'] end if attributes.key?(:'social_security_tips') self. = attributes[:'social_security_tips'] end if attributes.key?(:'allocated_tips') self.allocated_tips = attributes[:'allocated_tips'] end if attributes.key?(:'box_9') self.box_9 = attributes[:'box_9'] end if attributes.key?(:'dependent_care_benefits') self.dependent_care_benefits = attributes[:'dependent_care_benefits'] end if attributes.key?(:'nonqualified_plans') self.nonqualified_plans = attributes[:'nonqualified_plans'] end if attributes.key?(:'box_12') if (value = attributes[:'box_12']).is_a?(Array) self.box_12 = value end end if attributes.key?(:'statutory_employee') self.statutory_employee = attributes[:'statutory_employee'] end if attributes.key?(:'retirement_plan') self.retirement_plan = attributes[:'retirement_plan'] end if attributes.key?(:'third_party_sick_pay') self.third_party_sick_pay = attributes[:'third_party_sick_pay'] end if attributes.key?(:'other') self.other = attributes[:'other'] end if attributes.key?(:'state_and_local_wages') if (value = attributes[:'state_and_local_wages']).is_a?(Array) self.state_and_local_wages = value end end end |
Instance Attribute Details
#allocated_tips ⇒ Object
Allocated tips.
51 52 53 |
# File 'lib/plaid/models/w2_override.rb', line 51 def allocated_tips @allocated_tips end |
#box_12 ⇒ Object
Returns the value of attribute box_12.
62 63 64 |
# File 'lib/plaid/models/w2_override.rb', line 62 def box_12 @box_12 end |
#box_9 ⇒ Object
Contents from box 9 on the W2.
54 55 56 |
# File 'lib/plaid/models/w2_override.rb', line 54 def box_9 @box_9 end |
#dependent_care_benefits ⇒ Object
Dependent care benefits.
57 58 59 |
# File 'lib/plaid/models/w2_override.rb', line 57 def dependent_care_benefits @dependent_care_benefits end |
#employee ⇒ Object
Returns the value of attribute employee.
21 22 23 |
# File 'lib/plaid/models/w2_override.rb', line 21 def employee @employee end |
#employer ⇒ Object
Returns the value of attribute employer.
19 20 21 |
# File 'lib/plaid/models/w2_override.rb', line 19 def employer @employer end |
#employer_id_number ⇒ Object
An employer identification number or EIN.
27 28 29 |
# File 'lib/plaid/models/w2_override.rb', line 27 def employer_id_number @employer_id_number end |
#federal_income_tax_withheld ⇒ Object
Federal income tax withheld for the tax year.
33 34 35 |
# File 'lib/plaid/models/w2_override.rb', line 33 def federal_income_tax_withheld @federal_income_tax_withheld end |
#medicare_tax_withheld ⇒ Object
Medicare tax withheld for the tax year.
45 46 47 |
# File 'lib/plaid/models/w2_override.rb', line 45 def medicare_tax_withheld @medicare_tax_withheld end |
#medicare_wages_and_tips ⇒ Object
Wages and tips from medicare.
42 43 44 |
# File 'lib/plaid/models/w2_override.rb', line 42 def medicare_wages_and_tips @medicare_wages_and_tips end |
#nonqualified_plans ⇒ Object
Nonqualified plans.
60 61 62 |
# File 'lib/plaid/models/w2_override.rb', line 60 def nonqualified_plans @nonqualified_plans end |
#other ⇒ Object
Other.
74 75 76 |
# File 'lib/plaid/models/w2_override.rb', line 74 def other @other end |
#retirement_plan ⇒ Object
Retirement plan.
68 69 70 |
# File 'lib/plaid/models/w2_override.rb', line 68 def retirement_plan @retirement_plan end |
#social_security_tax_withheld ⇒ Object
Social security tax withheld for the tax year.
39 40 41 |
# File 'lib/plaid/models/w2_override.rb', line 39 def @social_security_tax_withheld end |
#social_security_tips ⇒ Object
Tips from social security.
48 49 50 |
# File 'lib/plaid/models/w2_override.rb', line 48 def @social_security_tips end |
#social_security_wages ⇒ Object
Wages from social security.
36 37 38 |
# File 'lib/plaid/models/w2_override.rb', line 36 def @social_security_wages end |
#state_and_local_wages ⇒ Object
Returns the value of attribute state_and_local_wages.
76 77 78 |
# File 'lib/plaid/models/w2_override.rb', line 76 def state_and_local_wages @state_and_local_wages end |
#statutory_employee ⇒ Object
Statutory employee.
65 66 67 |
# File 'lib/plaid/models/w2_override.rb', line 65 def statutory_employee @statutory_employee end |
#tax_year ⇒ Object
The tax year of the W2 document.
24 25 26 |
# File 'lib/plaid/models/w2_override.rb', line 24 def tax_year @tax_year end |
#third_party_sick_pay ⇒ Object
Third party sick pay.
71 72 73 |
# File 'lib/plaid/models/w2_override.rb', line 71 def third_party_sick_pay @third_party_sick_pay end |
#wages_tips_other_comp ⇒ Object
Wages from tips and other compensation.
30 31 32 |
# File 'lib/plaid/models/w2_override.rb', line 30 def wages_tips_other_comp @wages_tips_other_comp end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
106 107 108 |
# File 'lib/plaid/models/w2_override.rb', line 106 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
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 |
# File 'lib/plaid/models/w2_override.rb', line 79 def self.attribute_map { :'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' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
320 321 322 |
# File 'lib/plaid/models/w2_override.rb', line 320 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/plaid/models/w2_override.rb', line 138 def self.openapi_nullable Set.new([ :'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 |
.openapi_types ⇒ Object
Attribute type mapping.
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/plaid/models/w2_override.rb', line 111 def self.openapi_types { :'employer' => :'PaystubOverrideEmployer', :'employee' => :'PaystubOverrideEmployee', :'tax_year' => :'String', :'employer_id_number' => :'String', :'wages_tips_other_comp' => :'String', :'federal_income_tax_withheld' => :'String', :'social_security_wages' => :'String', :'social_security_tax_withheld' => :'String', :'medicare_wages_and_tips' => :'String', :'medicare_tax_withheld' => :'String', :'social_security_tips' => :'String', :'allocated_tips' => :'String', :'box_9' => :'String', :'dependent_care_benefits' => :'String', :'nonqualified_plans' => :'String', :'box_12' => :'Array<W2Box12Override>', :'statutory_employee' => :'String', :'retirement_plan' => :'String', :'third_party_sick_pay' => :'String', :'other' => :'String', :'state_and_local_wages' => :'Array<W2StateAndLocalWagesOverride>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
# File 'lib/plaid/models/w2_override.rb', line 279 def ==(o) return true if self.equal?(o) self.class == o.class && employer == o.employer && employee == o.employee && tax_year == o.tax_year && employer_id_number == o.employer_id_number && wages_tips_other_comp == o.wages_tips_other_comp && federal_income_tax_withheld == o.federal_income_tax_withheld && == o. && == o. && medicare_wages_and_tips == o.medicare_wages_and_tips && medicare_tax_withheld == o.medicare_tax_withheld && == o. && allocated_tips == o.allocated_tips && box_9 == o.box_9 && dependent_care_benefits == o.dependent_care_benefits && nonqualified_plans == o.nonqualified_plans && box_12 == o.box_12 && statutory_employee == o.statutory_employee && retirement_plan == o.retirement_plan && third_party_sick_pay == o.third_party_sick_pay && other == o.other && state_and_local_wages == o.state_and_local_wages end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/plaid/models/w2_override.rb', line 351 def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = Plaid.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
422 423 424 425 426 427 428 429 430 431 432 433 434 |
# File 'lib/plaid/models/w2_override.rb', line 422 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/plaid/models/w2_override.rb', line 327 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(o) ⇒ Boolean
307 308 309 |
# File 'lib/plaid/models/w2_override.rb', line 307 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
313 314 315 |
# File 'lib/plaid/models/w2_override.rb', line 313 def hash [employer, employee, tax_year, employer_id_number, wages_tips_other_comp, federal_income_tax_withheld, , , medicare_wages_and_tips, medicare_tax_withheld, , allocated_tips, box_9, dependent_care_benefits, nonqualified_plans, box_12, statutory_employee, retirement_plan, third_party_sick_pay, other, state_and_local_wages].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
266 267 268 269 |
# File 'lib/plaid/models/w2_override.rb', line 266 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
398 399 400 |
# File 'lib/plaid/models/w2_override.rb', line 398 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/plaid/models/w2_override.rb', line 404 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
392 393 394 |
# File 'lib/plaid/models/w2_override.rb', line 392 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
273 274 275 |
# File 'lib/plaid/models/w2_override.rb', line 273 def valid? true end |