Class: LDA::Configuration
- Inherits:
-
Object
- Object
- LDA::Configuration
- Defined in:
- lib/lda_gov/configuration.rb
Constant Summary collapse
- DEFAULT_BASE_URL =
'https://lda.gov/api/v1/'- DEFAULT_TIMEOUT =
30- DEFAULT_RETRIES =
3- DEFAULT_MAX_PAGES =
1000
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#max_pages ⇒ Object
Returns the value of attribute max_pages.
-
#retries ⇒ Object
Returns the value of attribute retries.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #inspect ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 17 18 19 20 |
# File 'lib/lda_gov/configuration.rb', line 12 def initialize @base_url = DEFAULT_BASE_URL @timeout = DEFAULT_TIMEOUT @retries = DEFAULT_RETRIES @max_pages = DEFAULT_MAX_PAGES @logger = nil @adapter = Faraday.default_adapter @api_key = ENV.fetch('LDA_API_KEY', nil) end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
10 11 12 |
# File 'lib/lda_gov/configuration.rb', line 10 def adapter @adapter end |
#api_key ⇒ Object
Returns the value of attribute api_key.
10 11 12 |
# File 'lib/lda_gov/configuration.rb', line 10 def api_key @api_key end |
#base_url ⇒ Object
Returns the value of attribute base_url.
10 11 12 |
# File 'lib/lda_gov/configuration.rb', line 10 def base_url @base_url end |
#logger ⇒ Object
Returns the value of attribute logger.
10 11 12 |
# File 'lib/lda_gov/configuration.rb', line 10 def logger @logger end |
#max_pages ⇒ Object
Returns the value of attribute max_pages.
10 11 12 |
# File 'lib/lda_gov/configuration.rb', line 10 def max_pages @max_pages end |
#retries ⇒ Object
Returns the value of attribute retries.
10 11 12 |
# File 'lib/lda_gov/configuration.rb', line 10 def retries @retries end |
#timeout ⇒ Object
Returns the value of attribute timeout.
10 11 12 |
# File 'lib/lda_gov/configuration.rb', line 10 def timeout @timeout end |
Instance Method Details
#inspect ⇒ Object
34 35 36 |
# File 'lib/lda_gov/configuration.rb', line 34 def inspect "#<#{self.class} base_url=#{base_url.inspect} timeout=#{timeout} retries=#{retries}>" end |
#to_h ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/lda_gov/configuration.rb', line 22 def to_h { base_url: base_url, timeout: timeout, retries: retries, max_pages: max_pages, logger: logger, adapter: adapter, api_key: api_key } end |