1 | <?php |
||
35 | class API extends BaseModel { |
||
36 | |||
37 | /** |
||
38 | * Base url for making api requests |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $base_url = ''; |
||
42 | |||
43 | /** |
||
44 | * The Guzzle http client object |
||
45 | * @var object |
||
46 | */ |
||
47 | protected $client; |
||
48 | |||
49 | /** |
||
50 | * Cookie jar object for api requests |
||
51 | * @var object |
||
52 | */ |
||
53 | protected $cookieJar; |
||
54 | |||
55 | /** |
||
56 | * Constructor |
||
57 | * |
||
58 | * @param ContainerInterface $container |
||
59 | */ |
||
60 | public function __construct(ContainerInterface $container) |
||
65 | |||
66 | /** |
||
67 | * Set up the class properties |
||
68 | * |
||
69 | * @return void |
||
70 | */ |
||
71 | protected function init() |
||
89 | |||
90 | /** |
||
91 | * Magic methods to call guzzle api client |
||
92 | * |
||
93 | * @param string $method |
||
94 | * @param array $args |
||
95 | * @return ResponseInterface|null |
||
96 | */ |
||
97 | public function __call($method, $args) |
||
117 | |||
118 | /** |
||
119 | * Attempt login via the api |
||
120 | * |
||
121 | * @codeCoverageIgnore |
||
122 | * @param string $username |
||
123 | * @param string $password |
||
124 | * @return string|false |
||
125 | */ |
||
126 | public function authenticate($username, $password) |
||
142 | } |
||
143 | // End of BaseApiModel.php |