Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
danmichaelo committed Sep 10, 2020
1 parent 0530aed commit 536c67f
Showing 1 changed file with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ If the package doesn't fit your needs, you might take a look at the alternative
* [Task lists](#task-lists)
* [Lending requests](#lending-requests)
* [Requested resources (pick from shelf)](#requested-resources-pick-from-shelf)
* [Jobs](#jobs)
* [Listing jobs](#listing-jobs)
* [Retrieving information about a specific job](#retrieving-information-about-a-specific-job)
* [Submitting a job](#submitting-a-job)
* [Automatic retries on errors](#automatic-retries-on-errors)
* [Laravel integration](#laravel-integration)
* [Customizing the HTTP client stack](#customizing-the-http-client-stack)
Expand Down Expand Up @@ -101,8 +105,11 @@ $alma->nz->setSruClient(new SruClient(

## Quick intro

The `$alma` object provides `$alma->bibs` (for Bibs, Holdings, Items), `$alma->users` (for Users),
`$alma->analytics` (for Analytics reports), `$alma->libraries` (for Libraries).
The library provides access to Bibs, Holdings and Items
through `$alma->bibs`, Users (`$alma->users`), Analytics reports
(`$alma->analytics`), Libraries (`$alma->libraries`), Task Lists (`$alma->taskLists`) and Jobs (`$alma->jobs`).

To fetch a Bib record:

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

```php
$library = $alma->conf->libraries['LIBRARY_CODE'];
$library = $alma->libraries['LIBRARY_CODE'];
$requests = $alma->taskLists->getRequestedResources($library, 'DEFAULT_CIRC_DESK', [
'printed' => 'N',
]);
Expand All @@ -494,6 +501,35 @@ foreach ($requests as $request) {
}
```

## Jobs

### Listing jobs

To list all jobs and their instances:

```php
foreach ($alma->jobs as $job) {
echo "[{$job->id}] {$job->name} / {$job->description}\n";
foreach ($job->instances as $instance) {
echo " [{$instance->id}] Status: {$instance->status->desc}\n";
}
}
```

This is a generator, so you can start processing results before the full list has been retrieved (it fetches jobs in batches of 10).

### Retrieving information about a specific job

```php
$job = $alma->jobs['M43'];
```

### Submitting a job

```php
$instance = $alma->jobs['M43']->submit();
```

## Automatic retries on errors

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

0 comments on commit 536c67f

Please sign in to comment.