Sha256: e9c84fe2e2eb8f7686571ec86ef13ed58e2a22ce402424feabb5b19c28c80585

Contents?: true

Size: 544 Bytes

Versions: 3

Compression:

Stored size: 544 Bytes

Contents

require 'faraday'

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

    def call(env)
      params = env[:body] || {}
      signature_params = params

      params.map{ |k,v| signature_params = {} if 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

3 entries across 3 versions & 1 rubygems

Version Path
evrythng-0.0.3 lib/faraday/request/oauth.rb
evrythng-0.0.2 lib/faraday/request/oauth.rb
evrythng-0.0.1 lib/faraday/request/oauth.rb