Sha256: 44e86ae0b92132bf9c4ea767072118f5408ed622a86604f3403993d93879dfd6
Contents?: true
Size: 1.59 KB
Versions: 3
Compression:
Stored size: 1.59 KB
Contents
require 'faraday_middleware' require 'faraday/request/phoenix' require 'faraday/request/multipart_with_file' require 'faraday/request/gateway' require 'faraday/request/angellist_api_oauth' require 'faraday/response/raise_http_4xx' require 'faraday/response/raise_http_5xx' module AngellistApi # @private module Connection private def connection(options={}) merged_options = faraday_options.merge({ :headers => { 'Accept' => "application/#{format}", 'User-Agent' => user_agent }, :proxy => proxy, :ssl => {:verify => false}, :url => options.fetch(:endpoint, api_endpoint) }) Faraday.new(merged_options) do |builder| builder.use Faraday::Request::Phoenix if options[:phoenix] builder.use Faraday::Request::MultipartWithFile builder.use Faraday::Request::AngellistApiOAuth, authentication if authenticated? builder.use Faraday::Request::Multipart builder.use Faraday::Request::UrlEncoded builder.use Faraday::Request::Gateway, gateway if gateway builder.use Faraday::Response::RaiseHttp4xx unless options[:raw] case options.fetch(:format, format).to_s.downcase when 'json', 'phoenix' builder.use Faraday::Response::Mashify builder.use Faraday::Response::ParseJson when 'xml' builder.use Faraday::Response::Mashify builder.use Faraday::Response::ParseXml end end builder.use Faraday::Response::RaiseHttp5xx builder.adapter(adapter) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
angellist_api-1.0.1 | lib/angellist_api/connection.rb |
angellist_api-0.1.2 | lib/angellist_api/connection.rb |
angellist_api-1.0.0 | lib/angellist_api/connection.rb |