module Knodes::Connection

Public Instance Methods

connection(raw=false) click to toggle source
# File lib/knodes/connection.rb, line 6
  def connection(raw=false)
          options = {
  :headers => {'Accept' => "application/#{format}; charset=utf-8", 'User-Agent' => user_agent},
  :proxy => proxy,
  :ssl => {:verify => false},
  :url => endpoint,
}

          Faraday::Connection.new(options) do |connection|
  connection.request :url_encoded
  connection.response :mashify unless raw
  connection.response :json, content_type: 'application/json' unless raw  
  connection.use FaradayMiddleware::KnodesErrors
  connection.adapter(adapter)
          end
  end