Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 7b9a529

Browse files
authored
Dev/3.3.1 (#4)
* Added chunk() functionality in JsonApiFetcher * Added `getDataCollection` method & definition * Added `chunk` method & definition * Updated JsonApiFetcher to inject Collection to Closure in chunk() Collection is making on the fly, from data key from PaginatedData DTO (which contain full API response) * Updated CHANGELOG.md * v3.3.1 * Bug fixed * Bug fixed
1 parent 0d25f52 commit 7b9a529

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to `api-client` will be documented in this file
44

5+
## 3.3.1 - 2021-05-25
6+
7+
- Added access to `DataFetcher` in `JsonApiFetcher`
8+
- Added timeout
9+
510
## 3.3.0 - 2021-05-21
611

712
- Added `chunk()` method in `JsonApiFetcher`

src/JsonApiFetcher.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,20 @@ public function compose(): UrlCompose
2727
return $this->urlComposer;
2828
}
2929

30-
public function fetch(?Closure $before = null)
30+
public function makeDataFetcher(): DataFetcher
3131
{
32-
$this->callClosure($before);
33-
34-
$dataFetcher = new DataFetcher(
32+
return new DataFetcher(
3533
$this->urlComposer->get(),
3634
$this->config->getResponseDataClass(),
3735
$this->token
3836
);
37+
}
38+
39+
public function fetch(?Closure $before = null)
40+
{
41+
$this->callClosure($before);
42+
43+
$dataFetcher = $this->makeDataFetcher();
3944
$dataFetcher->fetch();
4045

4146
$results = $dataFetcher->get();

tests/Data/DataFetcherTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ protected function setUp(): void
3737
$this->obj = new DataFetcher($uri, $config->getResponseDataClass(), $token);
3838
}
3939

40+
protected function getPackageProviders($app)
41+
{
42+
return [
43+
ApiClientServiceProvider::class
44+
];
45+
}
46+
4047
/** @test */
4148
public function it_makes_http_call()
4249
{

0 commit comments

Comments
 (0)