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
-
OTP_DELIVERY_PATTERN =
Internal use only
# File 'lib/octokit/error.rb', line 241/required; (\w+)/i.freeze
Class Method Summary
- .required_header(headers) Internal use only Internal use only
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 |
.new |
Instance Attribute Summary
Instance Method Summary
-
#password_delivery ⇒ String
Delivery method for the user's OTP.
- #delivery_method_from_header private
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 244
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 257
def delivery_method_from_header if match = self.class.required_header(@response[:response_headers]) match[1] end end
#password_delivery ⇒ String
Delivery method for the user's OTP
# File 'lib/octokit/error.rb', line 251
def password_delivery @password_delivery ||= delivery_method_from_header end