1 | <?php namespace Arcanedev\Currencies\Services; |
||
14 | abstract class AbstractApiService extends AbstractService |
||
15 | { |
||
16 | /* ------------------------------------------------------------------------------------------------ |
||
17 | | Properties |
||
18 | | ------------------------------------------------------------------------------------------------ |
||
19 | */ |
||
20 | /** |
||
21 | * The base URL. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $baseUrl = ''; |
||
26 | |||
27 | /** |
||
28 | * @var \Arcanedev\Currencies\Contracts\Http\Client |
||
29 | */ |
||
30 | protected $client; |
||
31 | |||
32 | /* ------------------------------------------------------------------------------------------------ |
||
33 | | Constructor |
||
34 | | ------------------------------------------------------------------------------------------------ |
||
35 | */ |
||
36 | /** |
||
37 | * AbstractApiService constructor. |
||
38 | * |
||
39 | * @param \Arcanedev\Currencies\Contracts\CurrencyManager $manager |
||
40 | * @param \Arcanedev\Currencies\Contracts\Http\Client $client |
||
41 | * @param \Illuminate\Contracts\Cache\Repository $cache |
||
42 | * @param array $configs |
||
43 | */ |
||
44 | 96 | public function __construct( |
|
55 | |||
56 | /* ------------------------------------------------------------------------------------------------ |
||
57 | | Main Functions |
||
58 | | ------------------------------------------------------------------------------------------------ |
||
59 | */ |
||
60 | /** |
||
61 | * Get currencies rates. |
||
62 | * |
||
63 | * @return \Arcanedev\Currencies\Entities\RateCollection |
||
64 | */ |
||
65 | 48 | public function rates() |
|
79 | |||
80 | /* ------------------------------------------------------------------------------------------------ |
||
81 | | Other Functions |
||
82 | | ------------------------------------------------------------------------------------------------ |
||
83 | */ |
||
84 | /** |
||
85 | * Make an API request. |
||
86 | * |
||
87 | * @param string $from |
||
88 | * @param array $to |
||
89 | * |
||
90 | * @return \Arcanedev\Currencies\Entities\RateCollection |
||
91 | */ |
||
92 | abstract protected function request($from, array $to = []); |
||
93 | } |
||
94 |