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