class Gapic::Rest::FaradayMiddleware::GoogleAuthorization
Request middleware that constructs the Authorization HTTP header using ::Google::Auth::Credentials
Public Class Methods
new(app, credentials)
click to toggle source
@param app [#call] @param credentials [::Google::Auth::Credentials]
Calls superclass method
# File lib/gapic/rest/faraday_middleware.rb, line 28 def initialize app, credentials @credentials = credentials super app end
Public Instance Methods
call(env)
click to toggle source
@param env [Faraday::Env]
# File lib/gapic/rest/faraday_middleware.rb, line 34 def call env auth_hash = @credentials.client.apply({}) env.request_headers["Authorization"] = auth_hash[:authorization] @app.call env end