Class: ThePlaidApi::CreditPayStub
- Defined in:
- lib/the_plaid_api/models/credit_pay_stub.rb
Overview
An object representing an end user’s pay stub.
Instance Attribute Summary collapse
-
#deductions ⇒ CreditPayStubDeductions
An object with the deduction information found on a pay stub.
-
#document_id ⇒ String
An identifier of the document referenced by the document metadata.
-
#document_metadata ⇒ CreditDocumentMetadata
Object representing metadata pertaining to the document.
-
#earnings ⇒ CreditPayStubEarnings
An object representing both a breakdown of earnings on a pay stub and the total earnings.
-
#employee ⇒ CreditPayStubEmployee
Data about the employee.
-
#employer ⇒ CreditPayStubEmployer
Information about the employer on the pay stub.
-
#net_pay ⇒ CreditPayStubNetPay
An object representing information about the net pay amount on the pay stub.
-
#pay_period_details ⇒ PayStubPayPeriodDetails
Details about the pay period.
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(deductions:, document_id:, document_metadata:, earnings:, employee:, employer:, net_pay:, pay_period_details:, additional_properties: nil) ⇒ CreditPayStub
constructor
A new instance of CreditPayStub.
-
#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(deductions:, document_id:, document_metadata:, earnings:, employee:, employer:, net_pay:, pay_period_details:, additional_properties: nil) ⇒ CreditPayStub
Returns a new instance of CreditPayStub.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 72 def initialize(deductions:, document_id:, document_metadata:, earnings:, employee:, employer:, net_pay:, pay_period_details:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @deductions = deductions @document_id = document_id @document_metadata = @earnings = earnings @employee = employee @employer = employer @net_pay = net_pay @pay_period_details = pay_period_details @additional_properties = additional_properties end |
Instance Attribute Details
#deductions ⇒ CreditPayStubDeductions
An object with the deduction information found on a pay stub.
14 15 16 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 14 def deductions @deductions end |
#document_id ⇒ String
An identifier of the document referenced by the document metadata.
18 19 20 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 18 def document_id @document_id end |
#document_metadata ⇒ CreditDocumentMetadata
Object representing metadata pertaining to the document.
22 23 24 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 22 def @document_metadata end |
#earnings ⇒ CreditPayStubEarnings
An object representing both a breakdown of earnings on a pay stub and the total earnings.
27 28 29 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 27 def earnings @earnings end |
#employee ⇒ CreditPayStubEmployee
Data about the employee.
31 32 33 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 31 def employee @employee end |
#employer ⇒ CreditPayStubEmployer
Information about the employer on the pay stub.
35 36 37 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 35 def employer @employer end |
#net_pay ⇒ CreditPayStubNetPay
An object representing information about the net pay amount on the pay stub.
40 41 42 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 40 def net_pay @net_pay end |
#pay_period_details ⇒ PayStubPayPeriodDetails
Details about the pay period.
44 45 46 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 44 def pay_period_details @pay_period_details end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 90 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. deductions = CreditPayStubDeductions.from_hash(hash['deductions']) if hash['deductions'] document_id = hash.key?('document_id') ? hash['document_id'] : nil = CreditDocumentMetadata.from_hash(hash['document_metadata']) if hash['document_metadata'] earnings = CreditPayStubEarnings.from_hash(hash['earnings']) if hash['earnings'] employee = CreditPayStubEmployee.from_hash(hash['employee']) if hash['employee'] employer = CreditPayStubEmployer.from_hash(hash['employer']) if hash['employer'] net_pay = CreditPayStubNetPay.from_hash(hash['net_pay']) if hash['net_pay'] pay_period_details = PayStubPayPeriodDetails.from_hash(hash['pay_period_details']) if hash['pay_period_details'] # 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. CreditPayStub.new(deductions: deductions, document_id: document_id, document_metadata: , earnings: earnings, employee: employee, employer: employer, net_pay: net_pay, pay_period_details: pay_period_details, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 47 def self.names @_hash = {} if @_hash.nil? @_hash['deductions'] = 'deductions' @_hash['document_id'] = 'document_id' @_hash['document_metadata'] = 'document_metadata' @_hash['earnings'] = 'earnings' @_hash['employee'] = 'employee' @_hash['employer'] = 'employer' @_hash['net_pay'] = 'net_pay' @_hash['pay_period_details'] = 'pay_period_details' @_hash end |
.nullables ⇒ Object
An array for nullable fields
66 67 68 69 70 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 66 def self.nullables %w[ document_id ] end |
.optionals ⇒ Object
An array for optional fields
61 62 63 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 61 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
134 135 136 137 138 139 140 141 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 134 def inspect class_name = self.class.name.split('::').last "<#{class_name} deductions: #{@deductions.inspect}, document_id: #{@document_id.inspect},"\ " document_metadata: #{@document_metadata.inspect}, earnings: #{@earnings.inspect},"\ " employee: #{@employee.inspect}, employer: #{@employer.inspect}, net_pay:"\ " #{@net_pay.inspect}, pay_period_details: #{@pay_period_details.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
125 126 127 128 129 130 131 |
# File 'lib/the_plaid_api/models/credit_pay_stub.rb', line 125 def to_s class_name = self.class.name.split('::').last "<#{class_name} deductions: #{@deductions}, document_id: #{@document_id},"\ " document_metadata: #{@document_metadata}, earnings: #{@earnings}, employee: #{@employee},"\ " employer: #{@employer}, net_pay: #{@net_pay}, pay_period_details: #{@pay_period_details},"\ " additional_properties: #{@additional_properties}>" end |