Sha256: d32b1848708d90bc2300c61dd53dddb515c37fc7fc8c09a1618b997db1030029
Contents?: true
Size: 1.28 KB
Versions: 3
Compression:
Stored size: 1.28 KB
Contents
require 'faraday_middleware' require 'faraday/request/gateway' require 'faraday/request/basic_auth' require 'faraday/response/raise_http_4xx' require 'faraday/response/raise_http_5xx' module Cashstar # @private module Connection private def connection(options={}) merged_options = faraday_options.merge({ :headers => { 'Accept' => "application/json", 'User-Agent' => user_agent, 'Content-Type' => "application/json" }, :ssl => {:verify => false}, :url => options.fetch(:endpoint, api_endpoint) }) faraday = Faraday.new(merged_options) do |builder| builder.use Faraday::Request::BasicAuth, authentication if authenticated? builder.use Faraday::Request::UrlEncoded builder.use Faraday::Response::RaiseHttp4xx unless options[:raw] case options.fetch(:format, format).to_s.downcase when 'json' 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 |
---|---|
cashstar-0.1.2 | lib/cashstar/connection.rb |
cashstar-0.1.1 | lib/cashstar/connection.rb |
cashstar-0.1.0 | lib/cashstar/connection.rb |