Module: Foederati
- Defined in:
- lib/foederati.rb,
lib/foederati/engine.rb,
lib/foederati/version.rb,
lib/foederati/provider.rb,
lib/foederati/providers.rb,
lib/foederati/provider/request.rb,
lib/foederati/provider/response.rb,
lib/foederati/faraday_middleware.rb
Overview
TODO add logger
Defined Under Namespace
Modules: FaradayMiddleware Classes: Defaults, Engine, Provider, Providers
Constant Summary collapse
- VERSION =
'0.1.0'
Class Method Summary collapse
- .api_keys ⇒ Object
- .configure(&block) ⇒ Object
-
.connection ⇒ Faraday::Connection
‘Faraday` connection for executing HTTP requests.
- .defaults ⇒ Object
-
.search(*ids, **params) ⇒ Hash
Search registered providers.
Class Method Details
.api_keys ⇒ Object
27 28 29 |
# File 'lib/foederati.rb', line 27 def api_keys @api_keys ||= OpenStruct.new end |
.configure(&block) ⇒ Object
22 23 24 25 |
# File 'lib/foederati.rb', line 22 def configure(&block) instance_eval(&block) self end |
.connection ⇒ Faraday::Connection
‘Faraday` connection for executing HTTP requests
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/foederati.rb', line 52 def connection @connection ||= begin Faraday.new do |conn| # TODO are max: 5 and interval: 3 sensible values? should they be # made configurable? conn.request :retry, max: 5, interval: 3, exceptions: [Errno::ECONNREFUSED, Errno::ETIMEDOUT, 'Timeout::Error', Faraday::Error::TimeoutError, EOFError] conn.response :unsupported #, content_type: /\bjson$/ conn.response :json, content_type: /\bjson$/ conn.adapter :typhoeus end end end |
.defaults ⇒ Object
31 32 33 |
# File 'lib/foederati.rb', line 31 def defaults @defaults ||= Defaults.new end |