Class: FdxV660Api::EarningComponent
- Defined in:
- lib/fdx_v660_api/models/earning_component.rb
Overview
A single named pay component earned on this paystub with amount and optional
currency and/or year-to-date amount. Common names to use for earned
components that would fall under OTHER type (in addition to names for BASE,
BONUS, COMMISSION, and OVERTIME types) are Tips, Stock, Workers
Compensation, Pension, and Severance. (Inheriting properties amount,
currency, name and yearToDate from PayAmount)
Instance Attribute Summary collapse
-
#amount ⇒ Float
The monetary amount.
-
#currency ⇒ Iso4217CurrencyCode7
Currency code of the monetary amount.
-
#hours ⇒ Float
The number of hours paid for this component amount.
-
#name ⇒ String
Name of this pay element, earning or deduction, if needed.
-
#rate ⇒ Float
The rate used to calculate this earned component amount.
-
#rate_type ⇒ PayrollRateType1
The unit for this rate.
-
#type ⇒ EarningType
The GSE Mapping for a specific earning component.
-
#year_to_date ⇒ Float
Year-to-date currency amount for this pay element, earning or deduction, if relevant.
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(amount:, currency: SKIP, name: SKIP, year_to_date: SKIP, rate: SKIP, rate_type: SKIP, hours: SKIP, type: SKIP, additional_properties: nil) ⇒ EarningComponent
constructor
A new instance of EarningComponent.
-
#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(amount:, currency: SKIP, name: SKIP, year_to_date: SKIP, rate: SKIP, rate_type: SKIP, hours: SKIP, type: SKIP, additional_properties: nil) ⇒ EarningComponent
Returns a new instance of EarningComponent.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/fdx_v660_api/models/earning_component.rb', line 86 def initialize(amount:, currency: SKIP, name: SKIP, year_to_date: SKIP, rate: SKIP, rate_type: SKIP, hours: SKIP, type: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @amount = amount @currency = currency unless currency == SKIP @name = name unless name == SKIP @year_to_date = year_to_date unless year_to_date == SKIP @rate = rate unless rate == SKIP @rate_type = rate_type unless rate_type == SKIP @hours = hours unless hours == SKIP @type = type unless type == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Float
The monetary amount
19 20 21 |
# File 'lib/fdx_v660_api/models/earning_component.rb', line 19 def amount @amount end |
#currency ⇒ Iso4217CurrencyCode7
Currency code of the monetary amount
23 24 25 |
# File 'lib/fdx_v660_api/models/earning_component.rb', line 23 def currency @currency end |
#hours ⇒ Float
The number of hours paid for this component amount
46 47 48 |
# File 'lib/fdx_v660_api/models/earning_component.rb', line 46 def hours @hours end |
#name ⇒ String
Name of this pay element, earning or deduction, if needed
27 28 29 |
# File 'lib/fdx_v660_api/models/earning_component.rb', line 27 def name @name end |
#rate ⇒ Float
The rate used to calculate this earned component amount
36 37 38 |
# File 'lib/fdx_v660_api/models/earning_component.rb', line 36 def rate @rate end |
#rate_type ⇒ PayrollRateType1
The unit for this rate. In time period length order, one of HOURLY, DAILY, WEEKLY, BI-WEEKLY, SEMI-MONTHLY, EVERY 2.6 WEEKS, EVERY 4 WEEKS, MONTHLY, EVERY 5.2 WEEKS, QUARTERLY, SEMI-ANNUALLY, ANNUAL, OTHER
42 43 44 |
# File 'lib/fdx_v660_api/models/earning_component.rb', line 42 def rate_type @rate_type end |
#type ⇒ EarningType
The GSE Mapping for a specific earning component. For a Government Sponsored Enterprise (GSE), such as Fannie Mae or Freddie Mac. One of BASE, BONUS, COMMISSION, OTHER, OVERTIME
52 53 54 |
# File 'lib/fdx_v660_api/models/earning_component.rb', line 52 def type @type end |
#year_to_date ⇒ Float
Year-to-date currency amount for this pay element, earning or deduction, if relevant
32 33 34 |
# File 'lib/fdx_v660_api/models/earning_component.rb', line 32 def year_to_date @year_to_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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/fdx_v660_api/models/earning_component.rb', line 104 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. amount = hash.key?('amount') ? hash['amount'] : nil currency = hash.key?('currency') ? hash['currency'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP year_to_date = hash.key?('yearToDate') ? hash['yearToDate'] : SKIP rate = hash.key?('rate') ? hash['rate'] : SKIP rate_type = hash.key?('rateType') ? hash['rateType'] : SKIP hours = hash.key?('hours') ? hash['hours'] : SKIP type = hash.key?('type') ? hash['type'] : 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. EarningComponent.new(amount: amount, currency: currency, name: name, year_to_date: year_to_date, rate: rate, rate_type: rate_type, hours: hours, type: type, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/fdx_v660_api/models/earning_component.rb', line 55 def self.names @_hash = {} if @_hash.nil? @_hash['amount'] = 'amount' @_hash['currency'] = 'currency' @_hash['name'] = 'name' @_hash['year_to_date'] = 'yearToDate' @_hash['rate'] = 'rate' @_hash['rate_type'] = 'rateType' @_hash['hours'] = 'hours' @_hash['type'] = 'type' @_hash end |
.nullables ⇒ Object
An array for nullable fields
82 83 84 |
# File 'lib/fdx_v660_api/models/earning_component.rb', line 82 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/fdx_v660_api/models/earning_component.rb', line 69 def self.optionals %w[ currency name year_to_date rate rate_type hours type ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
145 146 147 148 149 150 151 |
# File 'lib/fdx_v660_api/models/earning_component.rb', line 145 def inspect class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount.inspect}, currency: #{@currency.inspect}, name:"\ " #{@name.inspect}, year_to_date: #{@year_to_date.inspect}, rate: #{@rate.inspect},"\ " rate_type: #{@rate_type.inspect}, hours: #{@hours.inspect}, type: #{@type.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
137 138 139 140 141 142 |
# File 'lib/fdx_v660_api/models/earning_component.rb', line 137 def to_s class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount}, currency: #{@currency}, name: #{@name}, year_to_date:"\ " #{@year_to_date}, rate: #{@rate}, rate_type: #{@rate_type}, hours: #{@hours}, type:"\ " #{@type}, additional_properties: #{@additional_properties}>" end |