Class: NftmakerApi::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/nftmaker_api/error.rb

Instance Method Summary collapse

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

#reasonObject



20
21
22
# File 'lib/nftmaker_api/error.rb', line 20

def reason
  @response.to_h.fetch("errorMessage") { nil }
end

#statusObject



12
13
14
# File 'lib/nftmaker_api/error.rb', line 12

def status
  @response.original.status
end

#status_phraseObject



16
17
18
# File 'lib/nftmaker_api/error.rb', line 16

def status_phrase
  @response.original.reason_phrase
end

#to_sObject 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