Class: ThePlaidApi::EarningsTotal
- Defined in:
- lib/the_plaid_api/models/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
-
#current_amount ⇒ Float
Total amount of the earnings for this pay period.
-
#current_pay ⇒ Pay
An object representing a monetary amount.
-
#hours ⇒ Float
Total number of hours worked for this pay period.
-
#iso_currency_code ⇒ String
The ISO-4217 currency code of the line item.
-
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the security.
-
#ytd_amount ⇒ Float
The total year-to-date amount of the earnings.
-
#ytd_pay ⇒ Pay
An object representing a monetary amount.
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, current_pay: SKIP, ytd_pay: SKIP, hours: SKIP, iso_currency_code: SKIP, unofficial_currency_code: SKIP, ytd_amount: SKIP, additional_properties: nil) ⇒ EarningsTotal
constructor
A new instance of EarningsTotal.
-
#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, current_pay: SKIP, ytd_pay: SKIP, hours: SKIP, iso_currency_code: SKIP, unofficial_currency_code: SKIP, ytd_amount: SKIP, additional_properties: nil) ⇒ EarningsTotal
Returns a new instance of EarningsTotal.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/the_plaid_api/models/earnings_total.rb', line 85 def initialize(current_amount: SKIP, current_pay: SKIP, ytd_pay: SKIP, hours: 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 @current_pay = current_pay unless current_pay == SKIP @ytd_pay = ytd_pay unless ytd_pay == SKIP @hours = hours unless hours == 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
Total amount of the earnings for this pay period
15 16 17 |
# File 'lib/the_plaid_api/models/earnings_total.rb', line 15 def current_amount @current_amount end |
#current_pay ⇒ Pay
An object representing a monetary amount.
19 20 21 |
# File 'lib/the_plaid_api/models/earnings_total.rb', line 19 def current_pay @current_pay end |
#hours ⇒ Float
Total number of hours worked for this pay period
27 28 29 |
# File 'lib/the_plaid_api/models/earnings_total.rb', line 27 def hours @hours end |
#iso_currency_code ⇒ String
The ISO-4217 currency code of the line item. Always ‘null` if `unofficial_currency_code` is non-null.
32 33 34 |
# File 'lib/the_plaid_api/models/earnings_total.rb', line 32 def iso_currency_code @iso_currency_code end |
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the security. 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.
42 43 44 |
# File 'lib/the_plaid_api/models/earnings_total.rb', line 42 def unofficial_currency_code @unofficial_currency_code end |
#ytd_amount ⇒ Float
The total year-to-date amount of the earnings
46 47 48 |
# File 'lib/the_plaid_api/models/earnings_total.rb', line 46 def ytd_amount @ytd_amount end |
#ytd_pay ⇒ Pay
An object representing a monetary amount.
23 24 25 |
# File 'lib/the_plaid_api/models/earnings_total.rb', line 23 def ytd_pay @ytd_pay end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/the_plaid_api/models/earnings_total.rb', line 103 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. current_amount = hash.key?('current_amount') ? hash['current_amount'] : SKIP current_pay = Pay.from_hash(hash['current_pay']) if hash['current_pay'] ytd_pay = Pay.from_hash(hash['ytd_pay']) if hash['ytd_pay'] hours = hash.key?('hours') ? hash['hours'] : 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. EarningsTotal.new(current_amount: current_amount, current_pay: current_pay, ytd_pay: ytd_pay, hours: hours, 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.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/the_plaid_api/models/earnings_total.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['current_amount'] = 'current_amount' @_hash['current_pay'] = 'current_pay' @_hash['ytd_pay'] = 'ytd_pay' @_hash['hours'] = 'hours' @_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
75 76 77 78 79 80 81 82 83 |
# File 'lib/the_plaid_api/models/earnings_total.rb', line 75 def self.nullables %w[ current_amount hours iso_currency_code unofficial_currency_code ytd_amount ] end |
.optionals ⇒ Object
An array for optional fields
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/the_plaid_api/models/earnings_total.rb', line 62 def self.optionals %w[ current_amount current_pay ytd_pay hours iso_currency_code unofficial_currency_code ytd_amount ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
146 147 148 149 150 151 152 153 |
# File 'lib/the_plaid_api/models/earnings_total.rb', line 146 def inspect class_name = self.class.name.split('::').last "<#{class_name} current_amount: #{@current_amount.inspect}, current_pay:"\ " #{@current_pay.inspect}, ytd_pay: #{@ytd_pay.inspect}, hours: #{@hours.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.
137 138 139 140 141 142 143 |
# File 'lib/the_plaid_api/models/earnings_total.rb', line 137 def to_s class_name = self.class.name.split('::').last "<#{class_name} current_amount: #{@current_amount}, current_pay: #{@current_pay}, ytd_pay:"\ " #{@ytd_pay}, hours: #{@hours}, iso_currency_code: #{@iso_currency_code},"\ " unofficial_currency_code: #{@unofficial_currency_code}, ytd_amount: #{@ytd_amount},"\ " additional_properties: #{@additional_properties}>" end |