Class: ServerDensity::CommandResult
- Inherits:
-
Object
- Object
- ServerDensity::CommandResult
- Defined in:
- lib/server_density.rb
Instance Method Summary collapse
- #data ⇒ Object
- #error_code ⇒ Object
- #error_message ⇒ Object
-
#initialize(response) ⇒ CommandResult
constructor
A new instance of CommandResult.
- #success? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ CommandResult
Returns a new instance of CommandResult.
34 35 36 37 |
# File 'lib/server_density.rb', line 34 def initialize(response) @parsed_response = Yajl::Parser.parse(response) @status = @parsed_response['status'] end |
Instance Method Details
#data ⇒ Object
43 44 45 |
# File 'lib/server_density.rb', line 43 def data @parsed_response['data'] if success? end |
#error_code ⇒ Object
47 48 49 |
# File 'lib/server_density.rb', line 47 def error_code @parsed_response['error']['code'] unless success? end |
#error_message ⇒ Object
51 52 53 |
# File 'lib/server_density.rb', line 51 def @parsed_response['error']['message'] unless success? end |
#success? ⇒ Boolean
39 40 41 |
# File 'lib/server_density.rb', line 39 def success? @status == 1 end |