Class: PR::Pin::API::Error
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #code ⇒ Object
- #description ⇒ Object
- #error? ⇒ Boolean
-
#initialize(error) ⇒ Error
constructor
A new instance of Error.
- #inspect ⇒ Object
- #messages ⇒ Object
- #response_code ⇒ Object
- #success? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(error) ⇒ Error
Returns a new instance of Error.
7 8 9 10 11 12 |
# File 'lib/pr/pin/api/error.rb', line 7 def initialize(error) @response = error.response @result = error.result super(error.) end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/pr/pin/api/error.rb', line 5 def response @response end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
5 6 7 |
# File 'lib/pr/pin/api/error.rb', line 5 def result @result end |
Instance Method Details
#code ⇒ Object
22 23 24 |
# File 'lib/pr/pin/api/error.rb', line 22 def code result[:error] end |
#description ⇒ Object
26 27 28 |
# File 'lib/pr/pin/api/error.rb', line 26 def description result[:error_description] end |
#error? ⇒ Boolean
38 39 40 |
# File 'lib/pr/pin/api/error.rb', line 38 def error? true end |
#inspect ⇒ Object
42 43 44 |
# File 'lib/pr/pin/api/error.rb', line 42 def inspect "#<#{self.class} - Status: `#{response_code}', Code: `#{code}', Message: `#{description}'>" end |
#messages ⇒ Object
30 31 32 |
# File 'lib/pr/pin/api/error.rb', line 30 def result.fetch(:messages, []) end |
#response_code ⇒ Object
14 15 16 |
# File 'lib/pr/pin/api/error.rb', line 14 def response_code response.code end |
#success? ⇒ Boolean
34 35 36 |
# File 'lib/pr/pin/api/error.rb', line 34 def success? false end |
#to_h ⇒ Object
18 19 20 |
# File 'lib/pr/pin/api/error.rb', line 18 def to_h result end |