Class: ThePlaidApi::PaystubOverrideEarningsTotal

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

Overview

An object representing both the current pay period and year to date amount for an earning category.

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(hours: SKIP, currency: SKIP, ytd_amount: SKIP, additional_properties: nil) ⇒ PaystubOverrideEarningsTotal

Returns a new instance of PaystubOverrideEarningsTotal.



52
53
54
55
56
57
58
59
60
61
# File 'lib/the_plaid_api/models/paystub_override_earnings_total.rb', line 52

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

  @hours = hours unless hours == SKIP
  @currency = currency unless currency == SKIP
  @ytd_amount = ytd_amount unless ytd_amount == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#currencyString

The ISO-4217 currency code of the line item

Returns:

  • (String)


19
20
21
# File 'lib/the_plaid_api/models/paystub_override_earnings_total.rb', line 19

def currency
  @currency
end

#hoursFloat

Total number of hours worked for this pay period

Returns:

  • (Float)


15
16
17
# File 'lib/the_plaid_api/models/paystub_override_earnings_total.rb', line 15

def hours
  @hours
end

#ytd_amountFloat

The year-to-date amount for the total earnings

Returns:

  • (Float)


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

def ytd_amount
  @ytd_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/the_plaid_api/models/paystub_override_earnings_total.rb', line 64

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/the_plaid_api/models/paystub_override_earnings_total.rb', line 26

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

.nullablesObject

An array for nullable fields



44
45
46
47
48
49
50
# File 'lib/the_plaid_api/models/paystub_override_earnings_total.rb', line 44

def self.nullables
  %w[
    hours
    currency
    ytd_amount
  ]
end

.optionalsObject

An array for optional fields



35
36
37
38
39
40
41
# File 'lib/the_plaid_api/models/paystub_override_earnings_total.rb', line 35

def self.optionals
  %w[
    hours
    currency
    ytd_amount
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



94
95
96
97
98
# File 'lib/the_plaid_api/models/paystub_override_earnings_total.rb', line 94

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

#to_sObject

Provides a human-readable string representation of the object.



87
88
89
90
91
# File 'lib/the_plaid_api/models/paystub_override_earnings_total.rb', line 87

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