Sha256: ea424181b06add3d69de928fb4ece7e107cd2f2dc10619efc0053a3bc0b3387c

Contents?: true

Size: 546 Bytes

Versions: 5

Compression:

Stored size: 546 Bytes

Contents

require 'faraday'
require 'simple_oauth'

# @private
module Faraday
  # @private
  class Request::OAuth < Faraday::Middleware
    def call(env)
      params = env[:body].is_a?(Hash) ? env[:body] : {}
      signature_params = params.reject{|k,v| v.respond_to?(:content_type) }
      header = SimpleOAuth::Header.new(env[:method], env[:url], signature_params, @options)

      env[:request_headers]['Authorization'] = header.to_s

      @app.call(env)
    end

    def initialize(app, options)
      @app, @options = app, options
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
smoodit-0.0.2 lib/faraday/oauth.rb
smoodit-0.0.1 lib/faraday/oauth.rb
thounds-0.0.2 lib/faraday/oauth.rb
thounds-0.0.1 lib/faraday/oauth.rb
instapaper_full-0.0.2 lib/faraday/oauth.rb