Class: NewStoreApi::AvalaraConfigCreateDto

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

Overview

AvalaraConfigCreateDto 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(account_number = nil, company_code = nil, environment = nil, license_key = nil, default_customer_code = SKIP, exemption_classes = SKIP) ⇒ AvalaraConfigCreateDto

Returns a new instance of AvalaraConfigCreateDto.



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

def initialize( = nil, company_code = nil, environment = nil,
               license_key = nil, default_customer_code = SKIP,
               exemption_classes = SKIP)
  @account_number = 
  @company_code = company_code
  @default_customer_code = default_customer_code unless default_customer_code == SKIP
  @environment = environment
  @exemption_classes = exemption_classes unless exemption_classes == SKIP
  @license_key = license_key
end

Instance Attribute Details

#account_numberString

AvaTax account number or account ID.

Returns:

  • (String)


14
15
16
# File 'lib/new_store_api/models/avalara_config_create_dto.rb', line 14

def 
  @account_number
end

#company_codeString

Company code that identifies the company in the AvaTax account.

  • Value is case-sensitive.
  • Declared during the company setup in the AvaTax Admin Console.

Returns:

  • (String)


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

def company_code
  @company_code
end

#default_customer_codeString

Default customer code. Will be used in case when no ConsumerUUID is provided.

Returns:

  • (String)


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

def default_customer_code
  @default_customer_code
end

#environmentAvalaraEnvEnum

Default customer code. Will be used in case when no ConsumerUUID is provided.

Returns:



30
31
32
# File 'lib/new_store_api/models/avalara_config_create_dto.rb', line 30

def environment
  @environment
end

#exemption_classesArray[AvalaraExemptionClassItemCreateDto]

A list of mappings between ExemptionClass enum and Avalara custom entity use codes.



35
36
37
# File 'lib/new_store_api/models/avalara_config_create_dto.rb', line 35

def exemption_classes
  @exemption_classes
end

#license_keyString

AvaTax license key.

Returns:

  • (String)


39
40
41
# File 'lib/new_store_api/models/avalara_config_create_dto.rb', line 39

def license_key
  @license_key
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
105
106
107
# File 'lib/new_store_api/models/avalara_config_create_dto.rb', line 78

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   =
    hash.key?('account_number') ? hash['account_number'] : nil
  company_code = hash.key?('company_code') ? hash['company_code'] : nil
  environment = hash.key?('environment') ? hash['environment'] : nil
  license_key = hash.key?('license_key') ? hash['license_key'] : nil
  default_customer_code =
    hash.key?('default_customer_code') ? hash['default_customer_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 << (AvalaraExemptionClassItemCreateDto.from_hash(structure) if structure)
    end
  end

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

  # Create object from extracted values.
  AvalaraConfigCreateDto.new(,
                             company_code,
                             environment,
                             license_key,
                             default_customer_code,
                             exemption_classes)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
51
# File 'lib/new_store_api/models/avalara_config_create_dto.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_number'] = 'account_number'
  @_hash['company_code'] = 'company_code'
  @_hash['default_customer_code'] = 'default_customer_code'
  @_hash['environment'] = 'environment'
  @_hash['exemption_classes'] = 'exemption_classes'
  @_hash['license_key'] = 'license_key'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
# File 'lib/new_store_api/models/avalara_config_create_dto.rb', line 54

def self.optionals
  %w[
    default_customer_code
    exemption_classes
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



118
119
120
121
122
123
124
# File 'lib/new_store_api/models/avalara_config_create_dto.rb', line 118

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_number: #{@account_number.inspect}, company_code:"\
  " #{@company_code.inspect}, default_customer_code: #{@default_customer_code.inspect},"\
  " environment: #{@environment.inspect}, exemption_classes: #{@exemption_classes.inspect},"\
  " license_key: #{@license_key.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



110
111
112
113
114
115
# File 'lib/new_store_api/models/avalara_config_create_dto.rb', line 110

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_number: #{@account_number}, company_code: #{@company_code},"\
  " default_customer_code: #{@default_customer_code}, environment: #{@environment},"\
  " exemption_classes: #{@exemption_classes}, license_key: #{@license_key}>"
end