Class: ShellEv::HTTP401ErrorResponseException
- Inherits:
-
APIException
- Object
- CoreLibrary::ApiException
- APIException
- ShellEv::HTTP401ErrorResponseException
- Defined in:
- lib/shell_ev/exceptions/http401_error_response_exception.rb
Overview
HTTP 401 Error Response class.
Instance Attribute Summary collapse
-
#errors ⇒ Array[ResponseError401AllOf1ErrorsItems]
Details of error(s) encountered.
-
#request_id ⇒ String
A unique request id in GUID format.
-
#status ⇒ ResponseBaseStatusEnum
Indicates overall status of the request.
Instance Method Summary collapse
-
#initialize(reason, response) ⇒ HTTP401ErrorResponseException
constructor
The constructor.
-
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash.
Constructor Details
#initialize(reason, response) ⇒ HTTP401ErrorResponseException
The constructor.
28 29 30 31 32 |
# File 'lib/shell_ev/exceptions/http401_error_response_exception.rb', line 28 def initialize(reason, response) super(reason, response) hash = APIHelper.json_deserialize(@response.raw_body) unbox(hash) end |
Instance Attribute Details
#errors ⇒ Array[ResponseError401AllOf1ErrorsItems]
Details of error(s) encountered
23 24 25 |
# File 'lib/shell_ev/exceptions/http401_error_response_exception.rb', line 23 def errors @errors end |
#request_id ⇒ String
A unique request id in GUID format. The value is written to the Shell API Platform audit log for end to end traceability of a request.
15 16 17 |
# File 'lib/shell_ev/exceptions/http401_error_response_exception.rb', line 15 def request_id @request_id end |
#status ⇒ ResponseBaseStatusEnum
Indicates overall status of the request
19 20 21 |
# File 'lib/shell_ev/exceptions/http401_error_response_exception.rb', line 19 def status @status end |
Instance Method Details
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash. response body.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/shell_ev/exceptions/http401_error_response_exception.rb', line 37 def unbox(hash) @request_id = hash.key?('RequestId') ? hash['RequestId'] : nil @status = hash.key?('Status') ? hash['Status'] : nil # Parameter is an array, so we need to iterate through it @errors = nil unless hash['Errors'].nil? @errors = [] hash['Errors'].each do |structure| @errors << (ResponseError401AllOf1ErrorsItems.from_hash(structure) if structure) end end @errors = nil unless hash.key?('Errors') end |