Class: NewStoreApi::VertexConfigDto
- Defined in:
- lib/new_store_api/models/vertex_config_dto.rb
Overview
VertexConfigDto Model.
Instance Attribute Summary collapse
-
#administrative_origin ⇒ VertexAdministrativeOriginDto
Administrative origin information of the legal entity.
-
#company_code ⇒ String
Vertex taxpayer code of the company.
-
#division_code ⇒ String
Vertex taxpayer code of the division.
-
#exemption_classes ⇒ Array[VertexExemptionClassItemDto]
A list of mappings between
ExemptionClassenum and Vertex class codes. -
#flexible_fields ⇒ Array[VertexFlexibleFieldConfigDto]
The mapping between extended attributes of items in the NewStore platform and flexible fields as defined in Vertex.
-
#jurisdiction_in_tax_name_enabled ⇒ TrueClass | FalseClass
Enable appending the jurisdiction name to the tax line's
tax_namefield. -
#login_type ⇒ VertexAuthLoginTypeEnum
Enable appending the jurisdiction name to the tax line's
tax_namefield. -
#password ⇒ String
Password of the Vertex account.
-
#soap_url ⇒ String
SOAP URL of the Vertex CalculateTax endpoint.
-
#trusted_id ⇒ String
Trusted ID of the Vertex account.
-
#use_location_code ⇒ TrueClass | FalseClass
Use Vertex location code instead of address information.
-
#username ⇒ String
Username of the Vertex account.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(company_code = nil, login_type = nil, soap_url = nil, administrative_origin = SKIP, division_code = SKIP, exemption_classes = SKIP, flexible_fields = SKIP, jurisdiction_in_tax_name_enabled = SKIP, password = SKIP, trusted_id = SKIP, use_location_code = false, username = SKIP) ⇒ VertexConfigDto
constructor
A new instance of VertexConfigDto.
-
#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(company_code = nil, login_type = nil, soap_url = nil, administrative_origin = SKIP, division_code = SKIP, exemption_classes = SKIP, flexible_fields = SKIP, jurisdiction_in_tax_name_enabled = SKIP, password = SKIP, trusted_id = SKIP, use_location_code = false, username = SKIP) ⇒ VertexConfigDto
Returns a new instance of VertexConfigDto.
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 127 def initialize(company_code = nil, login_type = nil, soap_url = nil, administrative_origin = SKIP, division_code = SKIP, exemption_classes = SKIP, flexible_fields = SKIP, jurisdiction_in_tax_name_enabled = SKIP, password = SKIP, trusted_id = SKIP, use_location_code = false, username = SKIP) @administrative_origin = administrative_origin unless administrative_origin == SKIP @company_code = company_code @division_code = division_code unless division_code == SKIP @exemption_classes = exemption_classes unless exemption_classes == SKIP @flexible_fields = flexible_fields unless flexible_fields == SKIP unless jurisdiction_in_tax_name_enabled == SKIP @jurisdiction_in_tax_name_enabled = jurisdiction_in_tax_name_enabled end @login_type = login_type @password = password unless password == SKIP @soap_url = soap_url @trusted_id = trusted_id unless trusted_id == SKIP @use_location_code = use_location_code unless use_location_code == SKIP @username = username unless username == SKIP end |
Instance Attribute Details
#administrative_origin ⇒ VertexAdministrativeOriginDto
Administrative origin information of the legal entity. Should be set based on the retailer corporate information.
15 16 17 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 15 def administrative_origin @administrative_origin end |
#company_code ⇒ String
Vertex taxpayer code of the company.
- Identifies the top-level legal entity (company).
- The value should be set to the taxpayer code of the top-level taxpayer (company).
22 23 24 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 22 def company_code @company_code end |
#division_code ⇒ String
Vertex taxpayer code of the division.
- Identifies the mid-level legal entity (division) under a top-level legal entity (company).
- If exists, the value can be set to the taxpayer code of the mid-level taxpayer (division) under a top-level taxpayer (company).
30 31 32 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 30 def division_code @division_code end |
#exemption_classes ⇒ Array[VertexExemptionClassItemDto]
A list of mappings between ExemptionClass enum and Vertex class codes.
34 35 36 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 34 def exemption_classes @exemption_classes end |
#flexible_fields ⇒ Array[VertexFlexibleFieldConfigDto]
The mapping between extended attributes of items in the NewStore platform and flexible fields as defined in Vertex.
39 40 41 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 39 def flexible_fields @flexible_fields end |
#jurisdiction_in_tax_name_enabled ⇒ TrueClass | FalseClass
Enable appending the jurisdiction name to the tax line's tax_name field.
- This can help identify which jurisdiction imposed a given tax line.
- Example: The tax name
Sales And Use Tax - Coloradoincludes the jurisdiction nameColoradowhen the given flag is enabled.
46 47 48 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 46 def jurisdiction_in_tax_name_enabled @jurisdiction_in_tax_name_enabled end |
#login_type ⇒ VertexAuthLoginTypeEnum
Enable appending the jurisdiction name to the tax line's tax_name field.
- This can help identify which jurisdiction imposed a given tax line.
- Example: The tax name
Sales And Use Tax - Coloradoincludes the jurisdiction nameColoradowhen the given flag is enabled.
53 54 55 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 53 def login_type @login_type end |
#password ⇒ String
Password of the Vertex account.
- Required if
login_typeis set touser_and_password.
58 59 60 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 58 def password @password end |
#soap_url ⇒ String
SOAP URL of the Vertex CalculateTax endpoint.
62 63 64 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 62 def soap_url @soap_url end |
#trusted_id ⇒ String
Trusted ID of the Vertex account.
- Required if
login_typeis set totrusted_id.
67 68 69 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 67 def trusted_id @trusted_id end |
#use_location_code ⇒ TrueClass | FalseClass
Use Vertex location code instead of address information.
- When this value is set to
truethe NewStore platform will use the Store IDs to communicate origin and destination addresses instead of using standard address information (address line 1, postal code, etc.). - Store IDs are currently only available for cash & carry orders, all
other order scenarios will use the standard address information to
communicate origin and destination addresses even with this value set to
true. - In case the NewStore Store ID length is longer than 20 characters, NewStore will only send the first 20 characters as Vertex field length is capped at that limit.
81 82 83 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 81 def use_location_code @use_location_code end |
#username ⇒ String
Username of the Vertex account.
- Required if
login_typeis set touser_and_password.
86 87 88 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 86 def username @username end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 151 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. company_code = hash.key?('company_code') ? hash['company_code'] : nil login_type = hash.key?('login_type') ? hash['login_type'] : nil soap_url = hash.key?('soap_url') ? hash['soap_url'] : nil if hash['administrative_origin'] administrative_origin = VertexAdministrativeOriginDto.from_hash(hash['administrative_origin']) end division_code = hash.key?('division_code') ? hash['division_code'] : SKIP # Parameter is an array, so we need to iterate through it exemption_classes = nil unless hash['exemption_classes'].nil? exemption_classes = [] hash['exemption_classes'].each do |structure| exemption_classes << (VertexExemptionClassItemDto.from_hash(structure) if structure) end end exemption_classes = SKIP unless hash.key?('exemption_classes') # Parameter is an array, so we need to iterate through it flexible_fields = nil unless hash['flexible_fields'].nil? flexible_fields = [] hash['flexible_fields'].each do |structure| flexible_fields << (VertexFlexibleFieldConfigDto.from_hash(structure) if structure) end end flexible_fields = SKIP unless hash.key?('flexible_fields') jurisdiction_in_tax_name_enabled = hash.key?('jurisdiction_in_tax_name_enabled') ? hash['jurisdiction_in_tax_name_enabled'] : SKIP password = hash.key?('password') ? hash['password'] : SKIP trusted_id = hash.key?('trusted_id') ? hash['trusted_id'] : SKIP use_location_code = hash['use_location_code'] ||= false username = hash.key?('username') ? hash['username'] : SKIP # Create object from extracted values. VertexConfigDto.new(company_code, login_type, soap_url, administrative_origin, division_code, exemption_classes, flexible_fields, jurisdiction_in_tax_name_enabled, password, trusted_id, use_location_code, username) end |
.names ⇒ Object
A mapping from model property names to API property names.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 89 def self.names @_hash = {} if @_hash.nil? @_hash['administrative_origin'] = 'administrative_origin' @_hash['company_code'] = 'company_code' @_hash['division_code'] = 'division_code' @_hash['exemption_classes'] = 'exemption_classes' @_hash['flexible_fields'] = 'flexible_fields' @_hash['jurisdiction_in_tax_name_enabled'] = 'jurisdiction_in_tax_name_enabled' @_hash['login_type'] = 'login_type' @_hash['password'] = 'password' @_hash['soap_url'] = 'soap_url' @_hash['trusted_id'] = 'trusted_id' @_hash['use_location_code'] = 'use_location_code' @_hash['username'] = 'username' @_hash end |
.nullables ⇒ Object
An array for nullable fields
123 124 125 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 123 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 108 def self.optionals %w[ administrative_origin division_code exemption_classes flexible_fields jurisdiction_in_tax_name_enabled password trusted_id use_location_code username ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 206 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.company_code, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.login_type, ->(val) { VertexAuthLoginTypeEnum.validate(val) }) and APIHelper.valid_type?(value.soap_url, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['company_code'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['login_type'], ->(val) { VertexAuthLoginTypeEnum.validate(val) }) and APIHelper.valid_type?(value['soap_url'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
242 243 244 245 246 247 248 249 250 251 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 242 def inspect class_name = self.class.name.split('::').last "<#{class_name} administrative_origin: #{@administrative_origin.inspect}, company_code:"\ " #{@company_code.inspect}, division_code: #{@division_code.inspect}, exemption_classes:"\ " #{@exemption_classes.inspect}, flexible_fields: #{@flexible_fields.inspect},"\ " jurisdiction_in_tax_name_enabled: #{@jurisdiction_in_tax_name_enabled.inspect},"\ " login_type: #{@login_type.inspect}, password: #{@password.inspect}, soap_url:"\ " #{@soap_url.inspect}, trusted_id: #{@trusted_id.inspect}, use_location_code:"\ " #{@use_location_code.inspect}, username: #{@username.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
231 232 233 234 235 236 237 238 239 |
# File 'lib/new_store_api/models/vertex_config_dto.rb', line 231 def to_s class_name = self.class.name.split('::').last "<#{class_name} administrative_origin: #{@administrative_origin}, company_code:"\ " #{@company_code}, division_code: #{@division_code}, exemption_classes:"\ " #{@exemption_classes}, flexible_fields: #{@flexible_fields},"\ " jurisdiction_in_tax_name_enabled: #{@jurisdiction_in_tax_name_enabled}, login_type:"\ " #{@login_type}, password: #{@password}, soap_url: #{@soap_url}, trusted_id:"\ " #{@trusted_id}, use_location_code: #{@use_location_code}, username: #{@username}>" end |