Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/93digital/workable-api
A PHP class to handle a Workable API request for a list of current vacancies on the platform.
https://github.com/93digital/workable-api
Last synced: about 2 months ago
JSON representation
A PHP class to handle a Workable API request for a list of current vacancies on the platform.
- Host: GitHub
- URL: https://github.com/93digital/workable-api
- Owner: 93digital
- License: mit
- Created: 2021-11-26T13:57:15.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-15T15:55:07.000Z (almost 3 years ago)
- Last Synced: 2024-09-15T04:55:31.044Z (4 months ago)
- Language: PHP
- Size: 7.81 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nine3 Workable API Class
**_v1.0.1_**
**_Authors:_** _Ahmad Al Asadi & Matt Knight_
An API class for WordPress to fetch vacancies from an account on the Workable recruitment platform. The fetched data is stored as a WordPress transient, allowing quick and easy access to the data.
## Installation
Install via composer:
```
$ composer require 93devs/nine3-workable-api:dev-master
```Then within a theme configuration file (such as `functions.php`) instantiate the class:
```php
/**
* @param string $subdomain The subdomain part of the URL of a Workable account.
* @param string $access_token An access token generated within the Workable account.
*/
$workable_api = new Nine3_Workable_Api( $subdomain, $access_token )
```## Methods
The class will set up an hourly cron job that makes the API request and stores the response as a transient automatically upon instantiation (assuming WP-Cron has not been disabled!).
However there are a handful of publicly available methods.
### Get vacancies
Returns a full list of the published vacancies on the Workable account. This will return the data saved in the transient. If the transient is empty or not found a new API request will be made.
**Usage:**
```php
/**
* @return array A multi-dimensional array containing all vacancy data.
*
* @see https://workable.readme.io/docs/jobs For available keys in each vacancy. An extra `description` key will also have been added by the class.
*/
$workable_api->get_vacancies();
```### Fetch vacancies
Forces a new API request to the Workable platform for the latest vacancies data. The transient will be updated with the returned response.
```php
/**
* @param bool $return [optional] Whether to return the fetched vacancies data.
*
* @return array A multi-dimensional array containing all vacancy data.
*
* @see https://workable.readme.io/docs/jobs For available keys in each vacancy. An extra `description` key will also have been added by the class.
*/
$workable_api->fetch_vacancies( $return = false );
```## More Info
Workable API reference: https://workable.readme.io/