Sha256: cb386acd0435baa7c68abae5c33889062cd03e0326dbfcfec927d64a9441e1c5

Contents?: true

Size: 678 Bytes

Versions: 18

Compression:

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

18 entries across 18 versions & 1 rubygems

Version Path
api_client-0.6.0-java lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.6.0 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.26-java lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.26 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.25-java lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.25 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.24 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.22 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.21 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.20 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.19 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.18 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.17 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.16 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.15 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.14 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.13 lib/api_client/connection/middlewares/request/oauth.rb
api_client-0.5.12 lib/api_client/connection/middlewares/request/oauth.rb