Skip to content

Commit 536c67f

Browse files
committed
Update README
1 parent 0530aed commit 536c67f

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

README.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ If the package doesn't fit your needs, you might take a look at the alternative
3939
* [Task lists](#task-lists)
4040
* [Lending requests](#lending-requests)
4141
* [Requested resources (pick from shelf)](#requested-resources-pick-from-shelf)
42+
* [Jobs](#jobs)
43+
* [Listing jobs](#listing-jobs)
44+
* [Retrieving information about a specific job](#retrieving-information-about-a-specific-job)
45+
* [Submitting a job](#submitting-a-job)
4246
* [Automatic retries on errors](#automatic-retries-on-errors)
4347
* [Laravel integration](#laravel-integration)
4448
* [Customizing the HTTP client stack](#customizing-the-http-client-stack)
@@ -101,8 +105,11 @@ $alma->nz->setSruClient(new SruClient(
101105

102106
## Quick intro
103107

104-
The `$alma` object provides `$alma->bibs` (for Bibs, Holdings, Items), `$alma->users` (for Users),
105-
`$alma->analytics` (for Analytics reports), `$alma->libraries` (for Libraries).
108+
The library provides access to Bibs, Holdings and Items
109+
through `$alma->bibs`, Users (`$alma->users`), Analytics reports
110+
(`$alma->analytics`), Libraries (`$alma->libraries`), Task Lists (`$alma->taskLists`) and Jobs (`$alma->jobs`).
111+
112+
To fetch a Bib record:
106113

107114
```php
108115
$bib = $alma->bibs->get('990114012304702204');
@@ -485,7 +492,7 @@ Note: As of 2018-10-13, there is a bug preventing you from retrieving more than
485492
### Requested resources (pick from shelf)
486493

487494
```php
488-
$library = $alma->conf->libraries['LIBRARY_CODE'];
495+
$library = $alma->libraries['LIBRARY_CODE'];
489496
$requests = $alma->taskLists->getRequestedResources($library, 'DEFAULT_CIRC_DESK', [
490497
'printed' => 'N',
491498
]);
@@ -494,6 +501,35 @@ foreach ($requests as $request) {
494501
}
495502
```
496503

504+
## Jobs
505+
506+
### Listing jobs
507+
508+
To list all jobs and their instances:
509+
510+
```php
511+
foreach ($alma->jobs as $job) {
512+
echo "[{$job->id}] {$job->name} / {$job->description}\n";
513+
foreach ($job->instances as $instance) {
514+
echo " [{$instance->id}] Status: {$instance->status->desc}\n";
515+
}
516+
}
517+
```
518+
519+
This is a generator, so you can start processing results before the full list has been retrieved (it fetches jobs in batches of 10).
520+
521+
### Retrieving information about a specific job
522+
523+
```php
524+
$job = $alma->jobs['M43'];
525+
```
526+
527+
### Submitting a job
528+
529+
```php
530+
$instance = $alma->jobs['M43']->submit();
531+
```
532+
497533
## Automatic retries on errors
498534

499535
If the client receives a 429 (rate limiting) response from Alma, it will sleep for a short time (0.5 seconds by default)

0 commit comments

Comments
 (0)