Sha256: db4eba3d2866556a60e29b159ebd86bb72598863735ea54463bf3bdfdafd5037

Contents?: true

Size: 528 Bytes

Versions: 9

Compression:

Stored size: 528 Bytes

Contents

require "faraday"

# @private
module FaradayMiddleware
  # @private
  class PocketOAuth < Faraday::Middleware
    def call(env)
      env[:body] = {} if env[:body].nil?
      env[:body] = env[:body].merge(consumer_key: @consumer_key)

      if @access_token
        env[:body] = env[:body].merge(access_token: @access_token)
      end

      @app.call env
    end

    def initialize(app, consumer_key, access_token = nil)
      @app = app
      @consumer_key = consumer_key
      @access_token = access_token
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
pocket-ruby-0.6.0 lib/faraday/pocket_oauth.rb
pocket-ruby-0.5.0 lib/faraday/pocket_oauth.rb
pocket-ruby-0.4.0 lib/faraday/pocket_oauth.rb
pocket-ruby-0.3.0 lib/faraday/pocket_oauth.rb
pocket-ruby-0.2.1 lib/faraday/pocket_oauth.rb
pocket-ruby-0.2.0 lib/faraday/pocket_oauth.rb
pocket-ruby-0.1.0 lib/faraday/pocket_oauth.rb
pocket-ruby-andyw8-0.1.0 lib/faraday/pocket_oauth.rb
pocket-ruby-andyw8-0.0.8 lib/faraday/pocket_oauth.rb