| @@ 14-63 (lines=50) @@ | ||
| 11 | /** |
|
| 12 | * Iterable collection of Jobs. |
|
| 13 | */ |
|
| 14 | class Jobs extends SimplePaginatedList implements \ArrayAccess, \Countable, \Iterator |
|
| 15 | { |
|
| 16 | use ReadOnlyArrayAccess; |
|
| 17 | use IterableCollection; |
|
| 18 | ||
| 19 | /** |
|
| 20 | * Job constructor. |
|
| 21 | * |
|
| 22 | * @param Client $client |
|
| 23 | */ |
|
| 24 | public function __construct(Client $client) |
|
| 25 | { |
|
| 26 | parent::__construct($client, 'job'); |
|
| 27 | } |
|
| 28 | ||
| 29 | /** |
|
| 30 | * Get a single job by job_id. |
|
| 31 | * |
|
| 32 | * @param string $job_id |
|
| 33 | * |
|
| 34 | * @return Job |
|
| 35 | */ |
|
| 36 | public function get($job_id) |
|
| 37 | { |
|
| 38 | return Job::make($this->client, $job_id); |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * Convert a data element to a resource object. |
|
| 43 | * |
|
| 44 | * @param $data |
|
| 45 | * |
|
| 46 | * @return Job |
|
| 47 | */ |
|
| 48 | protected function convertToResource($data) |
|
| 49 | { |
|
| 50 | return Job::make($this->client, $data->id) |
|
| 51 | ->init($data); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * Generate the base URL for this resource. |
|
| 56 | * |
|
| 57 | * @return string |
|
| 58 | */ |
|
| 59 | protected function urlBase() |
|
| 60 | { |
|
| 61 | return '/conf/jobs'; |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| @@ 13-62 (lines=50) @@ | ||
| 10 | /** |
|
| 11 | * Iterable collection of Library resources. |
|
| 12 | */ |
|
| 13 | class Libraries extends LazyResourceList implements \ArrayAccess, \Countable, \Iterator |
|
| 14 | { |
|
| 15 | use ReadOnlyArrayAccess; |
|
| 16 | use IterableCollection; |
|
| 17 | ||
| 18 | /** |
|
| 19 | * Locations constructor. |
|
| 20 | * |
|
| 21 | * @param Client $client |
|
| 22 | */ |
|
| 23 | public function __construct(Client $client) |
|
| 24 | { |
|
| 25 | parent::__construct($client, 'library'); |
|
| 26 | } |
|
| 27 | ||
| 28 | /** |
|
| 29 | * Get a single library by its library code. |
|
| 30 | * |
|
| 31 | * @param string $code |
|
| 32 | * |
|
| 33 | * @return Library |
|
| 34 | */ |
|
| 35 | public function get($code) |
|
| 36 | { |
|
| 37 | return Library::make($this->client, $code); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * Convert a data element to a resource object. |
|
| 42 | * |
|
| 43 | * @param $data |
|
| 44 | * |
|
| 45 | * @return Library |
|
| 46 | */ |
|
| 47 | protected function convertToResource($data) |
|
| 48 | { |
|
| 49 | return Library::make($this->client, $data->code) |
|
| 50 | ->init($data); |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * Generate the base URL for this resource. |
|
| 55 | * |
|
| 56 | * @return string |
|
| 57 | */ |
|
| 58 | protected function urlBase() |
|
| 59 | { |
|
| 60 | return '/conf/libraries'; |
|
| 61 | } |
|
| 62 | } |
|
| 63 | ||