Class: ThePlaidApi::IncomeBreakdown
- Defined in:
- lib/the_plaid_api/models/income_breakdown.rb
Overview
An object representing a breakdown of the different income types on the paystub.
Instance Attribute Summary collapse
-
#hours ⇒ Float
The number of hours logged for this income for this pay period.
-
#rate ⇒ Float
The hourly rate at which the income is paid.
-
#total ⇒ Float
The total pay for this pay period.
-
#type ⇒ IncomeBreakdownType
The type of income.
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(type:, rate:, hours:, total:, additional_properties: nil) ⇒ IncomeBreakdown
constructor
A new instance of IncomeBreakdown.
-
#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(type:, rate:, hours:, total:, additional_properties: nil) ⇒ IncomeBreakdown
Returns a new instance of IncomeBreakdown.
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/the_plaid_api/models/income_breakdown.rb', line 57 def initialize(type:, rate:, hours:, total:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @type = type @rate = rate @hours = hours @total = total @additional_properties = additional_properties end |
Instance Attribute Details
#hours ⇒ Float
The number of hours logged for this income for this pay period.
26 27 28 |
# File 'lib/the_plaid_api/models/income_breakdown.rb', line 26 def hours @hours end |
#rate ⇒ Float
The hourly rate at which the income is paid.
22 23 24 |
# File 'lib/the_plaid_api/models/income_breakdown.rb', line 22 def rate @rate end |
#total ⇒ Float
The total pay for this pay period.
30 31 32 |
# File 'lib/the_plaid_api/models/income_breakdown.rb', line 30 def total @total end |
#type ⇒ IncomeBreakdownType
The type of income. Possible values include:
`"regular"`: regular income
`"overtime"`: overtime income
`"bonus"`: bonus income
18 19 20 |
# File 'lib/the_plaid_api/models/income_breakdown.rb', line 18 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/the_plaid_api/models/income_breakdown.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. type = hash.key?('type') ? hash['type'] : nil rate = hash.key?('rate') ? hash['rate'] : nil hours = hash.key?('hours') ? hash['hours'] : nil total = hash.key?('total') ? hash['total'] : nil # 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. IncomeBreakdown.new(type: type, rate: rate, hours: hours, total: total, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 |
# File 'lib/the_plaid_api/models/income_breakdown.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['type'] = 'type' @_hash['rate'] = 'rate' @_hash['hours'] = 'hours' @_hash['total'] = 'total' @_hash end |
.nullables ⇒ Object
An array for nullable fields
48 49 50 51 52 53 54 55 |
# File 'lib/the_plaid_api/models/income_breakdown.rb', line 48 def self.nullables %w[ type rate hours total ] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 |
# File 'lib/the_plaid_api/models/income_breakdown.rb', line 43 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
101 102 103 104 105 |
# File 'lib/the_plaid_api/models/income_breakdown.rb', line 101 def inspect class_name = self.class.name.split('::').last "<#{class_name} type: #{@type.inspect}, rate: #{@rate.inspect}, hours: #{@hours.inspect},"\ " total: #{@total.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
94 95 96 97 98 |
# File 'lib/the_plaid_api/models/income_breakdown.rb', line 94 def to_s class_name = self.class.name.split('::').last "<#{class_name} type: #{@type}, rate: #{@rate}, hours: #{@hours}, total: #{@total},"\ " additional_properties: #{@additional_properties}>" end |