Exception: PactasItero::OneTimePasswordRequired

Inherits:
ClientError show all
Defined in:
lib/pactas_itero/error.rb

Overview

Raised when Pactas returns a 401 HTTP status code and headers include “X-Pactas-OTP”

Constant Summary collapse

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Error

error_for401, error_for403, #errors, from_response, #initialize

Constructor Details

This class inherits a constructor from PactasItero::Error

Class Method Details

.required_header(headers) ⇒ Object



151
152
153
# File 'lib/pactas_itero/error.rb', line 151

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

Instance Method Details

#password_deliveryString

Delivery method for the user’s OTP

Returns:

  • (String)


158
159
160
# File 'lib/pactas_itero/error.rb', line 158

def password_delivery
  @_password_delivery ||= delivery_method_from_header
end