Class: ThePlaidApi::Employee
- Defined in:
- lib/the_plaid_api/models/employee.rb
Overview
Data about the employee.
Instance Attribute Summary collapse
-
#address ⇒ Address2
Address on the paystub.
-
#marital_status ⇒ String
Marital status of the employee - either ‘single` or `married`.
-
#name ⇒ String
The name of the employee.
-
#taxpayer_id ⇒ TaxpayerId
Taxpayer ID of the individual receiving the paystub.
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(address:, name:, marital_status: SKIP, taxpayer_id: SKIP, additional_properties: nil) ⇒ Employee
constructor
A new instance of Employee.
-
#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(address:, name:, marital_status: SKIP, taxpayer_id: SKIP, additional_properties: nil) ⇒ Employee
Returns a new instance of Employee.
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/the_plaid_api/models/employee.rb', line 54 def initialize(address:, name:, marital_status: SKIP, taxpayer_id: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @address = address @name = name @marital_status = marital_status unless marital_status == SKIP @taxpayer_id = taxpayer_id unless taxpayer_id == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#address ⇒ Address2
Address on the paystub
14 15 16 |
# File 'lib/the_plaid_api/models/employee.rb', line 14 def address @address end |
#marital_status ⇒ String
Marital status of the employee - either ‘single` or `married`.
22 23 24 |
# File 'lib/the_plaid_api/models/employee.rb', line 22 def marital_status @marital_status end |
#name ⇒ String
The name of the employee.
18 19 20 |
# File 'lib/the_plaid_api/models/employee.rb', line 18 def name @name end |
#taxpayer_id ⇒ TaxpayerId
Taxpayer ID of the individual receiving the paystub.
26 27 28 |
# File 'lib/the_plaid_api/models/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.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/the_plaid_api/models/employee.rb', line 67 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. address = Address2.from_hash(hash['address']) if hash['address'] name = hash.key?('name') ? hash['name'] : nil marital_status = hash.key?('marital_status') ? hash['marital_status'] : SKIP taxpayer_id = TaxpayerId.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. Employee.new(address: address, name: name, marital_status: marital_status, taxpayer_id: taxpayer_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/the_plaid_api/models/employee.rb', line 29 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 |
.nullables ⇒ Object
An array for nullable fields
47 48 49 50 51 52 |
# File 'lib/the_plaid_api/models/employee.rb', line 47 def self.nullables %w[ name marital_status ] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 |
# File 'lib/the_plaid_api/models/employee.rb', line 39 def self.optionals %w[ marital_status taxpayer_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
100 101 102 103 104 105 |
# File 'lib/the_plaid_api/models/employee.rb', line 100 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_s ⇒ Object
Provides a human-readable string representation of the object.
93 94 95 96 97 |
# File 'lib/the_plaid_api/models/employee.rb', line 93 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 |