Class: DeployGate::Response
- Inherits:
-
Object
- Object
- DeployGate::Response
- Defined in:
- lib/deploygate/deploygate_client.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #body ⇒ Object
-
#initialize(res) ⇒ Response
constructor
A new instance of Response.
- #results ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(res) ⇒ Response
Returns a new instance of Response.
39 40 41 |
# File 'lib/deploygate/deploygate_client.rb', line 39 def initialize(res) @res = res end |
Instance Method Details
#[](name) ⇒ Object
55 56 57 |
# File 'lib/deploygate/deploygate_client.rb', line 55 def [](name) body[name] end |
#body ⇒ Object
47 48 49 |
# File 'lib/deploygate/deploygate_client.rb', line 47 def body @body ||= JSON.parse(@res.body) end |
#results ⇒ Object
51 52 53 |
# File 'lib/deploygate/deploygate_client.rb', line 51 def results @results ||= body['results'] end |
#success? ⇒ Boolean
43 44 45 |
# File 'lib/deploygate/deploygate_client.rb', line 43 def success? @res.code == '200' end |