Class: ThePlaidApi::DeductionsTotal
- Defined in:
- lib/the_plaid_api/models/deductions_total.rb
Overview
An object representing the total deductions for the pay period
Instance Attribute Summary collapse
-
#current_amount ⇒ Float
Raw amount of the deduction.
-
#iso_currency_code ⇒ String
The ISO-4217 currency code of the line item.
-
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the line item.
-
#ytd_amount ⇒ Float
The year-to-date total amount of the deductions.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(current_amount: SKIP, iso_currency_code: SKIP, unofficial_currency_code: SKIP, ytd_amount: SKIP, additional_properties: nil) ⇒ DeductionsTotal
constructor
A new instance of DeductionsTotal.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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, iso_currency_code: SKIP, unofficial_currency_code: SKIP, ytd_amount: SKIP, additional_properties: nil) ⇒ DeductionsTotal
Returns a new instance of DeductionsTotal.
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/the_plaid_api/models/deductions_total.rb', line 65 def initialize(current_amount: SKIP, iso_currency_code: SKIP, unofficial_currency_code: 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 @iso_currency_code = iso_currency_code unless iso_currency_code == SKIP @unofficial_currency_code = unofficial_currency_code unless unofficial_currency_code == SKIP @ytd_amount = ytd_amount unless ytd_amount == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#current_amount ⇒ Float
Raw amount of the deduction
14 15 16 |
# File 'lib/the_plaid_api/models/deductions_total.rb', line 14 def current_amount @current_amount end |
#iso_currency_code ⇒ String
The ISO-4217 currency code of the line item. Always ‘null` if `unofficial_currency_code` is non-null.
19 20 21 |
# File 'lib/the_plaid_api/models/deductions_total.rb', line 19 def iso_currency_code @iso_currency_code end |
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the line item. Always ‘null` if `iso_currency_code` is non-`null`. Unofficial currency codes are used for currencies that do not have official ISO currency codes, such as cryptocurrencies and the currencies of certain countries. See the [currency code schema](plaid.com/docs/api/accounts#currency-code-schema) for a full listing of supported `iso_currency_code`s.
29 30 31 |
# File 'lib/the_plaid_api/models/deductions_total.rb', line 29 def unofficial_currency_code @unofficial_currency_code end |
#ytd_amount ⇒ Float
The year-to-date total amount of the deductions
33 34 35 |
# File 'lib/the_plaid_api/models/deductions_total.rb', line 33 def ytd_amount @ytd_amount end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/the_plaid_api/models/deductions_total.rb', line 79 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. current_amount = hash.key?('current_amount') ? hash['current_amount'] : SKIP iso_currency_code = hash.key?('iso_currency_code') ? hash['iso_currency_code'] : SKIP unofficial_currency_code = hash.key?('unofficial_currency_code') ? hash['unofficial_currency_code'] : 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. DeductionsTotal.new(current_amount: current_amount, iso_currency_code: iso_currency_code, unofficial_currency_code: unofficial_currency_code, ytd_amount: ytd_amount, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
36 37 38 39 40 41 42 43 |
# File 'lib/the_plaid_api/models/deductions_total.rb', line 36 def self.names @_hash = {} if @_hash.nil? @_hash['current_amount'] = 'current_amount' @_hash['iso_currency_code'] = 'iso_currency_code' @_hash['unofficial_currency_code'] = 'unofficial_currency_code' @_hash['ytd_amount'] = 'ytd_amount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
56 57 58 59 60 61 62 63 |
# File 'lib/the_plaid_api/models/deductions_total.rb', line 56 def self.nullables %w[ current_amount iso_currency_code unofficial_currency_code ytd_amount ] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 51 52 53 |
# File 'lib/the_plaid_api/models/deductions_total.rb', line 46 def self.optionals %w[ current_amount iso_currency_code unofficial_currency_code ytd_amount ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
115 116 117 118 119 120 121 |
# File 'lib/the_plaid_api/models/deductions_total.rb', line 115 def inspect class_name = self.class.name.split('::').last "<#{class_name} current_amount: #{@current_amount.inspect}, iso_currency_code:"\ " #{@iso_currency_code.inspect}, unofficial_currency_code:"\ " #{@unofficial_currency_code.inspect}, ytd_amount: #{@ytd_amount.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
107 108 109 110 111 112 |
# File 'lib/the_plaid_api/models/deductions_total.rb', line 107 def to_s class_name = self.class.name.split('::').last "<#{class_name} current_amount: #{@current_amount}, iso_currency_code:"\ " #{@iso_currency_code}, unofficial_currency_code: #{@unofficial_currency_code}, ytd_amount:"\ " #{@ytd_amount}, additional_properties: #{@additional_properties}>" end |