/** * Prepare index links so we can get started. * */ protected function prepareLinks_index() { // Call API with our default request template to get default links. $res = Dispatcher::getQuick($this->settings->resolvedIndexLink); // We have to check if we are dealing with multi institution API. // If we have more than one institution in the array, it is multi institution API. if (count($res->body->_embedded->visokaUcilista) > 1) { $this->isMultiInstitutionApi = true; } // If it is multi institution API, we will take the whole array of institutions. if ($this->isMultiInstitutionApi) { $this->index = $res->body->_embedded->visokaUcilista; } else { // Not multi institution API, we can simply use the first institution. $this->index = clone $res->body->_embedded->visokaUcilista[0]->_links; } }
public function testDispatcher() { Dispatcher::test(); }
/** * Get the resource from the provided url using custom headers. * * @param string $url URL for the resource to get. * @param array $headers Custom headers that will be used in request. * @return \stdClass|array Returned resource object/array of objects from the API */ public function getResourceByUrlUsingCustomHeaders($url, array $headers) { $response = Dispatcher::getCustom($url, $headers); // Check for _embedded property in response body or return whole body. //$resource = $this->checkEmbeddedProperty($response); return $response->body; }