Sha256: f792676e34889c8c528539f3df0a7d3441e15537eeec460ed9c98302b3b6cfa2

Contents?: true

Size: 928 Bytes

Versions: 10

Compression:

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

Version data entries

10 entries across 10 versions & 4 rubygems

Version Path
instagram-0.8.2 lib/instagram/connection.rb
instagram-fixed-0.8.1 lib/instagram-fixed/connection.rb
instagram-fixed-0.8 lib/instagram/connection.rb
instagram-innonate-0.8 lib/instagram/connection.rb
instagram-0.8 lib/instagram/connection.rb
instagram-0.7 lib/instagram/connection.rb
instagram-0.6.2 lib/instagram/connection.rb
localist-instagvram-0.6.2 lib/instagram/connection.rb
instagram-0.6.1 lib/instagram/connection.rb
instagram-0.6 lib/instagram/connection.rb