diff --git a/src/Client.php b/src/Client.php index d3b1714..1bd16d2 100644 --- a/src/Client.php +++ b/src/Client.php @@ -24,6 +24,7 @@ use Scriptotek\Alma\Conf\Jobs; use Scriptotek\Alma\Conf\Libraries; use Scriptotek\Alma\Conf\Library; +use Scriptotek\Alma\Conf\CodeTables; use Scriptotek\Alma\Exception\ClientException as AlmaClientException; use Scriptotek\Alma\Exception\InvalidApiKey; use Scriptotek\Alma\Exception\MaxNumberOfAttemptsExhausted; @@ -103,6 +104,11 @@ class Client */ public $jobs; + /** + * @var CodeTables + */ + public $codetables; + /** * @var TaskLists */ @@ -152,6 +158,7 @@ public function __construct( $this->conf = new Conf($this); $this->libraries = $this->conf->libraries; // shortcut $this->jobs = $this->conf->jobs; // shortcut + $this->codetables = $this->conf->codetables; // shortcut $this->taskLists = new TaskLists($this); diff --git a/src/Conf/CodeTable.php b/src/Conf/CodeTable.php new file mode 100644 index 0000000..b7ce871 --- /dev/null +++ b/src/Conf/CodeTable.php @@ -0,0 +1,49 @@ +code = $code; + } + + /** + * Check if we have the full representation of our data object. + * + * @param \stdClass $data + * + * @return bool + */ + protected function isInitialized($data) + { + return isset($data->name); + } + + /** + * Generate the base URL for this resource. + * + * @return string + */ + protected function urlBase() + { + return "/conf/code-tables/{$this->code}"; + } +} diff --git a/src/Conf/CodeTables.php b/src/Conf/CodeTables.php new file mode 100644 index 0000000..d0c853b --- /dev/null +++ b/src/Conf/CodeTables.php @@ -0,0 +1,38 @@ +client = $client; + } + + /** + * Get a CodeTable by identifier + * + * @param $code The identifier of a CodeTable + * + * @return CodeTable + */ + public function get($code) + { + return CodeTable::make($this->client, $code); + } +} diff --git a/src/Conf/Conf.php b/src/Conf/Conf.php index 65d44e3..4a7b1cb 100644 --- a/src/Conf/Conf.php +++ b/src/Conf/Conf.php @@ -12,5 +12,6 @@ public function __construct(Client $client) $this->client = $client; $this->libraries = new Libraries($client); $this->jobs = new Jobs($client); + $this->codetables = new CodeTables($client); } }