Class: NewStoreApi::StoreConfigUpdateDto
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::StoreConfigUpdateDto
- Defined in:
- lib/new_store_api/models/store_config_update_dto.rb
Overview
StoreConfigUpdateDto Model.
Instance Attribute Summary collapse
-
#avalara ⇒ AvalaraConfigUpdateDto
Avalara configuration.
-
#country_code ⇒ String
Avalara configuration.
-
#custom ⇒ CustomConfigUpdateDto
Custom provider configuration.
-
#fixed_rate ⇒ FixedRateConfigUpdateDto
Fixed rate configuration.
-
#fixed_rate_per_country ⇒ Hash[String, FixedRateConfigCreateDto]
Fixed rate configuration per country.
-
#tax_calculation_strategy ⇒ TaxCalculationStrategyEnum
Fixed rate configuration per country.
-
#vertex ⇒ VertexConfigUpdateDto
Vertex configuration.
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(avalara = SKIP, country_code = SKIP, custom = SKIP, fixed_rate = SKIP, fixed_rate_per_country = SKIP, tax_calculation_strategy = SKIP, vertex = SKIP) ⇒ StoreConfigUpdateDto
constructor
A new instance of StoreConfigUpdateDto.
-
#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(avalara = SKIP, country_code = SKIP, custom = SKIP, fixed_rate = SKIP, fixed_rate_per_country = SKIP, tax_calculation_strategy = SKIP, vertex = SKIP) ⇒ StoreConfigUpdateDto
Returns a new instance of StoreConfigUpdateDto.
117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/new_store_api/models/store_config_update_dto.rb', line 117 def initialize(avalara = SKIP, country_code = SKIP, custom = SKIP, fixed_rate = SKIP, fixed_rate_per_country = SKIP, tax_calculation_strategy = SKIP, vertex = SKIP) @avalara = avalara unless avalara == SKIP @country_code = country_code unless country_code == SKIP @custom = custom unless custom == SKIP @fixed_rate = fixed_rate unless fixed_rate == SKIP @fixed_rate_per_country = fixed_rate_per_country unless fixed_rate_per_country == SKIP @tax_calculation_strategy = tax_calculation_strategy unless tax_calculation_strategy == SKIP @vertex = vertex unless vertex == SKIP end |
Instance Attribute Details
#avalara ⇒ AvalaraConfigUpdateDto
Avalara configuration.
- Required if the
tax_calculation_strategyis set toavalara. - If the tax calculation strategy is set to
avalara, the given configuration will be used. - If the Avalara configuration is defined, the configuration will be validated through a ping request to Avalara, which will validate the authenticity of Avalara credentials.
20 21 22 |
# File 'lib/new_store_api/models/store_config_update_dto.rb', line 20 def avalara @avalara end |
#country_code ⇒ String
Avalara configuration.
- Required if the
tax_calculation_strategyis set toavalara. - If the tax calculation strategy is set to
avalara, the given configuration will be used. - If the Avalara configuration is defined, the configuration will be validated through a ping request to Avalara, which will validate the authenticity of Avalara credentials.
30 31 32 |
# File 'lib/new_store_api/models/store_config_update_dto.rb', line 30 def country_code @country_code end |
#custom ⇒ CustomConfigUpdateDto
Custom provider configuration.
- Required if the
tax_calculation_strategyis set tocustom. - If the tax calculation strategy is set to
custom, the given configuration will be used.
37 38 39 |
# File 'lib/new_store_api/models/store_config_update_dto.rb', line 37 def custom @custom end |
#fixed_rate ⇒ FixedRateConfigUpdateDto
Fixed rate configuration.
- If the tax calculation strategy is set to
fixedrate, the specified tax rate will be used. - For the other tax calculation strategies, the specified rate will be used as a fallback if the tax calculation fails (e.g. if the tax provider is not reachable).
- The specified rate will be used as a fallback by the Associate App in offline-mode.
48 49 50 |
# File 'lib/new_store_api/models/store_config_update_dto.rb', line 48 def fixed_rate @fixed_rate end |
#fixed_rate_per_country ⇒ Hash[String, FixedRateConfigCreateDto]
Fixed rate configuration per country.
- Uses ISO 3166 Alpha-2 format as the key in upper-case.
- Fixed rate specification can be defined under each country key for the desired countries.
- If the tax calculation strategy is set to
fixed_rate_per_country:- Fixed rate configuration must be configured.
- The specified tax rate will be used if the country code of the store has a fixed rate configuration.
- The tax calculation will fail if the country code of the store does not have a fixed rate configuration.
61 62 63 |
# File 'lib/new_store_api/models/store_config_update_dto.rb', line 61 def fixed_rate_per_country @fixed_rate_per_country end |
#tax_calculation_strategy ⇒ TaxCalculationStrategyEnum
Fixed rate configuration per country.
- Uses ISO 3166 Alpha-2 format as the key in upper-case.
- Fixed rate specification can be defined under each country key for the desired countries.
- If the tax calculation strategy is set to
fixed_rate_per_country:- Fixed rate configuration must be configured.
- The specified tax rate will be used if the country code of the store has a fixed rate configuration.
- The tax calculation will fail if the country code of the store does not have a fixed rate configuration.
74 75 76 |
# File 'lib/new_store_api/models/store_config_update_dto.rb', line 74 def tax_calculation_strategy @tax_calculation_strategy end |
#vertex ⇒ VertexConfigUpdateDto
Vertex configuration.
- Required if the
tax_calculation_strategyis set tovertex. - If the tax calculation strategy is set to
vertex, the given configuration will be used. - If the Vertex configuration is defined, the configuration will be validated through a ping request to Vertex, which will validate the authenticity of Vertex credentials.
84 85 86 |
# File 'lib/new_store_api/models/store_config_update_dto.rb', line 84 def vertex @vertex end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/new_store_api/models/store_config_update_dto.rb', line 130 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. avalara = AvalaraConfigUpdateDto.from_hash(hash['avalara']) if hash['avalara'] country_code = hash.key?('country_code') ? hash['country_code'] : SKIP custom = CustomConfigUpdateDto.from_hash(hash['custom']) if hash['custom'] fixed_rate = FixedRateConfigUpdateDto.from_hash(hash['fixed_rate']) if hash['fixed_rate'] fixed_rate_per_country = FixedRateConfigCreateDto.from_hash(hash['fixed_rate_per_country']) if hash['fixed_rate_per_country'] fixed_rate_per_country = SKIP unless hash.key?('fixed_rate_per_country') tax_calculation_strategy = hash.key?('tax_calculation_strategy') ? hash['tax_calculation_strategy'] : SKIP vertex = VertexConfigUpdateDto.from_hash(hash['vertex']) if hash['vertex'] # Create object from extracted values. StoreConfigUpdateDto.new(avalara, country_code, custom, fixed_rate, fixed_rate_per_country, tax_calculation_strategy, vertex) end |
.names ⇒ Object
A mapping from model property names to API property names.
87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/new_store_api/models/store_config_update_dto.rb', line 87 def self.names @_hash = {} if @_hash.nil? @_hash['avalara'] = 'avalara' @_hash['country_code'] = 'country_code' @_hash['custom'] = 'custom' @_hash['fixed_rate'] = 'fixed_rate' @_hash['fixed_rate_per_country'] = 'fixed_rate_per_country' @_hash['tax_calculation_strategy'] = 'tax_calculation_strategy' @_hash['vertex'] = 'vertex' @_hash end |
.nullables ⇒ Object
An array for nullable fields
113 114 115 |
# File 'lib/new_store_api/models/store_config_update_dto.rb', line 113 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/new_store_api/models/store_config_update_dto.rb', line 100 def self.optionals %w[ avalara country_code custom fixed_rate fixed_rate_per_country tax_calculation_strategy vertex ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
165 166 167 168 169 170 171 |
# File 'lib/new_store_api/models/store_config_update_dto.rb', line 165 def inspect class_name = self.class.name.split('::').last "<#{class_name} avalara: #{@avalara.inspect}, country_code: #{@country_code.inspect},"\ " custom: #{@custom.inspect}, fixed_rate: #{@fixed_rate.inspect}, fixed_rate_per_country:"\ " #{@fixed_rate_per_country.inspect}, tax_calculation_strategy:"\ " #{@tax_calculation_strategy.inspect}, vertex: #{@vertex.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
157 158 159 160 161 162 |
# File 'lib/new_store_api/models/store_config_update_dto.rb', line 157 def to_s class_name = self.class.name.split('::').last "<#{class_name} avalara: #{@avalara}, country_code: #{@country_code}, custom: #{@custom},"\ " fixed_rate: #{@fixed_rate}, fixed_rate_per_country: #{@fixed_rate_per_country},"\ " tax_calculation_strategy: #{@tax_calculation_strategy}, vertex: #{@vertex}>" end |