class Octokit::OneTimePasswordRequired

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

Constants

OTP_DELIVERY_PATTERN

@private

Public Class Methods

required_header(headers) click to toggle source

@private

# File lib/octokit/error.rb, line 209
def self.required_header(headers)
  OTP_DELIVERY_PATTERN.match headers['X-GitHub-OTP'].to_s
end

Public Instance Methods

password_delivery() click to toggle source

Delivery method for the user's OTP

@return [String]

# File lib/octokit/error.rb, line 216
def password_delivery
  @password_delivery ||= delivery_method_from_header
end

Private Instance Methods

delivery_method_from_header() click to toggle source
# File lib/octokit/error.rb, line 222
def delivery_method_from_header
  if match = self.class.required_header(@response[:response_headers])
    match[1]
  end
end