Sha256: 8492e97bd12e91655e2cf6adc931da2e961396779a8cfda03c62c62a992c9a64

Contents?: true

Size: 932 Bytes

Versions: 2

Compression:

Stored size: 932 Bytes

Contents

require 'faraday_middleware'
Dir[File.expand_path('../../faraday/*.rb', __FILE__)].each{|f| require f}

module Instagram
  # @private
  module Connection
    private

    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.use FaradayMiddleware::OAuth2, client_id, access_token
        connection.use Faraday::Request::UrlEncoded
        connection.adapter(adapter)
        connection.use FaradayMiddleware::Mashify unless raw
        unless raw
          case format.to_s.downcase
          when 'json' then connection.use Faraday::Response::ParseJson
          end
        end
        connection.use FaradayMiddleware::RaiseHttpException
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
instagram-0.8.4 lib/instagram/connection.rb
instagram-0.8.3 lib/instagram/connection.rb