Class: WalmartApIs::AuthorizeErrorException
- Inherits:
-
APIException
- Object
- CoreLibrary::ApiException
- APIException
- WalmartApIs::AuthorizeErrorException
- Defined in:
- lib/walmart_ap_is/exceptions/authorize_error_exception.rb
Overview
Authorization-endpoint error (RFC 6749 §4.1.2.1) — non-redirectable case only.
Instance Attribute Summary collapse
-
#error ⇒ Error1
Machine-readable error code.
-
#error_description ⇒ String
Human-readable explanation.
-
#error_uri ⇒ String
Optional link to error docs.
-
#state ⇒ String
The
statefrom the request, when supplied.
Instance Method Summary collapse
-
#initialize(reason, response) ⇒ AuthorizeErrorException
constructor
The constructor.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
-
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash.
Constructor Details
#initialize(reason, response) ⇒ AuthorizeErrorException
The constructor.
32 33 34 35 36 |
# File 'lib/walmart_ap_is/exceptions/authorize_error_exception.rb', line 32 def initialize(reason, response) super(reason, response) hash = APIHelper.json_deserialize(@response.raw_body) unbox(hash) end |
Instance Attribute Details
#error ⇒ Error1
Machine-readable error code.
15 16 17 |
# File 'lib/walmart_ap_is/exceptions/authorize_error_exception.rb', line 15 def error @error end |
#error_description ⇒ String
Human-readable explanation.
19 20 21 |
# File 'lib/walmart_ap_is/exceptions/authorize_error_exception.rb', line 19 def error_description @error_description end |
#error_uri ⇒ String
Optional link to error docs.
23 24 25 |
# File 'lib/walmart_ap_is/exceptions/authorize_error_exception.rb', line 23 def error_uri @error_uri end |
#state ⇒ String
The state from the request, when supplied.
27 28 29 |
# File 'lib/walmart_ap_is/exceptions/authorize_error_exception.rb', line 27 def state @state end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
59 60 61 62 63 |
# File 'lib/walmart_ap_is/exceptions/authorize_error_exception.rb', line 59 def inspect class_name = self.class.name.split('::').last "<#{class_name} error: #{@error.inspect}, error_description: #{@error_description.inspect},"\ " error_uri: #{@error_uri.inspect}, state: #{@state.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
52 53 54 55 56 |
# File 'lib/walmart_ap_is/exceptions/authorize_error_exception.rb', line 52 def to_s class_name = self.class.name.split('::').last "<#{class_name} error: #{@error}, error_description: #{@error_description}, error_uri:"\ " #{@error_uri}, state: #{@state}>" end |
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash. response body.
41 42 43 44 45 46 47 48 49 |
# File 'lib/walmart_ap_is/exceptions/authorize_error_exception.rb', line 41 def unbox(hash) return nil unless hash @error = hash.key?('error') ? hash['error'] : nil @error_description = hash.key?('error_description') ? hash['error_description'] : SKIP @error_uri = hash.key?('error_uri') ? hash['error_uri'] : SKIP @state = hash.key?('state') ? hash['state'] : SKIP end |