Sha256: 281bffccac13cebd7ea22a06a14c1689dd204cf54aafe1e9cf4a878bdfd508b4

Contents?: true

Size: 677 Bytes

Versions: 29

Compression:

Stored size: 677 Bytes

Contents

# Borrowed from https://github.com/pengwynn/faraday_middleware/blob/master/lib/faraday/request/oauth.rb
class ApiClient::Connection::Middlewares::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
    env[:request_headers]['User-Agent'] = "ApiClient gem v#{ApiClient::VERSION}"

    @app.call(env)
  end

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

end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
api_client-0.5.11 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.9 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.7 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.6 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.5 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.4 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.3 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.2 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.1 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.0 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.4.3 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.4.2 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.4.1 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.3.3 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.4.0 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.3.2 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.3.1 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.3.0 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.2.0 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.1.9 lib/api_client/connection/middlewares/request/oauth.rb