Class: NewStoreApi::EnrichedQuotationTaxRateDto

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb

Overview

EnrichedQuotationTaxRateDto Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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) ⇒ EnrichedQuotationTaxRateDto

Returns a new instance of EnrichedQuotationTaxRateDto.



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb', line 70

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

#amountInteger

Monetary tax amount for the unit price corresponding to this tax_rate item's percent value, in the currency's minor unit.

Returns:

  • (Integer)


15
16
17
# File 'lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb', line 15

def amount
  @amount
end

#country_codeString

Country of jurisdiction for the applied tax.

Returns:

  • (String)


19
20
21
# File 'lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb', line 19

def country_code
  @country_code
end

#exempt_amountInteger

The item net amount which has been tax exempt, in the currency's minor unit.

Returns:

  • (Integer)


24
25
26
# File 'lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb', line 24

def exempt_amount
  @exempt_amount
end

#rateFloat

Tax percent value for this tax rate item, e.g. 0.19 means 19% tax.

Returns:

  • (Float)


28
29
30
# File 'lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb', line 28

def rate
  @rate
end

#tax_nameString

Name of the applied tax.

Returns:

  • (String)


32
33
34
# File 'lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb', line 32

def tax_name
  @tax_name
end

#tax_statusTaxStatusEnum

Name of the applied tax.

Returns:



36
37
38
# File 'lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb', line 36

def tax_status
  @tax_status
end

#taxable_amountInteger

The taxable item net amount on which the tax is chargeable, in the currency's minor unit.

Returns:

  • (Integer)


41
42
43
# File 'lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb', line 41

def taxable_amount
  @taxable_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb', line 83

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.
  EnrichedQuotationTaxRateDto.new(amount,
                                  country_code,
                                  rate,
                                  tax_name,
                                  exempt_amount,
                                  tax_status,
                                  taxable_amount)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb', line 44

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

.nullablesObject

An array for nullable fields



66
67
68
# File 'lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb', line 66

def self.nullables
  []
end

.optionalsObject

An array for optional fields



57
58
59
60
61
62
63
# File 'lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb', line 57

def self.optionals
  %w[
    exempt_amount
    tax_status
    taxable_amount
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



115
116
117
118
119
120
121
# File 'lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb', line 115

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_sObject

Provides a human-readable string representation of the object.



107
108
109
110
111
112
# File 'lib/new_store_api/models/enriched_quotation_tax_rate_dto.rb', line 107

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