Class: FdxV660Api::RegionalTaxWithholding
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- FdxV660Api::RegionalTaxWithholding
- Defined in:
- lib/fdx_v660_api/models/regional_tax_withholding.rb
Overview
Regional and/or locality tax withholding. Common names to use for regional
withholdings are State, Local, State Unemployment Insurance, Voluntary Plan
Disability Insurance, State Disability Insurance, and Temporary Disability
Insurance. (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.
-
#locality ⇒ String
Name of sub-regional locality such as city, if any.
-
#name ⇒ String
Name of this pay element, earning or deduction, if needed.
-
#percent ⇒ Float
Percentage rate for this regional or local tax withholding, if specified.
-
#region ⇒ String
Name or code of state, province, canton, prefecture or sub-national region.
-
#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:, name:, region:, currency: SKIP, year_to_date: SKIP, locality: SKIP, percent: SKIP, additional_properties: nil) ⇒ RegionalTaxWithholding
constructor
A new instance of RegionalTaxWithholding.
-
#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:, name:, region:, currency: SKIP, year_to_date: SKIP, locality: SKIP, percent: SKIP, additional_properties: nil) ⇒ RegionalTaxWithholding
Returns a new instance of RegionalTaxWithholding.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/fdx_v660_api/models/regional_tax_withholding.rb', line 73 def initialize(amount:, name:, region:, currency: SKIP, year_to_date: SKIP, locality: SKIP, percent: 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 @year_to_date = year_to_date unless year_to_date == SKIP @region = region @locality = locality unless locality == SKIP @percent = percent unless percent == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Float
The monetary amount
18 19 20 |
# File 'lib/fdx_v660_api/models/regional_tax_withholding.rb', line 18 def amount @amount end |
#currency ⇒ Iso4217CurrencyCode7
Currency code of the monetary amount
22 23 24 |
# File 'lib/fdx_v660_api/models/regional_tax_withholding.rb', line 22 def currency @currency end |
#locality ⇒ String
Name of sub-regional locality such as city, if any
39 40 41 |
# File 'lib/fdx_v660_api/models/regional_tax_withholding.rb', line 39 def locality @locality end |
#name ⇒ String
Name of this pay element, earning or deduction, if needed
26 27 28 |
# File 'lib/fdx_v660_api/models/regional_tax_withholding.rb', line 26 def name @name end |
#percent ⇒ Float
Percentage rate for this regional or local tax withholding, if specified
43 44 45 |
# File 'lib/fdx_v660_api/models/regional_tax_withholding.rb', line 43 def percent @percent end |
#region ⇒ String
Name or code of state, province, canton, prefecture or sub-national region
35 36 37 |
# File 'lib/fdx_v660_api/models/regional_tax_withholding.rb', line 35 def region @region end |
#year_to_date ⇒ Float
Year-to-date currency amount for this pay element, earning or deduction, if relevant
31 32 33 |
# File 'lib/fdx_v660_api/models/regional_tax_withholding.rb', line 31 def year_to_date @year_to_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/fdx_v660_api/models/regional_tax_withholding.rb', line 89 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. amount = hash.key?('amount') ? hash['amount'] : nil name = hash.key?('name') ? hash['name'] : nil region = hash.key?('region') ? hash['region'] : nil currency = hash.key?('currency') ? hash['currency'] : SKIP year_to_date = hash.key?('yearToDate') ? hash['yearToDate'] : SKIP locality = hash.key?('locality') ? hash['locality'] : SKIP percent = hash.key?('percent') ? hash['percent'] : 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. RegionalTaxWithholding.new(amount: amount, name: name, region: region, currency: currency, year_to_date: year_to_date, locality: locality, percent: percent, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fdx_v660_api/models/regional_tax_withholding.rb', line 46 def self.names @_hash = {} if @_hash.nil? @_hash['amount'] = 'amount' @_hash['currency'] = 'currency' @_hash['name'] = 'name' @_hash['year_to_date'] = 'yearToDate' @_hash['region'] = 'region' @_hash['locality'] = 'locality' @_hash['percent'] = 'percent' @_hash end |
.nullables ⇒ Object
An array for nullable fields
69 70 71 |
# File 'lib/fdx_v660_api/models/regional_tax_withholding.rb', line 69 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
59 60 61 62 63 64 65 66 |
# File 'lib/fdx_v660_api/models/regional_tax_withholding.rb', line 59 def self.optionals %w[ currency year_to_date locality percent ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
128 129 130 131 132 133 134 |
# File 'lib/fdx_v660_api/models/regional_tax_withholding.rb', line 128 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}, region: #{@region.inspect},"\ " locality: #{@locality.inspect}, percent: #{@percent.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
120 121 122 123 124 125 |
# File 'lib/fdx_v660_api/models/regional_tax_withholding.rb', line 120 def to_s class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount}, currency: #{@currency}, name: #{@name}, year_to_date:"\ " #{@year_to_date}, region: #{@region}, locality: #{@locality}, percent: #{@percent},"\ " additional_properties: #{@additional_properties}>" end |