123456789_123456789_123456789_123456789_123456789_

Exception: Octokit::OneTimePasswordRequired

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, ClientError, Error, StandardError
Instance Chain:
self, ClientError, Error, StandardError
Inherits: Octokit::ClientError
Defined in: lib/octokit/error.rb

Overview

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

Constant Summary

Class Method Summary

Error - Inherited

.error_for_401

Returns most appropriate error for 401 HTTP status code.

.error_for_403

Returns most appropriate error for 403 HTTP status code.

.error_for_404

Return most appropriate error for 404 HTTP status code.

.error_for_422

Return most appropriate error for 422 HTTP status code.

.from_response

Returns the appropriate Error subclass based on status and response message.

.new

Instance Attribute Summary

Error - Inherited

Instance Method Summary

Error - Inherited

#build_error_context,
#documentation_url

Documentation URL returned by the API for some errors.

#errors

Array of validation errors.

#response_body

Body returned by the GitHub server.

#response_headers

Headers returned by the GitHub server.

#response_status

Status code returned by the GitHub server.

#build_error_message, #data, #redact_url, #response_error, #response_error_summary, #response_message

Constructor Details

This class inherits a constructor from Octokit::Error

Class Method Details

.required_header(headers)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/octokit/error.rb', line 234

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

Instance Method Details

#delivery_method_from_header (private)

[ GitHub ]

  
# File 'lib/octokit/error.rb', line 247

def delivery_method_from_header
  if match = self.class.required_header(@response[:response_headers])
    match[1]
  end
end

#password_deliveryString

Delivery method for the user's OTP

[ GitHub ]

  
# File 'lib/octokit/error.rb', line 241

def password_delivery
  @password_delivery ||= delivery_method_from_header
end