Exception: Tikkie::Api::RequestError
- Defined in:
- lib/tikkie/api/exception.rb
Overview
Exception when an HTTP request fails.
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #errors ⇒ Object
- #http_code ⇒ Object
- #http_message ⇒ Object
-
#initialize(response) ⇒ RequestError
constructor
A new instance of RequestError.
- #messages ⇒ Object
- #request_uri ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(response) ⇒ RequestError
Returns a new instance of RequestError.
13 14 15 |
# File 'lib/tikkie/api/exception.rb', line 13 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
11 12 13 |
# File 'lib/tikkie/api/exception.rb', line 11 def response @response end |
Instance Method Details
#errors ⇒ Object
17 18 19 |
# File 'lib/tikkie/api/exception.rb', line 17 def errors response.errors end |
#http_code ⇒ Object
25 26 27 |
# File 'lib/tikkie/api/exception.rb', line 25 def http_code response.http_code end |
#http_message ⇒ Object
29 30 31 |
# File 'lib/tikkie/api/exception.rb', line 29 def response. end |
#messages ⇒ Object
33 34 35 |
# File 'lib/tikkie/api/exception.rb', line 33 def errors.map(&:message) end |
#request_uri ⇒ Object
21 22 23 |
# File 'lib/tikkie/api/exception.rb', line 21 def request_uri response.request_uri end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/tikkie/api/exception.rb', line 37 def to_s "#{http_code} #{}: #{.join(', ')}" end |