Exception: EML::RESTError

Inherits:
Error
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/eml/error/rest.rb

Overview

RESTError is the parent class for errors related to connections to the EML REST Web Services APIs

Instance Attribute Summary

Attributes inherited from Error

#message

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, response = nil) ⇒ RESTError

Returns a new instance of RESTError.



16
17
18
19
20
# File 'lib/eml/error/rest.rb', line 16

def initialize(message = nil, response = nil)
  super(message)

  @response = T.let(response, T.nilable(EML::Response))
end

Instance Method Details

#http_bodyObject



23
24
25
# File 'lib/eml/error/rest.rb', line 23

def http_body
  @response&.error || @response&.body&.to_s
end

#http_headersObject



28
29
30
# File 'lib/eml/error/rest.rb', line 28

def http_headers
  @response&.headers
end

#http_statusObject



33
34
35
# File 'lib/eml/error/rest.rb', line 33

def http_status
  @response&.http_status
end

#urlObject



38
39
40
# File 'lib/eml/error/rest.rb', line 38

def url
  @response&.url&.to_s
end