Class: ThePlaidApi::PaystubOverridePayPeriodDetails

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/paystub_override_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(check_amount: SKIP, distribution_breakdown: SKIP, end_date: SKIP, gross_earnings: SKIP, pay_date: SKIP, pay_frequency: SKIP, pay_day: SKIP, start_date: SKIP, additional_properties: nil) ⇒ PaystubOverridePayPeriodDetails

Returns a new instance of PaystubOverridePayPeriodDetails.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/the_plaid_api/models/paystub_override_pay_period_details.rb', line 89

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

  @check_amount = check_amount unless check_amount == SKIP
  @distribution_breakdown = distribution_breakdown unless distribution_breakdown == SKIP
  @end_date = end_date unless end_date == SKIP
  @gross_earnings = gross_earnings unless gross_earnings == SKIP
  @pay_date = pay_date unless pay_date == SKIP
  @pay_frequency = pay_frequency unless pay_frequency == SKIP
  @pay_day = pay_day unless pay_day == SKIP
  @start_date = start_date unless start_date == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#check_amountFloat

The amount of the paycheck.

Returns:

  • (Float)


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

def check_amount
  @check_amount
end

#distribution_breakdownArray[DistributionBreakdown]

The amount of the paycheck.

Returns:



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

def distribution_breakdown
  @distribution_breakdown
end

#end_dateDate

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

Returns:

  • (Date)


23
24
25
# File 'lib/the_plaid_api/models/paystub_override_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/paystub_override_pay_period_details.rb', line 27

def gross_earnings
  @gross_earnings
end

#pay_dateDate

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

Returns:

  • (Date)


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

def pay_date
  @pay_date
end

#pay_dayDate

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

Returns:

  • (Date)


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

def pay_day
  @pay_day
end

#pay_frequencyPayPeriodDetailsPayFrequency

The frequency at which an individual is paid.



36
37
38
# File 'lib/the_plaid_api/models/paystub_override_pay_period_details.rb', line 36

def pay_frequency
  @pay_frequency
end

#start_dateDate

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

Returns:

  • (Date)


46
47
48
# File 'lib/the_plaid_api/models/paystub_override_pay_period_details.rb', line 46

def start_date
  @start_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



108
109
110
111
112
113
114
115
116
117
118
119
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
# File 'lib/the_plaid_api/models/paystub_override_pay_period_details.rb', line 108

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  check_amount = hash.key?('check_amount') ? hash['check_amount'] : SKIP
  # 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 << (DistributionBreakdown.from_hash(structure) if structure)
    end
  end

  distribution_breakdown = SKIP unless hash.key?('distribution_breakdown')
  end_date = hash.key?('end_date') ? hash['end_date'] : SKIP
  gross_earnings =
    hash.key?('gross_earnings') ? hash['gross_earnings'] : SKIP
  pay_date = hash.key?('pay_date') ? hash['pay_date'] : SKIP
  pay_frequency = hash.key?('pay_frequency') ? hash['pay_frequency'] : SKIP
  pay_day = hash.key?('pay_day') ? hash['pay_day'] : SKIP
  start_date = hash.key?('start_date') ? hash['start_date'] : 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.
  PaystubOverridePayPeriodDetails.new(check_amount: check_amount,
                                      distribution_breakdown: distribution_breakdown,
                                      end_date: end_date,
                                      gross_earnings: gross_earnings,
                                      pay_date: pay_date,
                                      pay_frequency: pay_frequency,
                                      pay_day: pay_day,
                                      start_date: start_date,
                                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/the_plaid_api/models/paystub_override_pay_period_details.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['check_amount'] = 'check_amount'
  @_hash['distribution_breakdown'] = 'distribution_breakdown'
  @_hash['end_date'] = 'end_date'
  @_hash['gross_earnings'] = 'gross_earnings'
  @_hash['pay_date'] = 'pay_date'
  @_hash['pay_frequency'] = 'pay_frequency'
  @_hash['pay_day'] = 'pay_day'
  @_hash['start_date'] = 'start_date'
  @_hash
end

.nullablesObject

An array for nullable fields



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/the_plaid_api/models/paystub_override_pay_period_details.rb', line 77

def self.nullables
  %w[
    check_amount
    end_date
    gross_earnings
    pay_date
    pay_frequency
    pay_day
    start_date
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    check_amount
    distribution_breakdown
    end_date
    gross_earnings
    pay_date
    pay_frequency
    pay_day
    start_date
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



160
161
162
163
164
165
166
167
# File 'lib/the_plaid_api/models/paystub_override_pay_period_details.rb', line 160

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

#to_sObject

Provides a human-readable string representation of the object.



151
152
153
154
155
156
157
# File 'lib/the_plaid_api/models/paystub_override_pay_period_details.rb', line 151

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