Sha256: e35a2728c4249b182aead0e7a2c50a0027512eae2e0a415b6c67c7324c2dea32

Contents?: true

Size: 999 Bytes

Versions: 10

Compression:

Stored size: 999 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,
        :url => endpoint,
      }.merge(connection_options)

      Faraday::Connection.new(options) do |connection|
        connection.use FaradayMiddleware::InstagramOAuth2, client_id, access_token
        connection.use Faraday::Request::UrlEncoded
        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
        connection.use FaradayMiddleware::LoudLogger if loud_logger
        connection.adapter(adapter)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 4 rubygems

Version Path
extendi-instagram-2.0.3 lib/instagram/connection.rb
extendi-instagram-2.0.2 lib/instagram/connection.rb
extendi-instagram-2.0.1 lib/instagram/connection.rb
extendi-instagram-2.0.0 lib/instagram/connection.rb
instagram-continued-1.3.0 lib/instagram/connection.rb
instagram-community-maintained-1.1.6 lib/instagram/connection.rb
instagram-continued-1.2.1 lib/instagram/connection.rb
instagram-continued-1.2.0 lib/instagram/connection.rb
instagram-1.1.6 lib/instagram/connection.rb
instagram-1.1.5 lib/instagram/connection.rb