Class: ThePlaidApi::PaystubOverrideEarningsBreakdown

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

Overview

An object representing the earnings line items for 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(canonical_description: SKIP, current_amount: SKIP, description: SKIP, hours: SKIP, currency: SKIP, rate: SKIP, ytd_amount: SKIP, additional_properties: nil) ⇒ PaystubOverrideEarningsBreakdown

Returns a new instance of PaystubOverrideEarningsBreakdown.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/the_plaid_api/models/paystub_override_earnings_breakdown.rb', line 79

def initialize(canonical_description: SKIP, current_amount: SKIP,
               description: SKIP, hours: SKIP, currency: SKIP, rate: SKIP,
               ytd_amount: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @canonical_description = canonical_description unless canonical_description == SKIP
  @current_amount = current_amount unless current_amount == SKIP
  @description = description unless description == SKIP
  @hours = hours unless hours == SKIP
  @currency = currency unless currency == SKIP
  @rate = rate unless rate == SKIP
  @ytd_amount = ytd_amount unless ytd_amount == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#canonical_descriptionEarningsBreakdownCanonicalDescription

Commonly used term to describe the earning line item.



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

def canonical_description
  @canonical_description
end

#currencyString

The ISO-4217 currency code of the line item.

Returns:

  • (String)


30
31
32
# File 'lib/the_plaid_api/models/paystub_override_earnings_breakdown.rb', line 30

def currency
  @currency
end

#current_amountFloat

Raw amount of the earning line item.

Returns:

  • (Float)


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

def current_amount
  @current_amount
end

#descriptionString

Description of the earning line item.

Returns:

  • (String)


22
23
24
# File 'lib/the_plaid_api/models/paystub_override_earnings_breakdown.rb', line 22

def description
  @description
end

#hoursFloat

Number of hours applicable for this earning.

Returns:

  • (Float)


26
27
28
# File 'lib/the_plaid_api/models/paystub_override_earnings_breakdown.rb', line 26

def hours
  @hours
end

#rateFloat

Hourly rate applicable for this earning.

Returns:

  • (Float)


34
35
36
# File 'lib/the_plaid_api/models/paystub_override_earnings_breakdown.rb', line 34

def rate
  @rate
end

#ytd_amountFloat

The year-to-date amount of the deduction.

Returns:

  • (Float)


38
39
40
# File 'lib/the_plaid_api/models/paystub_override_earnings_breakdown.rb', line 38

def ytd_amount
  @ytd_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
123
124
125
126
# File 'lib/the_plaid_api/models/paystub_override_earnings_breakdown.rb', line 96

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  canonical_description =
    hash.key?('canonical_description') ? hash['canonical_description'] : SKIP
  current_amount =
    hash.key?('current_amount') ? hash['current_amount'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  hours = hash.key?('hours') ? hash['hours'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  rate = hash.key?('rate') ? hash['rate'] : SKIP
  ytd_amount = hash.key?('ytd_amount') ? hash['ytd_amount'] : 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.
  PaystubOverrideEarningsBreakdown.new(canonical_description: canonical_description,
                                       current_amount: current_amount,
                                       description: description,
                                       hours: hours,
                                       currency: currency,
                                       rate: rate,
                                       ytd_amount: ytd_amount,
                                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/the_plaid_api/models/paystub_override_earnings_breakdown.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['canonical_description'] = 'canonical_description'
  @_hash['current_amount'] = 'current_amount'
  @_hash['description'] = 'description'
  @_hash['hours'] = 'hours'
  @_hash['currency'] = 'currency'
  @_hash['rate'] = 'rate'
  @_hash['ytd_amount'] = 'ytd_amount'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/the_plaid_api/models/paystub_override_earnings_breakdown.rb', line 67

def self.nullables
  %w[
    canonical_description
    current_amount
    description
    hours
    currency
    rate
    ytd_amount
  ]
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/the_plaid_api/models/paystub_override_earnings_breakdown.rb', line 54

def self.optionals
  %w[
    canonical_description
    current_amount
    description
    hours
    currency
    rate
    ytd_amount
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



138
139
140
141
142
143
144
# File 'lib/the_plaid_api/models/paystub_override_earnings_breakdown.rb', line 138

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} canonical_description: #{@canonical_description.inspect}, current_amount:"\
  " #{@current_amount.inspect}, description: #{@description.inspect}, hours:"\
  " #{@hours.inspect}, currency: #{@currency.inspect}, rate: #{@rate.inspect}, ytd_amount:"\
  " #{@ytd_amount.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



129
130
131
132
133
134
135
# File 'lib/the_plaid_api/models/paystub_override_earnings_breakdown.rb', line 129

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} canonical_description: #{@canonical_description}, current_amount:"\
  " #{@current_amount}, description: #{@description}, hours: #{@hours}, currency:"\
  " #{@currency}, rate: #{@rate}, ytd_amount: #{@ytd_amount}, additional_properties:"\
  " #{@additional_properties}>"
end