Exception: RequestError
- Inherits:
-
StandardError
- Object
- StandardError
- RequestError
- Defined in:
- lib/postman_api.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(status_code, method, url, message) ⇒ RequestError
constructor
A new instance of RequestError.
Constructor Details
#initialize(status_code, method, url, message) ⇒ RequestError
Returns a new instance of RequestError.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/postman_api.rb', line 10 def initialize(status_code, method, url, ) @status_code = status_code @method = method @url = url begin @data = JSON.parse() rescue @data = end super("received #{status_code} from #{method} #{url} with #{message}") end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
8 9 10 |
# File 'lib/postman_api.rb', line 8 def data @data end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
8 9 10 |
# File 'lib/postman_api.rb', line 8 def method @method end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
8 9 10 |
# File 'lib/postman_api.rb', line 8 def status_code @status_code end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/postman_api.rb', line 8 def url @url end |