Class: NewStoreApi::AvalaraConfigUpdateDto

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

Overview

AvalaraConfigUpdateDto 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 = SKIP, company_code = SKIP, default_customer_code = SKIP, environment = SKIP, exemption_classes = SKIP, license_key = SKIP) ⇒ AvalaraConfigUpdateDto

Returns a new instance of AvalaraConfigUpdateDto.



70
71
72
73
74
75
76
77
78
79
# File 'lib/new_store_api/models/avalara_config_update_dto.rb', line 70

def initialize( = SKIP, company_code = SKIP,
               default_customer_code = SKIP, environment = SKIP,
               exemption_classes = SKIP, license_key = SKIP)
  @account_number =  unless  == SKIP
  @company_code = company_code unless company_code == SKIP
  @default_customer_code = default_customer_code unless default_customer_code == SKIP
  @environment = environment unless environment == SKIP
  @exemption_classes = exemption_classes unless exemption_classes == SKIP
  @license_key = license_key unless license_key == SKIP
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_update_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_update_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_update_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_update_dto.rb', line 30

def environment
  @environment
end

#exemption_classesArray[AvalaraExemptionClassItemUpdateDto]

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



35
36
37
# File 'lib/new_store_api/models/avalara_config_update_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_update_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.



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
108
109
110
111
# File 'lib/new_store_api/models/avalara_config_update_dto.rb', line 82

def self.from_hash(hash)
  return nil unless hash

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

  exemption_classes = SKIP unless hash.key?('exemption_classes')
  license_key = hash.key?('license_key') ? hash['license_key'] : SKIP

  # Create object from extracted values.
  AvalaraConfigUpdateDto.new(,
                             company_code,
                             default_customer_code,
                             environment,
                             exemption_classes,
                             license_key)
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_update_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



66
67
68
# File 'lib/new_store_api/models/avalara_config_update_dto.rb', line 66

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
63
# File 'lib/new_store_api/models/avalara_config_update_dto.rb', line 54

def self.optionals
  %w[
    account_number
    company_code
    default_customer_code
    environment
    exemption_classes
    license_key
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



122
123
124
125
126
127
128
# File 'lib/new_store_api/models/avalara_config_update_dto.rb', line 122

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.



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

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