Sha256: fe3f6fbc979b4bc6758b99b03850cb02e5ec23cece0832387411761b38f8149b
Contents?: true
Size: 614 Bytes
Versions: 1
Compression:
Stored size: 614 Bytes
Contents
require 'faraday_middleware' module Congress module Connection ENDPOINT = 'https://congress.api.sunlightfoundation.com'.freeze private def connection @connection ||= create_connection end def create_connection Faraday.new(url: ENDPOINT) do |connection| middlewares.each { |middleware| connection.use(middleware) } connection.adapter(Faraday.default_adapter) end end def middlewares [Faraday::Request::UrlEncoded, Faraday::Response::RaiseError, Faraday::Response::Rashify, Faraday::Response::ParseJson] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
congress-0.2.5 | lib/congress/connection.rb |