Class: OpenTox::Error
- Inherits:
-
Object
- Object
- OpenTox::Error
- Defined in:
- lib/rest_client_wrapper.rb
Overview
PENDING: implement ot error api, move to own file
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#code ⇒ Object
Returns the value of attribute code.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#uri ⇒ Object
Returns the value of attribute uri.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code, body, uri, payload, headers) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(code, body, uri, payload, headers) ⇒ Error
Returns a new instance of Error.
10 11 12 13 14 15 16 |
# File 'lib/rest_client_wrapper.rb', line 10 def initialize(code, body, uri, payload, headers) self.code = code self.body = body.to_s[0..1000] self.uri = uri self.payload = payload self.headers = headers end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
8 9 10 |
# File 'lib/rest_client_wrapper.rb', line 8 def body @body end |
#code ⇒ Object
Returns the value of attribute code.
8 9 10 |
# File 'lib/rest_client_wrapper.rb', line 8 def code @code end |
#headers ⇒ Object
Returns the value of attribute headers.
8 9 10 |
# File 'lib/rest_client_wrapper.rb', line 8 def headers @headers end |
#payload ⇒ Object
Returns the value of attribute payload.
8 9 10 |
# File 'lib/rest_client_wrapper.rb', line 8 def payload @payload end |
#uri ⇒ Object
Returns the value of attribute uri.
8 9 10 |
# File 'lib/rest_client_wrapper.rb', line 8 def uri @uri end |
Class Method Details
.parse(error_array_string) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rest_client_wrapper.rb', line 18 def self.parse(error_array_string) begin err = YAML.load(error_array_string) if err and err.is_a?(Array) and err.size>0 and err[0].is_a?(Error) return err else return nil end rescue return nil end end |