Class: OsCtl::Client::Response
- Inherits:
-
Object
- Object
- OsCtl::Client::Response
- Defined in:
- lib/osctl/client.rb
Instance Method Summary collapse
- #[](k) ⇒ Object
- #data ⇒ Object
- #each ⇒ Object
- #error? ⇒ Boolean
-
#initialize(resp) ⇒ Response
constructor
A new instance of Response.
- #message ⇒ Object
- #ok? ⇒ Boolean
- #update? ⇒ Boolean
Constructor Details
#initialize(resp) ⇒ Response
Returns a new instance of Response.
11 12 13 |
# File 'lib/osctl/client.rb', line 11 def initialize(resp) @resp = resp end |
Instance Method Details
#[](k) ⇒ Object
35 36 37 |
# File 'lib/osctl/client.rb', line 35 def [](k) data[k] end |
#data ⇒ Object
31 32 33 |
# File 'lib/osctl/client.rb', line 31 def data @resp[:response] end |
#each ⇒ Object
39 40 41 |
# File 'lib/osctl/client.rb', line 39 def each(&) data.each(&) end |
#error? ⇒ Boolean
19 20 21 |
# File 'lib/osctl/client.rb', line 19 def error? !ok? end |
#message ⇒ Object
27 28 29 |
# File 'lib/osctl/client.rb', line 27 def update? ? @resp[:progress] : @resp[:message] end |
#ok? ⇒ Boolean
15 16 17 |
# File 'lib/osctl/client.rb', line 15 def ok? @resp[:status] == true end |
#update? ⇒ Boolean
23 24 25 |
# File 'lib/osctl/client.rb', line 23 def update? ok? && @resp.has_key?(:progress) end |