lib/bwapi/connection.rb
# Create a connection to send request
Create a connection to send request
Create a connection to send request
def connection opts={}
      connection = Faraday.new(opts) do |conn|
        if opts[:force_urlencoded]
          conn.request :url_encoded
        else
          conn.request :json
        end
        conn.request :json
        conn.use Faraday::Response::BrandwatchError
        conn.use FaradayMiddleware::FollowRedirects
        conn.use FaradayMiddleware::Mashify
        conn.use FaradayMiddleware::ParseJson, :content_type => /\bjson$/
        conn.adapter adapter
      end
      connection.headers[:user_agent] = user_agent
      connection
    end
def connection opts = { } connection = Faraday . new ( opts ) do | conn | if opts [ :force_urlencoded ] conn . request :url_encoded else conn . request :json end conn . request :json conn . use Faraday :: Response :: BrandwatchError conn . use FaradayMiddleware :: FollowRedirects conn . use FaradayMiddleware :: Mashify conn . use FaradayMiddleware :: ParseJson , :content_type => / \b json$ / conn . adapter adapter end connection . headers [ :user_agent ] = user_agent connection end
Create a connection to send request
Create a connection to send request
opts
<not_specific>