-
Notifications
You must be signed in to change notification settings - Fork 0
/
GetExchanges.php
42 lines (34 loc) · 1.04 KB
/
GetExchanges.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
declare(strict_types=1);
namespace PayCrypto\Resource;
use PayCrypto\CryptoMonitor;
use PayCrypto\Collection\ExchangesRecord;
use ScriptFUSION\Porter\Connector\ImportConnector;
use ScriptFUSION\Porter\Provider\Patreon\Collection\PledgeRecords;
use ScriptFUSION\Porter\Provider\Patreon\PatreonProvider;
use ScriptFUSION\Porter\Provider\Resource\ProviderResource;
class GetExchanges implements ProviderResource
{
private $apiKey;
public function __construct(string $apiKey)
{
$this->apiKey = $apiKey;
}
public function getProviderClassName(): string
{
return CryptoMonitor::class;
}
public function fetch(ImportConnector $connector): \Iterator
{
$response = \json_decode(
(string) $connector->fetch(
CryptoMonitor::buildExchangeApiUrl(
"v1/exchanges"
)
),
true
);
$exchanges = new \ArrayIterator($response);
return new ExchangesRecord($exchanges, count($exchanges), $this);
}
}