Class: EposNowClient::Configuration
- Inherits:
-
Object
- Object
- EposNowClient::Configuration
- Defined in:
- lib/epos_now_client/configuration.rb
Constant Summary collapse
- DEFAULT_BASE_URL =
'https://api.eposnowhq.com'- DEFAULT_TIMEOUT =
30- DEFAULT_OPEN_TIMEOUT =
10- DEFAULT_MAX_RETRIES =
3- DEFAULT_RETRY_DELAY =
1.0- DEFAULT_PER_PAGE =
200
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
Returns the value of attribute api_secret.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#max_retries ⇒ Object
Returns the value of attribute max_retries.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#per_page ⇒ Object
Returns the value of attribute per_page.
-
#retry_delay ⇒ Object
Returns the value of attribute retry_delay.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
- #auth_token ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/epos_now_client/configuration.rb', line 18 def initialize @api_key = nil @api_secret = nil @base_url = DEFAULT_BASE_URL @timeout = DEFAULT_TIMEOUT @open_timeout = DEFAULT_OPEN_TIMEOUT @max_retries = DEFAULT_MAX_RETRIES @retry_delay = DEFAULT_RETRY_DELAY @per_page = DEFAULT_PER_PAGE @logger = nil end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/epos_now_client/configuration.rb', line 7 def api_key @api_key end |
#api_secret ⇒ Object
Returns the value of attribute api_secret.
7 8 9 |
# File 'lib/epos_now_client/configuration.rb', line 7 def api_secret @api_secret end |
#base_url ⇒ Object
Returns the value of attribute base_url.
9 10 11 |
# File 'lib/epos_now_client/configuration.rb', line 9 def base_url @base_url end |
#logger ⇒ Object
Returns the value of attribute logger.
7 8 9 |
# File 'lib/epos_now_client/configuration.rb', line 7 def logger @logger end |
#max_retries ⇒ Object
Returns the value of attribute max_retries.
7 8 9 |
# File 'lib/epos_now_client/configuration.rb', line 7 def max_retries @max_retries end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
7 8 9 |
# File 'lib/epos_now_client/configuration.rb', line 7 def open_timeout @open_timeout end |
#per_page ⇒ Object
Returns the value of attribute per_page.
7 8 9 |
# File 'lib/epos_now_client/configuration.rb', line 7 def per_page @per_page end |
#retry_delay ⇒ Object
Returns the value of attribute retry_delay.
7 8 9 |
# File 'lib/epos_now_client/configuration.rb', line 7 def retry_delay @retry_delay end |
#timeout ⇒ Object
Returns the value of attribute timeout.
7 8 9 |
# File 'lib/epos_now_client/configuration.rb', line 7 def timeout @timeout end |
Instance Method Details
#auth_token ⇒ Object
30 31 32 33 |
# File 'lib/epos_now_client/configuration.rb', line 30 def auth_token validate! Base64.strict_encode64("#{api_key}:#{api_secret}") end |
#validate! ⇒ Object
35 36 37 38 |
# File 'lib/epos_now_client/configuration.rb', line 35 def validate! raise AuthenticationError, 'API key is required' if api_key.nil? || api_key.empty? raise AuthenticationError, 'API secret is required' if api_secret.nil? || api_secret.empty? end |