1 | <?php |
||
17 | abstract class AbstractEndpoint |
||
18 | { |
||
19 | |||
20 | /** |
||
21 | * Output format (json or xml) |
||
22 | */ |
||
23 | const OUTPUT_FORMAT = 'xml'; |
||
24 | |||
25 | /** |
||
26 | * Guzzle client |
||
27 | * |
||
28 | * @var Client $client |
||
29 | */ |
||
30 | private $client; |
||
31 | |||
32 | /** |
||
33 | * Serializer instance |
||
34 | * |
||
35 | * @var Serializer $serializer |
||
36 | */ |
||
37 | protected $serializer; |
||
38 | |||
39 | /** |
||
40 | * @param Client $client |
||
41 | * @param Serializer $serializer |
||
42 | */ |
||
43 | public function __construct(Client $client, Serializer $serializer) |
||
48 | |||
49 | /** |
||
50 | * Calls Redtubes API and process the response |
||
51 | * |
||
52 | * @param $method |
||
53 | * @param Filterable|null $filter |
||
54 | * @param string $format |
||
55 | * |
||
56 | * @return string |
||
57 | * @throws \RuntimeException |
||
58 | */ |
||
59 | protected function call($method, Filterable $filter = null, $format = self::OUTPUT_FORMAT) |
||
81 | |||
82 | } |
||
83 |