Class: ThePlaidApi::CreditPayStubEmployee

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

Overview

Data about the employee.

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(address:, name:, marital_status:, taxpayer_id:, additional_properties: nil) ⇒ CreditPayStubEmployee

Returns a new instance of CreditPayStubEmployee.



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/the_plaid_api/models/credit_pay_stub_employee.rb', line 52

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

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

Instance Attribute Details

#addressCreditPayStubAddress

Address on the pay stub.



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

def address
  @address
end

#marital_statusString

Marital status of the employee - either ‘SINGLE` or `MARRIED` or `NOT LISTED`.

Returns:

  • (String)


23
24
25
# File 'lib/the_plaid_api/models/credit_pay_stub_employee.rb', line 23

def marital_status
  @marital_status
end

#nameString

The name of the employee.

Returns:

  • (String)


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

def name
  @name
end

#taxpayer_idPayStubTaxpayerId

Taxpayer ID of the individual receiving the paystub.

Returns:



27
28
29
# File 'lib/the_plaid_api/models/credit_pay_stub_employee.rb', line 27

def taxpayer_id
  @taxpayer_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/the_plaid_api/models/credit_pay_stub_employee.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  address = CreditPayStubAddress.from_hash(hash['address']) if hash['address']
  name = hash.key?('name') ? hash['name'] : nil
  marital_status =
    hash.key?('marital_status') ? hash['marital_status'] : nil
  taxpayer_id = PayStubTaxpayerId.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.
  CreditPayStubEmployee.new(address: address,
                            name: name,
                            marital_status: marital_status,
                            taxpayer_id: taxpayer_id,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



45
46
47
48
49
50
# File 'lib/the_plaid_api/models/credit_pay_stub_employee.rb', line 45

def self.nullables
  %w[
    name
    marital_status
  ]
end

.optionalsObject

An array for optional fields



40
41
42
# File 'lib/the_plaid_api/models/credit_pay_stub_employee.rb', line 40

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



98
99
100
101
102
103
# File 'lib/the_plaid_api/models/credit_pay_stub_employee.rb', line 98

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} address: #{@address.inspect}, name: #{@name.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.



91
92
93
94
95
# File 'lib/the_plaid_api/models/credit_pay_stub_employee.rb', line 91

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