Sha256: f8acfbe24ce7820ded13417b38b51b2c345e2a3de9927523a26ce41a5cc6241d

Contents?: true

Size: 695 Bytes

Versions: 8

Compression:

Stored size: 695 Bytes

Contents

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

module Pocket
  # @private
  module Connection
    private

    def connection(raw=false)
      options = {
        :headers => {'User-Agent' => user_agent},
        :proxy => proxy,
        :ssl => {:verify => false},
        :url => endpoint,
      }

      Faraday::Connection.new(options) do |conn|
        conn.use FaradayMiddleware::PocketOAuth, consumer_key, access_token
        conn.use Faraday::Response::RaisePocketError

        conn.request :json

        conn.response :json, :content_type => /\bjson$/

        conn.adapter Faraday.default_adapter
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
pocket-ruby-0.0.9 lib/pocket/connection.rb
pocket-ruby-0.0.8 lib/pocket/connection.rb
pocket-ruby-0.0.7 lib/pocket/connection.rb
pocket-ruby-andyw8-0.0.7 lib/pocket/connection.rb
pocket-ruby-0.0.6 lib/pocket/connection.rb
pocket-ruby-0.0.5 lib/pocket/connection.rb
pocket-ruby-0.0.4 lib/pocket/connection.rb
pocket-ruby-0.0.3 lib/pocket/connection.rb