Class: ThePlaidApi::PayStubPayPeriodDetails

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

Overview

Details about the pay period.

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(pay_amount:, distribution_breakdown:, end_date:, gross_earnings:, iso_currency_code:, pay_date:, pay_frequency:, start_date:, unofficial_currency_code:, pay_basis: SKIP, additional_properties: nil) ⇒ PayStubPayPeriodDetails

Returns a new instance of PayStubPayPeriodDetails.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/the_plaid_api/models/pay_stub_pay_period_details.rb', line 99

def initialize(pay_amount:, distribution_breakdown:, end_date:,
               gross_earnings:, iso_currency_code:, pay_date:,
               pay_frequency:, start_date:, unofficial_currency_code:,
               pay_basis: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @pay_amount = pay_amount
  @distribution_breakdown = distribution_breakdown
  @end_date = end_date
  @gross_earnings = gross_earnings
  @iso_currency_code = iso_currency_code
  @pay_date = pay_date
  @pay_frequency = pay_frequency
  @pay_basis = pay_basis unless pay_basis == SKIP
  @start_date = start_date
  @unofficial_currency_code = unofficial_currency_code
  @additional_properties = additional_properties
end

Instance Attribute Details

#distribution_breakdownArray[PayStubDistributionBreakdown]

The amount of the paycheck.

Returns:



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

def distribution_breakdown
  @distribution_breakdown
end

#end_dateDate

The date on which the pay period ended, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (“yyyy-mm-dd”).

Returns:

  • (Date)


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

def end_date
  @end_date
end

#gross_earningsFloat

Total earnings before tax/deductions.

Returns:

  • (Float)


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

def gross_earnings
  @gross_earnings
end

#iso_currency_codeString

The ISO-4217 currency code of the net pay. Always ‘null` if `unofficial_currency_code` is non-null.

Returns:

  • (String)


32
33
34
# File 'lib/the_plaid_api/models/pay_stub_pay_period_details.rb', line 32

def iso_currency_code
  @iso_currency_code
end

#pay_amountFloat

The amount of the paycheck.

Returns:

  • (Float)


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

def pay_amount
  @pay_amount
end

#pay_basisCreditPayStubPayBasisType

The explicit pay basis on the paystub (if present).



45
46
47
# File 'lib/the_plaid_api/models/pay_stub_pay_period_details.rb', line 45

def pay_basis
  @pay_basis
end

#pay_dateDate

The date on which the pay stub was issued, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (“yyyy-mm-dd”).

Returns:

  • (Date)


37
38
39
# File 'lib/the_plaid_api/models/pay_stub_pay_period_details.rb', line 37

def pay_date
  @pay_date
end

#pay_frequencyString

The frequency at which an individual is paid.

Returns:

  • (String)


41
42
43
# File 'lib/the_plaid_api/models/pay_stub_pay_period_details.rb', line 41

def pay_frequency
  @pay_frequency
end

#start_dateDate

The date on which the pay period started, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (“yyyy-mm-dd”).

Returns:

  • (Date)


50
51
52
# File 'lib/the_plaid_api/models/pay_stub_pay_period_details.rb', line 50

def start_date
  @start_date
end

#unofficial_currency_codeString

The unofficial currency code associated with the net pay. Always ‘null` if `iso_currency_code` is non-`null`. Unofficial currency codes are used for currencies that do not have official ISO currency codes, such as cryptocurrencies and the currencies of certain countries. See the [currency code schema](plaid.com/docs/api/accounts#currency-code-schema) for a full listing of supported `iso_currency_code`s.

Returns:

  • (String)


60
61
62
# File 'lib/the_plaid_api/models/pay_stub_pay_period_details.rb', line 60

def unofficial_currency_code
  @unofficial_currency_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/the_plaid_api/models/pay_stub_pay_period_details.rb', line 120

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  pay_amount = hash.key?('pay_amount') ? hash['pay_amount'] : nil
  # Parameter is an array, so we need to iterate through it
  distribution_breakdown = nil
  unless hash['distribution_breakdown'].nil?
    distribution_breakdown = []
    hash['distribution_breakdown'].each do |structure|
      distribution_breakdown << (PayStubDistributionBreakdown.from_hash(structure) if structure)
    end
  end

  distribution_breakdown = nil unless hash.key?('distribution_breakdown')
  end_date = hash.key?('end_date') ? hash['end_date'] : nil
  gross_earnings =
    hash.key?('gross_earnings') ? hash['gross_earnings'] : nil
  iso_currency_code =
    hash.key?('iso_currency_code') ? hash['iso_currency_code'] : nil
  pay_date = hash.key?('pay_date') ? hash['pay_date'] : nil
  pay_frequency = hash.key?('pay_frequency') ? hash['pay_frequency'] : nil
  start_date = hash.key?('start_date') ? hash['start_date'] : nil
  unofficial_currency_code =
    hash.key?('unofficial_currency_code') ? hash['unofficial_currency_code'] : nil
  pay_basis = hash.key?('pay_basis') ? hash['pay_basis'] : SKIP

  # 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.
  PayStubPayPeriodDetails.new(pay_amount: pay_amount,
                              distribution_breakdown: distribution_breakdown,
                              end_date: end_date,
                              gross_earnings: gross_earnings,
                              iso_currency_code: iso_currency_code,
                              pay_date: pay_date,
                              pay_frequency: pay_frequency,
                              start_date: start_date,
                              unofficial_currency_code: unofficial_currency_code,
                              pay_basis: pay_basis,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/the_plaid_api/models/pay_stub_pay_period_details.rb', line 63

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['pay_amount'] = 'pay_amount'
  @_hash['distribution_breakdown'] = 'distribution_breakdown'
  @_hash['end_date'] = 'end_date'
  @_hash['gross_earnings'] = 'gross_earnings'
  @_hash['iso_currency_code'] = 'iso_currency_code'
  @_hash['pay_date'] = 'pay_date'
  @_hash['pay_frequency'] = 'pay_frequency'
  @_hash['pay_basis'] = 'pay_basis'
  @_hash['start_date'] = 'start_date'
  @_hash['unofficial_currency_code'] = 'unofficial_currency_code'
  @_hash
end

.nullablesObject

An array for nullable fields



86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/the_plaid_api/models/pay_stub_pay_period_details.rb', line 86

def self.nullables
  %w[
    pay_amount
    end_date
    gross_earnings
    iso_currency_code
    pay_date
    pay_frequency
    start_date
    unofficial_currency_code
  ]
end

.optionalsObject

An array for optional fields



79
80
81
82
83
# File 'lib/the_plaid_api/models/pay_stub_pay_period_details.rb', line 79

def self.optionals
  %w[
    pay_basis
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



180
181
182
183
184
185
186
187
188
# File 'lib/the_plaid_api/models/pay_stub_pay_period_details.rb', line 180

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} pay_amount: #{@pay_amount.inspect}, distribution_breakdown:"\
  " #{@distribution_breakdown.inspect}, end_date: #{@end_date.inspect}, gross_earnings:"\
  " #{@gross_earnings.inspect}, iso_currency_code: #{@iso_currency_code.inspect}, pay_date:"\
  " #{@pay_date.inspect}, pay_frequency: #{@pay_frequency.inspect}, pay_basis:"\
  " #{@pay_basis.inspect}, start_date: #{@start_date.inspect}, unofficial_currency_code:"\
  " #{@unofficial_currency_code.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



169
170
171
172
173
174
175
176
177
# File 'lib/the_plaid_api/models/pay_stub_pay_period_details.rb', line 169

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} pay_amount: #{@pay_amount}, distribution_breakdown:"\
  " #{@distribution_breakdown}, end_date: #{@end_date}, gross_earnings: #{@gross_earnings},"\
  " iso_currency_code: #{@iso_currency_code}, pay_date: #{@pay_date}, pay_frequency:"\
  " #{@pay_frequency}, pay_basis: #{@pay_basis}, start_date: #{@start_date},"\
  " unofficial_currency_code: #{@unofficial_currency_code}, additional_properties:"\
  " #{@additional_properties}>"
end