Exception: CoverMyMeds::Error::HTTPError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, message, http_method, url) ⇒ HTTPError

Returns a new instance of HTTPError.



5
6
7
8
9
10
# File 'lib/cover_my_meds/error.rb', line 5

def initialize status, message, http_method, url
  @status = status
  @error_json = message
  @http_method = http_method
  @url = url
end

Instance Attribute Details

#error_jsonObject (readonly)

Returns the value of attribute error_json.



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

def error_json
  @error_json
end

#http_methodObject (readonly)

Returns the value of attribute http_method.



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

def http_method
  @http_method
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

Instance Method Details

#messageObject



12
13
14
15
16
17
18
# File 'lib/cover_my_meds/error.rb', line 12

def message
  "    \#{@status}: \#{@error_json}\n    in response to:\n    \#{@http_method.upcase} \#{@url}\n  EOS\nend\n".gsub(/^ {10}/, "")