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