Sha256: 51c3d6a2e50ddb12615e71a061ac09d389ec2d2231f64a7bf425a62ae3b3a8a5

Contents?: true

Size: 380 Bytes

Versions: 3

Compression:

Stored size: 380 Bytes

Contents

module MarketoApi
  # Piece of middleware that simply injects the OAuth token into the request
  # headers.
  class Middleware::Authorization < MarketoApi::Middleware
    AUTH_HEADER = 'Authorization'.freeze

    def call(env)
      env[:request_headers][AUTH_HEADER] = %(Bearer #{token})
      @app.call(env)
    end

    def token
      @options[:oauth_token]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
marketo_api-0.3.0.pre.alpha lib/marketo_api/middleware/authorization.rb
marketo_api-0.1.1.pre.alpha lib/marketo_api/middleware/authorization.rb
marketo_api-0.0.7.pre.alpha lib/marketo_api/middleware/authorization.rb