Class: ShellEv::UnauthorizedException
- Inherits:
-
APIException
- Object
- CoreLibrary::ApiException
- APIException
- ShellEv::UnauthorizedException
- Defined in:
- lib/shell_ev/exceptions/unauthorized_exception.rb
Overview
Unauthorized class.
Instance Attribute Summary collapse
-
#errors ⇒ Array[UnauthorizedErrMsg]
Exception details of the error.
-
#request_id ⇒ String
requestId or correlation id of the message.
-
#status ⇒ String
Status of the request.
Instance Method Summary collapse
-
#initialize(reason, response) ⇒ UnauthorizedException
constructor
The constructor.
-
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash.
Constructor Details
#initialize(reason, response) ⇒ UnauthorizedException
The constructor.
27 28 29 30 31 |
# File 'lib/shell_ev/exceptions/unauthorized_exception.rb', line 27 def initialize(reason, response) super(reason, response) hash = APIHelper.json_deserialize(@response.raw_body) unbox(hash) end |
Instance Attribute Details
#errors ⇒ Array[UnauthorizedErrMsg]
Exception details of the error
22 23 24 |
# File 'lib/shell_ev/exceptions/unauthorized_exception.rb', line 22 def errors @errors end |
#request_id ⇒ String
requestId or correlation id of the message
14 15 16 |
# File 'lib/shell_ev/exceptions/unauthorized_exception.rb', line 14 def request_id @request_id end |
#status ⇒ String
Status of the request
18 19 20 |
# File 'lib/shell_ev/exceptions/unauthorized_exception.rb', line 18 def status @status end |
Instance Method Details
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash. response body.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/shell_ev/exceptions/unauthorized_exception.rb', line 36 def unbox(hash) @request_id = hash.key?('requestId') ? hash['requestId'] : SKIP @status = hash.key?('status') ? hash['status'] : SKIP # Parameter is an array, so we need to iterate through it @errors = nil unless hash['errors'].nil? @errors = [] hash['errors'].each do |structure| @errors << (UnauthorizedErrMsg.from_hash(structure) if structure) end end @errors = SKIP unless hash.key?('errors') end |