Class: ThePlaidApi::PaystubOverrideDeductionsTotal

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

Overview

An object representing the total deductions 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(current_amount: SKIP, currency: SKIP, ytd_amount: SKIP, additional_properties: nil) ⇒ PaystubOverrideDeductionsTotal

Returns a new instance of PaystubOverrideDeductionsTotal.



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

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

  @current_amount = current_amount unless current_amount == 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)


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

def currency
  @currency
end

#current_amountFloat

Raw amount of the deduction

Returns:

  • (Float)


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

def current_amount
  @current_amount
end

#ytd_amountFloat

The year-to-date total amount of the deductions

Returns:

  • (Float)


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

def ytd_amount
  @ytd_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



63
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_deductions_total.rb', line 63

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



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

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

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    current_amount
    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_deductions_total.rb', line 94

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} current_amount: #{@current_amount.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_deductions_total.rb', line 87

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