Class: FdxV660Api::PayAmount1
- Defined in:
- lib/fdx_v660_api/models/pay_amount1.rb
Overview
Gross pay and year-to-date amounts and currency for this paystub
Instance Attribute Summary collapse
-
#amount ⇒ Float
The monetary amount.
-
#currency ⇒ Iso4217CurrencyCode7
Currency code of the monetary amount.
-
#name ⇒ String
Name of this pay element, earning or deduction, if needed.
-
#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, additional_properties: nil) ⇒ PayAmount1
constructor
A new instance of PayAmount1.
-
#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, additional_properties: nil) ⇒ PayAmount1
Returns a new instance of PayAmount1.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/fdx_v660_api/models/pay_amount1.rb', line 53 def initialize(amount:, currency: SKIP, name: SKIP, year_to_date: 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 @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Float
The monetary amount
14 15 16 |
# File 'lib/fdx_v660_api/models/pay_amount1.rb', line 14 def amount @amount end |
#currency ⇒ Iso4217CurrencyCode7
Currency code of the monetary amount
18 19 20 |
# File 'lib/fdx_v660_api/models/pay_amount1.rb', line 18 def currency @currency end |
#name ⇒ String
Name of this pay element, earning or deduction, if needed
22 23 24 |
# File 'lib/fdx_v660_api/models/pay_amount1.rb', line 22 def name @name end |
#year_to_date ⇒ Float
Year-to-date currency amount for this pay element, earning or deduction, if relevant
27 28 29 |
# File 'lib/fdx_v660_api/models/pay_amount1.rb', line 27 def year_to_date @year_to_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/fdx_v660_api/models/pay_amount1.rb', line 66 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 # 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. PayAmount1.new(amount: amount, currency: currency, name: name, year_to_date: year_to_date, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 37 |
# File 'lib/fdx_v660_api/models/pay_amount1.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['amount'] = 'amount' @_hash['currency'] = 'currency' @_hash['name'] = 'name' @_hash['year_to_date'] = 'yearToDate' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 |
# File 'lib/fdx_v660_api/models/pay_amount1.rb', line 49 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
40 41 42 43 44 45 46 |
# File 'lib/fdx_v660_api/models/pay_amount1.rb', line 40 def self.optionals %w[ currency name year_to_date ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
98 99 100 101 102 103 |
# File 'lib/fdx_v660_api/models/pay_amount1.rb', line 98 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}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
91 92 93 94 95 |
# File 'lib/fdx_v660_api/models/pay_amount1.rb', line 91 def to_s class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount}, currency: #{@currency}, name: #{@name}, year_to_date:"\ " #{@year_to_date}, additional_properties: #{@additional_properties}>" end |