Exception: NaranyaEcm::Rest::AuthorizationRequired
- Defined in:
- lib/naranya_ecm/rest/errors.rb
Instance Attribute Summary
Attributes inherited from RestError
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(given_response, msg = "") ⇒ AuthorizationRequired
constructor
A new instance of AuthorizationRequired.
Methods inherited from RestError
build_from_failed_response, raise_by_failed_response
Constructor Details
#initialize(given_response, msg = "") ⇒ AuthorizationRequired
Returns a new instance of AuthorizationRequired.
119 120 121 122 123 |
# File 'lib/naranya_ecm/rest/errors.rb', line 119 def initialize(given_response, msg = "") data = parse_www_authenticate_header given_response super given_response, "#{data['error_description']} (HTTP status #{given_response.status})" end |
Class Method Details
.parse_www_authenticate_header(response) ⇒ Object
112 113 114 115 |
# File 'lib/naranya_ecm/rest/errors.rb', line 112 def self.parse_www_authenticate_header(response) Hash[response.headers['WWW-Authenticate'].scan(/(\w+)="([^"]+)"/)] \ if response.headers['WWW-Authenticate'] end |