Class: Avatax::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/avatax/configuration.rb

Constant Summary collapse

REST_URLS =
{
  sandbox:    'https://sandbox-rest.avatax.com',
  production: 'https://rest.avatax.com'
}
SANDBOX =
:sandbox
PRODUCTION =
:production

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Configuration

Returns a new instance of Configuration.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/avatax/configuration.rb', line 14

def initialize(args = {})
  validate_args(args)

  @env = args[:env].to_sym
  @sandbox = @env == SANDBOX
  @base_url = REST_URLS[env]

  @headers = args[:headers] || {}

  @username = args[:username]
  @password = args[:password]

  @logger = args[:logger] || Logger.new(STDOUT)
end

Instance Attribute Details

#base_urlObject (readonly)

Returns the value of attribute base_url.



3
4
5
# File 'lib/avatax/configuration.rb', line 3

def base_url
  @base_url
end

#envObject (readonly)

Returns the value of attribute env.



3
4
5
# File 'lib/avatax/configuration.rb', line 3

def env
  @env
end

#headersObject (readonly)

Returns the value of attribute headers.



3
4
5
# File 'lib/avatax/configuration.rb', line 3

def headers
  @headers
end

#loggerObject (readonly)

Returns the value of attribute logger.



3
4
5
# File 'lib/avatax/configuration.rb', line 3

def logger
  @logger
end

#passwordObject (readonly)

Returns the value of attribute password.



3
4
5
# File 'lib/avatax/configuration.rb', line 3

def password
  @password
end

#sandboxObject (readonly)

Returns the value of attribute sandbox.



3
4
5
# File 'lib/avatax/configuration.rb', line 3

def sandbox
  @sandbox
end

#usernameObject (readonly)

Returns the value of attribute username.



3
4
5
# File 'lib/avatax/configuration.rb', line 3

def username
  @username
end