module Foederati
TODO add logger
Constants
- Defaults
- VERSION
Public Class Methods
api_keys()
click to toggle source
# File lib/foederati.rb, line 28 def api_keys @api_keys ||= OpenStruct.new end
configure(&block)
click to toggle source
# File lib/foederati.rb, line 23 def configure(&block) instance_eval(&block) self end
connection()
click to toggle source
`Faraday` connection for executing HTTP requests
@return [Faraday::Connection]
# File lib/foederati.rb, line 53 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()
click to toggle source
# File lib/foederati.rb, line 32 def defaults @defaults ||= Defaults.new end
search(*ids, **params)
click to toggle source
Search registered providers
@param ids [Symbol] ID(s) of one or more provider to search @param params [Hash] search query parameters @return [Hash] combined results of all providers TODO run multiple searches in parallel
# File lib/foederati.rb, line 43 def search(*ids, **params) ids.map do |id| Providers.get(id).search(params) end.reduce(&:merge) end