Sha256: 48a7062028195f975d57899c21e81a393f5bf3736ece888adb3a8eb915527fe5

Contents?: true

Size: 509 Bytes

Versions: 4

Compression:

Stored size: 509 Bytes

Contents

require 'faraday'

module Faraday
  class Request::OAuth < Faraday::Middleware
    dependency 'simple_oauth'

    def call(env)
      params = 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

4 entries across 4 versions & 1 rubygems

Version Path
faraday_middleware-0.7.0 lib/faraday/request/oauth.rb
faraday_middleware-0.7.0.rc1 lib/faraday/request/oauth.rb
faraday_middleware-0.6.5 lib/faraday/request/oauth.rb
faraday_middleware-0.6.3 lib/faraday/request/oauth.rb