/**
  * @param FindParametersInterface $findParameters
  *
  * @return Response
  */
 protected final function fetch(FindParametersInterface $findParameters)
 {
     try {
         $response = $this->decodeJson($this->makeHttpGetRequest($findParameters));
         return Response::createFrom($response);
     } catch (ApiHttpClientException $exception) {
         return $this->handleExceptionForFindParameters($exception, $findParameters);
     }
 }
 function it_finds_articles_by_section_for_publication_id(ApiHttpClientInterface $apiHttpClient)
 {
     $expectedArticles = ['teasers' => [['id' => 1], ['id' => 2], ['id' => 3]]];
     $path = sprintf(self::ARTICLES_FROM_SECTION_PATH_PATTERN, PublicationId::SA, self::SECTION_NAME);
     $apiHttpPathAndQuery = ApiHttpPathAndQuery::createForPath($path);
     $apiHttpClient->get($apiHttpPathAndQuery)->willReturn('{"teasers":[{"id":1},{"id":2},{"id":3}]}');
     $findParameters = FindBySectionParameters::createForPublicationIdAndSections(PublicationId::SA, [self::SECTION_NAME]);
     $this->findBySections($findParameters)->shouldBeLike(Response::createFrom($expectedArticles));
 }
 function it_finds_all_sections_for_publication_id(ApiHttpClientInterface $apiHttpClient)
 {
     $expectedResponse = ['sections' => [['title' => 'sport'], ['title' => 'kultur']]];
     $path = sprintf(self::SECTION_PATH_PATTERN, PublicationId::SA);
     $apiHttpPathAndQuery = ApiHttpPathAndQuery::createForPath($path);
     $findParameters = FindAllParameters::createForPublicationId(PublicationId::SA);
     $apiHttpClient->get($apiHttpPathAndQuery)->shouldBeCalled()->willReturn('{"sections": [{"title":"sport"},{"title":"kultur"}]}');
     $this->findAll($findParameters)->shouldBeLike(Response::createFrom($expectedResponse));
 }