Exception: LookerSDK::OneTimePasswordRequired

Inherits:
ClientError show all
Defined in:
lib/looker-sdk/error.rb

Overview

Raised when API returns a 401 HTTP status code and headers include “X-Looker-OTP” look TODO do we want to support this?

Constant Summary collapse

OTP_DELIVERY_PATTERN =
/required; (\w+)/i

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Error

#documentation_url, error_for_401, error_for_403, #errors, from_response, #initialize, #message

Constructor Details

This class inherits a constructor from LookerSDK::Error

Class Method Details

.required_header(headers) ⇒ Object



165
166
167
# File 'lib/looker-sdk/error.rb', line 165

def self.required_header(headers)
  OTP_DELIVERY_PATTERN.match headers['X-Looker-OTP'].to_s
end

Instance Method Details

#password_deliveryString

Delivery method for the user’s OTP

Returns:

  • (String)


172
173
174
# File 'lib/looker-sdk/error.rb', line 172

def password_delivery
  @password_delivery ||= delivery_method_from_header
end