Class: VSTS::APIResponse
- Inherits:
-
Object
- Object
- VSTS::APIResponse
- Defined in:
- lib/vsts/api_response.rb
Overview
VSTS API response
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#code ⇒ Object
Returns the value of attribute code.
-
#parsed ⇒ Object
Returns the value of attribute parsed.
-
#request ⇒ Object
Returns the value of attribute request.
Instance Method Summary collapse
-
#initialize(request, response) ⇒ APIResponse
constructor
Constructor.
Constructor Details
#initialize(request, response) ⇒ APIResponse
Constructor
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/vsts/api_response.rb', line 13 def initialize(request, response) @request = request @code = response.code @body = response.body begin @parsed = JSON.parse(@body) rescue JSON::ParserError @parsed = nil end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
7 8 9 |
# File 'lib/vsts/api_response.rb', line 7 def body @body end |
#code ⇒ Object
Returns the value of attribute code.
7 8 9 |
# File 'lib/vsts/api_response.rb', line 7 def code @code end |
#parsed ⇒ Object
Returns the value of attribute parsed.
7 8 9 |
# File 'lib/vsts/api_response.rb', line 7 def parsed @parsed end |
#request ⇒ Object
Returns the value of attribute request.
7 8 9 |
# File 'lib/vsts/api_response.rb', line 7 def request @request end |