class Gapic::Rest::FaradayMiddleware::GoogleAuthorization


using ::Google::Auth::Credentials
Request middleware that constructs the Authorization HTTP header
@private
#

def call env

Parameters:
  • env (Faraday::Env) --

Other tags:
    Private: -
def call env
  unless @updater_proc.is_a? Symbol
    auth_hash = @updater_proc.call({})
    env.request_headers["Authorization"] = auth_hash[:authorization]
  end
  @app.call env
end

def initialize app, credentials

Parameters:
  • credentials (Google::Auth::Credentials, Signet::OAuth2::Client, Symbol, Proc) --
  • app (#call) --

Other tags:
    Private: -
def initialize app, credentials
  @updater_proc = case credentials
                  when Symbol
                    credentials
                  else
                    updater_proc = credentials.updater_proc if credentials.respond_to? :updater_proc
                    updater_proc ||= credentials if credentials.is_a? Proc
                    raise ArgumentError, "invalid credentials (#{credentials.class})" if updater_proc.nil?
                    updater_proc
                  end
  super app
end