Sha256: 19050b56b178f49e64e46ad0e03cf52b01361b730cff52bae5f4275430bd038d

Contents?: true

Size: 532 Bytes

Versions: 8

Compression:

Stored size: 532 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

8 entries across 8 versions & 2 rubygems

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