Class: ThePlaidApi::PaystubOverrideDeductionsBreakdown

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

Overview

An object representing the deduction 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(current_amount: SKIP, description: SKIP, currency: SKIP, ytd_amount: SKIP, additional_properties: nil) ⇒ PaystubOverrideDeductionsBreakdown

Returns a new instance of PaystubOverrideDeductionsBreakdown.



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/the_plaid_api/models/paystub_override_deductions_breakdown.rb', line 58

def initialize(current_amount: SKIP, description: 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
  @description = description unless description == 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)


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

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_breakdown.rb', line 14

def current_amount
  @current_amount
end

#descriptionString

Description of the deduction line item

Returns:

  • (String)


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

def description
  @description
end

#ytd_amountFloat

The year-to-date amount of the deduction

Returns:

  • (Float)


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

def ytd_amount
  @ytd_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/the_plaid_api/models/paystub_override_deductions_breakdown.rb', line 71

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/the_plaid_api/models/paystub_override_deductions_breakdown.rb', line 29

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

.nullablesObject

An array for nullable fields



49
50
51
52
53
54
55
56
# File 'lib/the_plaid_api/models/paystub_override_deductions_breakdown.rb', line 49

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

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/the_plaid_api/models/paystub_override_deductions_breakdown.rb', line 39

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



105
106
107
108
109
110
# File 'lib/the_plaid_api/models/paystub_override_deductions_breakdown.rb', line 105

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



97
98
99
100
101
102
# File 'lib/the_plaid_api/models/paystub_override_deductions_breakdown.rb', line 97

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