Class: ThePlaidApi::PaystubOverrideEmployee

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/paystub_override_employee.rb

Overview

The employee on the paystub.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(name: SKIP, address: SKIP, marital_status: SKIP, taxpayer_id: SKIP, additional_properties: nil) ⇒ PaystubOverrideEmployee

Returns a new instance of PaystubOverrideEmployee.



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/the_plaid_api/models/paystub_override_employee.rb', line 55

def initialize(name: SKIP, address: SKIP, marital_status: SKIP,
               taxpayer_id: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @name = name unless name == SKIP
  @address = address unless address == SKIP
  @marital_status = marital_status unless marital_status == SKIP
  @taxpayer_id = taxpayer_id unless taxpayer_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressPaystubOverrideEmployeeAddress

The address of the employee.



18
19
20
# File 'lib/the_plaid_api/models/paystub_override_employee.rb', line 18

def address
  @address
end

#marital_statusString

Marital status of the employee - either ‘single` or `married`.

Returns:

  • (String)


22
23
24
# File 'lib/the_plaid_api/models/paystub_override_employee.rb', line 22

def marital_status
  @marital_status
end

#nameString

The name of the employee.

Returns:

  • (String)


14
15
16
# File 'lib/the_plaid_api/models/paystub_override_employee.rb', line 14

def name
  @name
end

#taxpayer_idPaystubOverrideTaxpayerId

Taxpayer ID of the individual receiving the paystub.



26
27
28
# File 'lib/the_plaid_api/models/paystub_override_employee.rb', line 26

def taxpayer_id
  @taxpayer_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
# File 'lib/the_plaid_api/models/paystub_override_employee.rb', line 68

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : SKIP
  address = PaystubOverrideEmployeeAddress.from_hash(hash['address']) if hash['address']
  marital_status =
    hash.key?('marital_status') ? hash['marital_status'] : SKIP
  taxpayer_id = PaystubOverrideTaxpayerId.from_hash(hash['taxpayer_id']) if
    hash['taxpayer_id']

  # 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.
  PaystubOverrideEmployee.new(name: name,
                              address: address,
                              marital_status: marital_status,
                              taxpayer_id: taxpayer_id,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/the_plaid_api/models/paystub_override_employee.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['address'] = 'address'
  @_hash['marital_status'] = 'marital_status'
  @_hash['taxpayer_id'] = 'taxpayer_id'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
52
53
# File 'lib/the_plaid_api/models/paystub_override_employee.rb', line 49

def self.nullables
  %w[
    marital_status
  ]
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/the_plaid_api/models/paystub_override_employee.rb', line 39

def self.optionals
  %w[
    name
    address
    marital_status
    taxpayer_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



102
103
104
105
106
107
# File 'lib/the_plaid_api/models/paystub_override_employee.rb', line 102

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, address: #{@address.inspect}, marital_status:"\
  " #{@marital_status.inspect}, taxpayer_id: #{@taxpayer_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



95
96
97
98
99
# File 'lib/the_plaid_api/models/paystub_override_employee.rb', line 95

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name}, address: #{@address}, marital_status: #{@marital_status},"\
  " taxpayer_id: #{@taxpayer_id}, additional_properties: #{@additional_properties}>"
end