Class: VSTS::APIResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/vsts/api_response.rb

Overview

VSTS API response

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, response) ⇒ APIResponse

Constructor

Parameters:

  • request (Hash)

    the hash that was passed to RestClient as the request descriptor

  • response (RestClient::Response)


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

#bodyObject

Returns the value of attribute body.



7
8
9
# File 'lib/vsts/api_response.rb', line 7

def body
  @body
end

#codeObject

Returns the value of attribute code.



7
8
9
# File 'lib/vsts/api_response.rb', line 7

def code
  @code
end

#parsedObject

Returns the value of attribute parsed.



7
8
9
# File 'lib/vsts/api_response.rb', line 7

def parsed
  @parsed
end

#requestObject

Returns the value of attribute request.



7
8
9
# File 'lib/vsts/api_response.rb', line 7

def request
  @request
end