Exception: Mollie::RequestError
- Defined in:
- lib/mollie/exception.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#detail ⇒ Object
Returns the value of attribute detail.
-
#field ⇒ Object
Returns the value of attribute field.
-
#links ⇒ Object
Returns the value of attribute links.
-
#status ⇒ Object
Returns the value of attribute status.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #http_body ⇒ Object
- #http_headers ⇒ Object
-
#initialize(error, response = nil) ⇒ RequestError
constructor
A new instance of RequestError.
- #to_s ⇒ Object
Constructor Details
#initialize(error, response = nil) ⇒ RequestError
Returns a new instance of RequestError.
8 9 10 11 12 13 14 15 |
# File 'lib/mollie/exception.rb', line 8 def initialize(error, response = nil) exception.status = error['status'] exception.title = error['title'] exception.detail = error['detail'] exception.field = error['field'] exception.links = error['_links'] self.response = response end |
Instance Attribute Details
#detail ⇒ Object
Returns the value of attribute detail.
6 7 8 |
# File 'lib/mollie/exception.rb', line 6 def detail @detail end |
#field ⇒ Object
Returns the value of attribute field.
6 7 8 |
# File 'lib/mollie/exception.rb', line 6 def field @field end |
#links ⇒ Object
Returns the value of attribute links.
6 7 8 |
# File 'lib/mollie/exception.rb', line 6 def links @links end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/mollie/exception.rb', line 6 def status @status end |
#title ⇒ Object
Returns the value of attribute title.
6 7 8 |
# File 'lib/mollie/exception.rb', line 6 def title @title end |
Instance Method Details
#http_body ⇒ Object
25 26 27 |
# File 'lib/mollie/exception.rb', line 25 def http_body response.body if response end |
#http_headers ⇒ Object
21 22 23 |
# File 'lib/mollie/exception.rb', line 21 def http_headers response.to_hash if response end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/mollie/exception.rb', line 17 def to_s "#{status} #{title}: #{detail}" end |