Module: AvaTax::Configuration
- Included in:
- AvaTax
- Defined in:
- lib/avatax/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :app_name, :app_version, :machine_name, :environment, :endpoint, :user_agent, :username, :password, :connection_options, :logger, :custom_logger, :custom_logger_options, :proxy, :faraday_response, :response_big_decimal_conversion ].freeze
- DEFAULT_APP_NAME =
nil- DEFAULT_APP_VERSION =
nil- DEFAULT_MACHINE_NAME =
nil- DEFAULT_ENDPOINT =
'https://rest.avatax.com'- DEFAULT_USER_AGENT =
"AvaTax Ruby Gem #{AvaTax::VERSION}".freeze
- DEFAULT_USERNAME =
nil- DEFAULT_PASSWORD =
nil- DEFAULT_CONNECTION_OPTIONS =
timeout in seconds
{request: {timeout: 1200}}
- DEFAULT_LOGGER =
false- DEFAULT_CUSTOM_LOGGER =
nil- DEFAULT_CUSTOM_LOGGER_OPTIONS =
{}
- DEFAULT_PROXY =
nil- DEFAULT_FARADAY_RESPONSE =
false- DEFAULT_RESPONSE_BIG_DECIMAL_CONVERSION =
false
Class Method Summary collapse
-
.extended(base) ⇒ Object
Reset config values when extended.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Allow configuration options to be set in a block.
- #options ⇒ Object
- #reset ⇒ Object
Class Method Details
.extended(base) ⇒ Object
Reset config values when extended
43 44 45 |
# File 'lib/avatax/configuration.rb', line 43 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Allow configuration options to be set in a block
48 49 50 |
# File 'lib/avatax/configuration.rb', line 48 def configure yield self end |
#options ⇒ Object
52 53 54 55 56 |
# File 'lib/avatax/configuration.rb', line 52 def VALID_OPTIONS_KEYS.inject({}) do |option, key| option.merge!(key => send(key)) end end |
#reset ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/avatax/configuration.rb', line 58 def reset self.app_name = DEFAULT_APP_NAME self.app_version = DEFAULT_APP_VERSION self.machine_name = DEFAULT_MACHINE_NAME self.endpoint = DEFAULT_ENDPOINT self.user_agent = DEFAULT_USER_AGENT self.username = DEFAULT_USERNAME self.password = DEFAULT_PASSWORD self. = DEFAULT_CONNECTION_OPTIONS self.logger = DEFAULT_LOGGER self.custom_logger = DEFAULT_CUSTOM_LOGGER self. = DEFAULT_CUSTOM_LOGGER_OPTIONS self.proxy = DEFAULT_PROXY self.faraday_response = DEFAULT_FARADAY_RESPONSE self.response_big_decimal_conversion = DEFAULT_RESPONSE_BIG_DECIMAL_CONVERSION end |