Class: NewStoreApi::CustomV0AvalaraConfigDto

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

Overview

CustomV0AvalaraConfigDto 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, license_key = nil, url = nil) ⇒ CustomV0AvalaraConfigDto

Returns a new instance of CustomV0AvalaraConfigDto.



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

def initialize( = nil, company_code = nil, license_key = nil,
               url = nil)
  @account_number = 
  @company_code = company_code
  @license_key = license_key
  @url = url
end

Instance Attribute Details

#account_numberString

AvaTax account number or account ID.

Returns:

  • (String)


14
15
16
# File 'lib/new_store_api/models/custom_v0_avalara_config_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/custom_v0_avalara_config_dto.rb', line 20

def company_code
  @company_code
end

#license_keyString

AvaTax license key.

Returns:

  • (String)


24
25
26
# File 'lib/new_store_api/models/custom_v0_avalara_config_dto.rb', line 24

def license_key
  @license_key
end

#urlString

Custom provider RESTful API URL that uses AvaTax v1 schema. Will be used for tax calculations.

Returns:

  • (String)


29
30
31
# File 'lib/new_store_api/models/custom_v0_avalara_config_dto.rb', line 29

def url
  @url
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/new_store_api/models/custom_v0_avalara_config_dto.rb', line 60

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
  license_key = hash.key?('license_key') ? hash['license_key'] : nil
  url = hash.key?('url') ? hash['url'] : nil

  # Create object from extracted values.
  CustomV0AvalaraConfigDto.new(,
                               company_code,
                               license_key,
                               url)
end

.namesObject

A mapping from model property names to API property names.



32
33
34
35
36
37
38
39
# File 'lib/new_store_api/models/custom_v0_avalara_config_dto.rb', line 32

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

.nullablesObject

An array for nullable fields



47
48
49
# File 'lib/new_store_api/models/custom_v0_avalara_config_dto.rb', line 47

def self.nullables
  []
end

.optionalsObject

An array for optional fields



42
43
44
# File 'lib/new_store_api/models/custom_v0_avalara_config_dto.rb', line 42

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



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
# File 'lib/new_store_api/models/custom_v0_avalara_config_dto.rb', line 79

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.company_code,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.license_key,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.url,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['account_number'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['company_code'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['license_key'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['url'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



108
109
110
111
112
# File 'lib/new_store_api/models/custom_v0_avalara_config_dto.rb', line 108

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