/**
  * Pass in json decoded response here
  *
  * @param GuzzleResponseInterface $response
  * @return ResponseInterface
  */
 public function getResponse(GuzzleResponseInterface $response)
 {
     $this->validator->assert($response);
     $body = json_decode($response->getBody(), true);
     if (array_key_exists('results', $body)) {
         return new ResponseCollection($response);
     } else {
         return new Response($response);
     }
 }
 public function testNoBody()
 {
     $response = m::mock('GuzzleHttp\\Message\\ResponseInterface');
     $response->shouldReceive('getBody')->andReturn('');
     $this->validator->shouldReceive('assert')->with($response)->andThrow(new UnknownResponseException($response));
     static::setExpectedException('Graze\\Gigya\\Exceptions\\UnknownResponseException', 'The contents of the response could not be determined');
     $this->factory->getResponse($response);
 }