Class: ROX::Response
- Inherits:
-
Object
- Object
- ROX::Response
- Defined in:
- lib/rox/response.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #data ⇒ Object
- #error ⇒ Object
- #error? ⇒ Boolean
-
#initialize(ox_response) ⇒ Response
constructor
A new instance of Response.
- #to_s ⇒ Object
Constructor Details
#initialize(ox_response) ⇒ Response
Returns a new instance of Response.
3 4 5 |
# File 'lib/rox/response.rb', line 3 def initialize(ox_response) @oxresponse = ox_response end |
Instance Method Details
#[](key) ⇒ Object
16 17 18 |
# File 'lib/rox/response.rb', line 16 def [](key) @oxresponse[key.to_s] end |
#data ⇒ Object
20 21 22 |
# File 'lib/rox/response.rb', line 20 def data @oxresponse['data'] end |
#error ⇒ Object
11 12 13 14 |
# File 'lib/rox/response.rb', line 11 def error return nil unless error? sprintf(@oxresponse['error'], *@oxresponse['error_params']) end |
#error? ⇒ Boolean
7 8 9 |
# File 'lib/rox/response.rb', line 7 def error? @oxresponse.include?('error') end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/rox/response.rb', line 24 def to_s @oxresponse.inspect end |