Class: Avatax::Configuration
- Inherits:
-
Object
- Object
- Avatax::Configuration
- 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
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#sandbox ⇒ Object
readonly
Returns the value of attribute sandbox.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Configuration
constructor
A new instance of Configuration.
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_url ⇒ Object (readonly)
Returns the value of attribute base_url.
3 4 5 |
# File 'lib/avatax/configuration.rb', line 3 def base_url @base_url end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
3 4 5 |
# File 'lib/avatax/configuration.rb', line 3 def env @env end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
3 4 5 |
# File 'lib/avatax/configuration.rb', line 3 def headers @headers end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
3 4 5 |
# File 'lib/avatax/configuration.rb', line 3 def logger @logger end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
3 4 5 |
# File 'lib/avatax/configuration.rb', line 3 def password @password end |
#sandbox ⇒ Object (readonly)
Returns the value of attribute sandbox.
3 4 5 |
# File 'lib/avatax/configuration.rb', line 3 def sandbox @sandbox end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
3 4 5 |
# File 'lib/avatax/configuration.rb', line 3 def username @username end |