Sha256: a0b84c1f6459f703932d374eeaecdf32f34f5759be9ff0909ad0e7c3dc68e142

Contents?: true

Size: 1020 Bytes

Versions: 3

Compression:

Stored size: 1020 Bytes

Contents

require 'faraday_middleware'
require 'faraday/response/raise_error'

module Octokit
  class Client
    # @private
    module Connection
      private

      def connection(raw=false, authenticate=true)
        options = {
          :proxy => proxy,
          :ssl => {:verify => false},
          :url => endpoint,
        }

        options.merge!(:params => { :access_token => oauth_token }) if oauthed? && !authenticated?

        Faraday::Connection.new(options) do |connection|
          connection.use Faraday::Response::RaiseError
          unless raw
            connection.use Faraday::Response::Mashify
            case format.to_s.downcase
            when 'json' then connection.use Faraday::Response::ParseJson
            when 'xml' then connection.use Faraday::Response::ParseXml
            end
          end
          connection.basic_auth authentication[:login], authentication[:password] if authenticate and authenticated?
          connection.adapter(adapter)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
hybridgroup-octokit-0.6.2 lib/octokit/client/connection.rb
hybridgroup-octokit-0.6.1 lib/octokit/client/connection.rb
xn-octokit-0.6.1 lib/octokit/client/connection.rb