Class: NewStoreApi::TaxRateDto
- Defined in:
- lib/new_store_api/models/tax_rate_dto.rb
Overview
TaxRateDto Model.
Instance Attribute Summary collapse
-
#amount ⇒ Float
Monetary tax amount for the unit price corresponding to this tax_rate item's percent value, e.g.
-
#country_code ⇒ String
Country of jurisdiction for the applied tax.
-
#exempt_amount ⇒ Float
The item net amount which has been tax exempt.
-
#rate ⇒ Float
Tax percent value for this tax rate item, e.g.
-
#tax_name ⇒ String
Name of the applied tax.
-
#tax_status ⇒ TaxStatusEnum
Name of the applied tax.
-
#taxable_amount ⇒ Float
The taxable item net amount on which the tax is chargeable.
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 = nil, country_code = nil, rate = nil, tax_name = nil, exempt_amount = SKIP, tax_status = SKIP, taxable_amount = SKIP) ⇒ TaxRateDto
constructor
A new instance of TaxRateDto.
-
#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 = nil, country_code = nil, rate = nil, tax_name = nil, exempt_amount = SKIP, tax_status = SKIP, taxable_amount = SKIP) ⇒ TaxRateDto
Returns a new instance of TaxRateDto.
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/new_store_api/models/tax_rate_dto.rb', line 68 def initialize(amount = nil, country_code = nil, rate = nil, tax_name = nil, exempt_amount = SKIP, tax_status = SKIP, taxable_amount = SKIP) @amount = amount @country_code = country_code @exempt_amount = exempt_amount unless exempt_amount == SKIP @rate = rate @tax_name = tax_name @tax_status = tax_status unless tax_status == SKIP @taxable_amount = taxable_amount unless taxable_amount == SKIP end |
Instance Attribute Details
#amount ⇒ Float
Monetary tax amount for the unit price corresponding to this tax_rate item's percent value, e.g. 3.37.
15 16 17 |
# File 'lib/new_store_api/models/tax_rate_dto.rb', line 15 def amount @amount end |
#country_code ⇒ String
Country of jurisdiction for the applied tax.
19 20 21 |
# File 'lib/new_store_api/models/tax_rate_dto.rb', line 19 def country_code @country_code end |
#exempt_amount ⇒ Float
The item net amount which has been tax exempt.
23 24 25 |
# File 'lib/new_store_api/models/tax_rate_dto.rb', line 23 def exempt_amount @exempt_amount end |
#rate ⇒ Float
Tax percent value for this tax rate item, e.g. 0.19 means 19% tax.
27 28 29 |
# File 'lib/new_store_api/models/tax_rate_dto.rb', line 27 def rate @rate end |
#tax_name ⇒ String
Name of the applied tax.
31 32 33 |
# File 'lib/new_store_api/models/tax_rate_dto.rb', line 31 def tax_name @tax_name end |
#tax_status ⇒ TaxStatusEnum
Name of the applied tax.
35 36 37 |
# File 'lib/new_store_api/models/tax_rate_dto.rb', line 35 def tax_status @tax_status end |
#taxable_amount ⇒ Float
The taxable item net amount on which the tax is chargeable.
39 40 41 |
# File 'lib/new_store_api/models/tax_rate_dto.rb', line 39 def taxable_amount @taxable_amount end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/new_store_api/models/tax_rate_dto.rb', line 81 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. amount = hash.key?('amount') ? hash['amount'] : nil country_code = hash.key?('country_code') ? hash['country_code'] : nil rate = hash.key?('rate') ? hash['rate'] : nil tax_name = hash.key?('tax_name') ? hash['tax_name'] : nil exempt_amount = hash.key?('exempt_amount') ? hash['exempt_amount'] : SKIP tax_status = hash.key?('tax_status') ? hash['tax_status'] : SKIP taxable_amount = hash.key?('taxable_amount') ? hash['taxable_amount'] : SKIP # Create object from extracted values. TaxRateDto.new(amount, country_code, rate, tax_name, exempt_amount, tax_status, taxable_amount) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/new_store_api/models/tax_rate_dto.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['amount'] = 'amount' @_hash['country_code'] = 'country_code' @_hash['exempt_amount'] = 'exempt_amount' @_hash['rate'] = 'rate' @_hash['tax_name'] = 'tax_name' @_hash['tax_status'] = 'tax_status' @_hash['taxable_amount'] = 'taxable_amount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
64 65 66 |
# File 'lib/new_store_api/models/tax_rate_dto.rb', line 64 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
55 56 57 58 59 60 61 |
# File 'lib/new_store_api/models/tax_rate_dto.rb', line 55 def self.optionals %w[ exempt_amount tax_status taxable_amount ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
113 114 115 116 117 118 119 |
# File 'lib/new_store_api/models/tax_rate_dto.rb', line 113 def inspect class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount.inspect}, country_code: #{@country_code.inspect},"\ " exempt_amount: #{@exempt_amount.inspect}, rate: #{@rate.inspect}, tax_name:"\ " #{@tax_name.inspect}, tax_status: #{@tax_status.inspect}, taxable_amount:"\ " #{@taxable_amount.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
105 106 107 108 109 110 |
# File 'lib/new_store_api/models/tax_rate_dto.rb', line 105 def to_s class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount}, country_code: #{@country_code}, exempt_amount:"\ " #{@exempt_amount}, rate: #{@rate}, tax_name: #{@tax_name}, tax_status: #{@tax_status},"\ " taxable_amount: #{@taxable_amount}>" end |