Class: NftmakerApi::Error
- Inherits:
-
Object
- Object
- NftmakerApi::Error
- Defined in:
- lib/nftmaker_api/error.rb
Instance Method Summary collapse
-
#initialize(response) ⇒ Error
constructor
A new instance of Error.
- #reason ⇒ Object
- #status ⇒ Object
- #status_phrase ⇒ Object
- #to_s ⇒ Object (also: #full_message)
Constructor Details
#initialize(response) ⇒ Error
Returns a new instance of Error.
3 4 5 |
# File 'lib/nftmaker_api/error.rb', line 3 def initialize(response) @response = response end |
Instance Method Details
#reason ⇒ Object
20 21 22 |
# File 'lib/nftmaker_api/error.rb', line 20 def reason @response.to_h.fetch("errorMessage") { nil } end |
#status ⇒ Object
12 13 14 |
# File 'lib/nftmaker_api/error.rb', line 12 def status @response.original.status end |
#status_phrase ⇒ Object
16 17 18 |
# File 'lib/nftmaker_api/error.rb', line 16 def status_phrase @response.original.reason_phrase end |
#to_s ⇒ Object Also known as: full_message
7 8 9 |
# File 'lib/nftmaker_api/error.rb', line 7 def to_s ["#{status} #{status_phrase}", reason].compact.join(", ") end |