1 | <?php |
||
12 | class Client |
||
13 | { |
||
14 | /** |
||
15 | * Contains cURL instance |
||
16 | * |
||
17 | * @access public |
||
18 | */ |
||
19 | public $ch; |
||
20 | |||
21 | /** |
||
22 | * Base url for the selected API. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | public $base_url; |
||
27 | |||
28 | /** |
||
29 | * Contains the authentication string |
||
30 | * |
||
31 | * @access protected |
||
32 | */ |
||
33 | protected $auth_string; |
||
34 | |||
35 | /** |
||
36 | * __construct function. |
||
37 | * |
||
38 | * Instantiate object |
||
39 | * |
||
40 | * @access public |
||
41 | * @param string $auth_string Format 'username:password' or ':apiKey' |
||
42 | * @param string $base_url The API to call. Use on of the constants. |
||
43 | * @throws Exception |
||
44 | */ |
||
45 | 7 | public function __construct($auth_string = '', $base_url = Constants::API_URL) |
|
61 | |||
62 | /** |
||
63 | * Shutdown function. |
||
64 | * |
||
65 | * Closes the current cURL connection |
||
66 | * |
||
67 | * @access public |
||
68 | */ |
||
69 | public function shutdown() |
||
75 | |||
76 | /** |
||
77 | * authenticate function. |
||
78 | * |
||
79 | * Create a cURL instance with authentication headers |
||
80 | * |
||
81 | * @access public |
||
82 | */ |
||
83 | 7 | protected function authenticate() |
|
115 | } |
||
116 |