1 | <?php namespace Arcanedev\Currencies\Services; |
||
12 | class OpenExchangeRatesService extends AbstractService |
||
13 | { |
||
14 | /* ------------------------------------------------------------------------------------------------ |
||
15 | | Properties |
||
16 | | ------------------------------------------------------------------------------------------------ |
||
17 | */ |
||
18 | /** |
||
19 | * The base URL. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $baseUrl = 'http://openexchangerates.org/api'; |
||
24 | |||
25 | /** |
||
26 | * The API ID. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $apiId; |
||
31 | |||
32 | /** |
||
33 | * The Pro Plan. |
||
34 | * |
||
35 | * @var bool |
||
36 | */ |
||
37 | protected $proPlan = false; |
||
38 | |||
39 | /* ------------------------------------------------------------------------------------------------ |
||
40 | | Getters & Setters |
||
41 | | ------------------------------------------------------------------------------------------------ |
||
42 | */ |
||
43 | /** |
||
44 | * Set the configs. |
||
45 | * |
||
46 | * @param array $configs |
||
47 | */ |
||
48 | 60 | protected function setProviderConfigs(array $configs) |
|
53 | |||
54 | /** |
||
55 | * Get the API ID. |
||
56 | * |
||
57 | * @return string |
||
58 | * |
||
59 | * @throws \Arcanedev\Currencies\Exceptions\ApiException |
||
60 | */ |
||
61 | 24 | private function getAppId() |
|
69 | |||
70 | /** |
||
71 | * Get cache key. |
||
72 | * |
||
73 | * @return string |
||
74 | */ |
||
75 | protected function getCacheKey() |
||
79 | |||
80 | /* ------------------------------------------------------------------------------------------------ |
||
81 | | Main Functions |
||
82 | | ------------------------------------------------------------------------------------------------ |
||
83 | */ |
||
84 | /** |
||
85 | * Make an API request. |
||
86 | * |
||
87 | * @param string $from |
||
88 | * @param array $to |
||
89 | * |
||
90 | * @return array |
||
91 | * |
||
92 | * @throws \Arcanedev\Currencies\Exceptions\ApiException |
||
93 | */ |
||
94 | 24 | protected function request($from, array $to = []) |
|
108 | } |
||
109 |