Sha256: c1227f0c4b9253abc82a1c2dbdc16127c809c30f302b60a49da388e69f68b8f9

Contents?: true

Size: 686 Bytes

Versions: 8

Compression:

Stored size: 686 Bytes

Contents

require "faraday_middleware"
Dir[File.expand_path("../../faraday/*.rb", __FILE__)].sort.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.5.0 lib/pocket/connection.rb
pocket-ruby-0.4.0 lib/pocket/connection.rb
pocket-ruby-0.3.0 lib/pocket/connection.rb
pocket-ruby-0.2.1 lib/pocket/connection.rb
pocket-ruby-0.2.0 lib/pocket/connection.rb
pocket-ruby-0.1.0 lib/pocket/connection.rb
pocket-ruby-andyw8-0.1.0 lib/pocket/connection.rb
pocket-ruby-andyw8-0.0.8 lib/pocket/connection.rb