Class: NewStoreApi::CustomConfigUpdateDto

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

Overview

CustomConfigUpdateDto 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(additional_config = SKIP, api_version = SKIP, authentication = SKIP, base_url = SKIP, exemption_classes = SKIP) ⇒ CustomConfigUpdateDto

Returns a new instance of CustomConfigUpdateDto.



66
67
68
69
70
71
72
73
74
# File 'lib/new_store_api/models/custom_config_update_dto.rb', line 66

def initialize(additional_config = SKIP, api_version = SKIP,
               authentication = SKIP, base_url = SKIP,
               exemption_classes = SKIP)
  @additional_config = additional_config unless additional_config == SKIP
  @api_version = api_version unless api_version == SKIP
  @authentication = authentication unless authentication == SKIP
  @base_url = base_url unless base_url == SKIP
  @exemption_classes = exemption_classes unless exemption_classes == SKIP
end

Instance Attribute Details

#additional_configCustomConfigAdditionalUpdateDto

Other necessary configuration specific to the custom provider (currently configs for non-officially supported avalara based custom implementation)



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

def additional_config
  @additional_config
end

#api_versionCustomApiVersionEnum

Other necessary configuration specific to the custom provider (currently configs for non-officially supported avalara based custom implementation)



20
21
22
# File 'lib/new_store_api/models/custom_config_update_dto.rb', line 20

def api_version
  @api_version
end

#authenticationCustomConfigAuthenticationDto

Other necessary configuration specific to the custom provider (currently configs for non-officially supported avalara based custom implementation)



25
26
27
# File 'lib/new_store_api/models/custom_config_update_dto.rb', line 25

def authentication
  @authentication
end

#base_urlString

The base URL for the custom taxes RESTful API. The value should include the route prefix to the quotation API.

  • Required if the api_version is set to v1.
  • If the tax calculation strategy is set to custom and api_version is set to v1, the given configuration will be used.

Returns:

  • (String)


33
34
35
# File 'lib/new_store_api/models/custom_config_update_dto.rb', line 33

def base_url
  @base_url
end

#exemption_classesArray[ExemptionClassItemUpdateDto]

A list of supported exemption classes.

Returns:



37
38
39
# File 'lib/new_store_api/models/custom_config_update_dto.rb', line 37

def exemption_classes
  @exemption_classes
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



77
78
79
80
81
82
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/custom_config_update_dto.rb', line 77

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  additional_config = CustomConfigAdditionalUpdateDto.from_hash(hash['additional_config']) if
    hash['additional_config']
  api_version = hash.key?('api_version') ? hash['api_version'] : SKIP
  authentication = CustomConfigAuthenticationDto.from_hash(hash['authentication']) if
    hash['authentication']
  base_url = hash.key?('base_url') ? hash['base_url'] : 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 << (ExemptionClassItemUpdateDto.from_hash(structure) if structure)
    end
  end

  exemption_classes = SKIP unless hash.key?('exemption_classes')

  # Create object from extracted values.
  CustomConfigUpdateDto.new(additional_config,
                            api_version,
                            authentication,
                            base_url,
                            exemption_classes)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
# File 'lib/new_store_api/models/custom_config_update_dto.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['additional_config'] = 'additional_config'
  @_hash['api_version'] = 'api_version'
  @_hash['authentication'] = 'authentication'
  @_hash['base_url'] = 'base_url'
  @_hash['exemption_classes'] = 'exemption_classes'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/new_store_api/models/custom_config_update_dto.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
57
58
59
# File 'lib/new_store_api/models/custom_config_update_dto.rb', line 51

def self.optionals
  %w[
    additional_config
    api_version
    authentication
    base_url
    exemption_classes
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} additional_config: #{@additional_config.inspect}, api_version:"\
  " #{@api_version.inspect}, authentication: #{@authentication.inspect}, base_url:"\
  " #{@base_url.inspect}, exemption_classes: #{@exemption_classes.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/custom_config_update_dto.rb', line 107

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} additional_config: #{@additional_config}, api_version: #{@api_version},"\
  " authentication: #{@authentication}, base_url: #{@base_url}, exemption_classes:"\
  " #{@exemption_classes}>"
end