Class: NewStoreApi::StoreConfigCreateDto
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::StoreConfigCreateDto
- Defined in:
- lib/new_store_api/models/store_config_create_dto.rb
Overview
StoreConfigCreateDto Model.
Instance Attribute Summary collapse
-
#avalara ⇒ AvalaraConfigCreateDto
Avalara configuration.
-
#country_code ⇒ String
Avalara configuration.
-
#custom ⇒ CustomConfigCreateDto
Custom provider configuration.
-
#fixed_rate ⇒ FixedRateConfigCreateDto
Fixed rate configuration.
-
#fixed_rate_per_country ⇒ Hash[String, FixedRateConfigCreateDto]
Fixed rate configuration per country.
-
#store_id ⇒ String
Store identifier within the NewStore platform.
-
#tax_calculation_strategy ⇒ TaxCalculationStrategyEnum
Store identifier within the NewStore platform.
-
#vertex ⇒ VertexConfigCreateDto
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(country_code = nil, store_id = nil, avalara = SKIP, custom = SKIP, fixed_rate = SKIP, fixed_rate_per_country = SKIP, tax_calculation_strategy = SKIP, vertex = SKIP) ⇒ StoreConfigCreateDto
constructor
A new instance of StoreConfigCreateDto.
-
#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(country_code = nil, store_id = nil, avalara = SKIP, custom = SKIP, fixed_rate = SKIP, fixed_rate_per_country = SKIP, tax_calculation_strategy = SKIP, vertex = SKIP) ⇒ StoreConfigCreateDto
Returns a new instance of StoreConfigCreateDto.
112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/new_store_api/models/store_config_create_dto.rb', line 112 def initialize(country_code = nil, store_id = nil, avalara = 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 @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 @store_id = store_id @tax_calculation_strategy = tax_calculation_strategy unless tax_calculation_strategy == SKIP @vertex = vertex unless vertex == SKIP end |
Instance Attribute Details
#avalara ⇒ AvalaraConfigCreateDto
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_create_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_create_dto.rb', line 30 def country_code @country_code end |
#custom ⇒ CustomConfigCreateDto
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_create_dto.rb', line 37 def custom @custom end |
#fixed_rate ⇒ FixedRateConfigCreateDto
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_create_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_create_dto.rb', line 61 def fixed_rate_per_country @fixed_rate_per_country end |
#store_id ⇒ String
Store identifier within the NewStore platform.
65 66 67 |
# File 'lib/new_store_api/models/store_config_create_dto.rb', line 65 def store_id @store_id end |
#tax_calculation_strategy ⇒ TaxCalculationStrategyEnum
Store identifier within the NewStore platform.
69 70 71 |
# File 'lib/new_store_api/models/store_config_create_dto.rb', line 69 def tax_calculation_strategy @tax_calculation_strategy end |
#vertex ⇒ VertexConfigCreateDto
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.
79 80 81 |
# File 'lib/new_store_api/models/store_config_create_dto.rb', line 79 def vertex @vertex end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/new_store_api/models/store_config_create_dto.rb', line 127 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. country_code = hash.key?('country_code') ? hash['country_code'] : nil store_id = hash.key?('store_id') ? hash['store_id'] : nil avalara = AvalaraConfigCreateDto.from_hash(hash['avalara']) if hash['avalara'] custom = CustomConfigCreateDto.from_hash(hash['custom']) if hash['custom'] fixed_rate = FixedRateConfigCreateDto.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 = VertexConfigCreateDto.from_hash(hash['vertex']) if hash['vertex'] # Create object from extracted values. StoreConfigCreateDto.new(country_code, store_id, avalara, custom, fixed_rate, fixed_rate_per_country, tax_calculation_strategy, vertex) end |
.names ⇒ Object
A mapping from model property names to API property names.
82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/new_store_api/models/store_config_create_dto.rb', line 82 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['store_id'] = 'store_id' @_hash['tax_calculation_strategy'] = 'tax_calculation_strategy' @_hash['vertex'] = 'vertex' @_hash end |
.nullables ⇒ Object
An array for nullable fields
108 109 110 |
# File 'lib/new_store_api/models/store_config_create_dto.rb', line 108 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
96 97 98 99 100 101 102 103 104 105 |
# File 'lib/new_store_api/models/store_config_create_dto.rb', line 96 def self.optionals %w[ avalara 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.
164 165 166 167 168 169 170 171 |
# File 'lib/new_store_api/models/store_config_create_dto.rb', line 164 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}, store_id: #{@store_id.inspect},"\ " tax_calculation_strategy: #{@tax_calculation_strategy.inspect}, vertex:"\ " #{@vertex.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
156 157 158 159 160 161 |
# File 'lib/new_store_api/models/store_config_create_dto.rb', line 156 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}, store_id:"\ " #{@store_id}, tax_calculation_strategy: #{@tax_calculation_strategy}, vertex: #{@vertex}>" end |