Skip to content

Commit

Permalink
Merge pull request #26 from jobapis/v2
Browse files Browse the repository at this point in the history
Version 2.0 release
  • Loading branch information
karllhughes committed Sep 3, 2016
2 parents 65a3d8b + 3305cbd commit 1be7164
Show file tree
Hide file tree
Showing 35 changed files with 1,226 additions and 801 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ build/
phpunit.xml
composer.lock
vendor
.idea/
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
filter:
excluded_paths: [test/*]
excluded_paths: [tests/*]
checks:
php:
code_rating: true
Expand Down
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
# Changelog
All Notable changes to `jobs-common` will be documented in this file

## 2.0.0 - 2016-09-03

### Added
- Readme updates.

## 2.0.0-beta.1 - 2016-09-02

### Fixed
- Abstract query construct method was overwriting keys with duplicate values. Array flip is dangerous like that.

## 2.0.0-beta - 2016-09-01

### Added
- Moved API parameters to new Query object.
- Improved test coverage with concrete provider and query instances.

### Deprecated
- Old method of setting query parameters via the Provider's constructor or "setX()" methods removed

## 2.0.0-alpha - 2016-04-04

### Added
- Required parameters
- Inputs as query parameter array rather than attributes on the provider object

### Deprecated
- Nothing

### Fixed
- Nothing

### Security
- Nothing

## 1.0.4 - 2015-10-28

### Added
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contributions are **welcome** and will be fully **credited**.

We accept contributions via Pull Requests on [Github](https://github.com/jobbrander/jobs-common).
We accept contributions via Pull Requests on [Github](https://github.com/jobapis/jobs-common).


## Pull Requests
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The Apache 2.0 License

Copyright 2015 Karl L. Hughes <khughes.me@gmail.com>
Copyright 2016 Karl L. Hughes <khughes.me@gmail.com>

> Licensed under the Apache License, Version 2.0 (the "License");
> you may not use this file except in compliance with the License.
Expand Down
88 changes: 47 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

## Standardizing job board API clients

[![Latest Version](https://img.shields.io/github/release/JobBrander/jobs-common.svg?style=flat-square)](https://github.com/JobBrander/jobs-common/releases)
[![Latest Version](https://img.shields.io/github/release/jobapis/jobs-common.svg?style=flat-square)](https://github.com/jobapis/jobs-common/releases)
[![Software License](https://img.shields.io/badge/license-APACHE%202.0-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://img.shields.io/travis/JobBrander/jobs-common/master.svg?style=flat-square&1)](https://travis-ci.org/JobBrander/jobs-common)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/JobBrander/jobs-common.svg?style=flat-square)](https://scrutinizer-ci.com/g/JobBrander/jobs-common/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/JobBrander/jobs-common.svg?style=flat-square)](https://scrutinizer-ci.com/g/JobBrander/jobs-common)
[![Total Downloads](https://img.shields.io/packagist/dt/jobbrander/jobs-common.svg?style=flat-square)](https://packagist.org/packages/jobbrander/jobs-common)
[![Build Status](https://img.shields.io/travis/jobapis/jobs-common/master.svg?style=flat-square&1)](https://travis-ci.org/jobapis/jobs-common)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/jobapis/jobs-common.svg?style=flat-square)](https://scrutinizer-ci.com/g/jobapis/jobs-common/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/jobapis/jobs-common.svg?style=flat-square)](https://scrutinizer-ci.com/g/jobapis/jobs-common)
[![Total Downloads](https://img.shields.io/packagist/dt/jobapis/jobs-common.svg?style=flat-square)](https://packagist.org/packages/jobapis/jobs-common)

This package makes it makes it easy to integrate job board APIs into your application. Whether you want to aggregate job board data, or supplement your site's job listings with listings from third party providers, or anything else you can dream up, this package (and the api clients listed below) can help.

This package is compliant with [PSR-1][], [PSR-2][] and [PSR-4][]. If you notice compliance oversights, please send
a patch via pull request.
This package is compliant with [PSR-1][], [PSR-2][], [PSR-4][], and [PSR-7][]. If you notice compliance oversights, please send a patch via pull request.

[PSR-1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md
[PSR-2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
[PSR-4]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md
[PSR-7]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message.md

## Requirements

Expand All @@ -28,13 +28,11 @@ The following versions of PHP are supported.
* HHVM

## Usage
```php
// Usage instructions
```
This package is not meant to be used on its own, but rather it is used by the providers listed below to access job board APIs and gather results in a standard data format. For details on creating your own job board provider, read on!

## Providers

Each job board supported has a provider that must extend this package's [AbstractProvider](https://github.com/JobBrander/jobs-common/blob/master/src/Provider/AbstractProvider.php), and implement the declared abstract methods.
Each job board supported has a provider that must extend this package's [AbstractProvider](https://github.com/jobapis/jobs-common/blob/master/src/Provider/AbstractProvider.php), and implement the declared abstract methods.

The following providers are available:

Expand All @@ -44,19 +42,19 @@ There are many job board services we support officially.

Gateway | Composer Package | Maintainer
--- | --- | ---
[Authentic Jobs](https://github.com/JobBrander/jobs-authenticjobs) | jobbrander/jobs-authenticjobs| [Steven Maguire](https://github.com/stevenmaguire)
[CareerBuilder](https://github.com/JobBrander/jobs-careerbuilder) | jobbrander/jobs-careerbuilder| [Karl Hughes](https://github.com/karllhughes)
[Careercast](https://github.com/JobBrander/jobs-careercast) | jobbrander/jobs-careercast| [Karl Hughes](https://github.com/karllhughes)
[Dice](https://github.com/JobBrander/jobs-dice) | jobbrander/jobs-dice| [Karl Hughes](https://github.com/karllhughes)
[Elance](https://github.com/JobBrander/jobs-elance) | jobbrander/jobs-elance| [Steven Maguire](https://github.com/stevenmaguire)
[Github Jobs](https://github.com/JobBrander/jobs-github) | jobbrander/jobs-github| [Steven Maguire](https://github.com/stevenmaguire)
[Govt](https://github.com/JobBrander/jobs-govt) | jobbrander/jobs-govt| [Karl Hughes](https://github.com/karllhughes)
[Indeed](https://github.com/JobBrander/jobs-indeed) | jobbrander/jobs-indeed| [Steven Maguire](https://github.com/stevenmaguire)
[Jobs2Careers](https://github.com/JobBrander/jobs-jobs2careers) | jobbrander/jobs-jobs2careers| [Karl Hughes](https://github.com/karllhughes)
[Muse](https://github.com/JobBrander/jobs-muse) | jobbrander/jobs-muse| [Karl Hughes](https://github.com/karllhughes)
[JuJu](https://github.com/JobBrander/jobs-juju) | jobbrander/jobs-juju| [Karl Hughes](https://github.com/karllhughes)
[SimplyHired](https://github.com/JobBrander/jobs-simplyhired) | jobbrander/jobs-simplyhired| [Karl Hughes](https://github.com/karllhughes)
[ZipRecruiter](https://github.com/JobBrander/jobs-ziprecruiter) | jobbrander/jobs-ziprecruiter| [Karl Hughes](https://github.com/karllhughes)
[Authentic Jobs](https://github.com/jobapis/jobs-authenticjobs) | jobapis/jobs-authenticjobs| [Steven Maguire](https://github.com/stevenmaguire)
[CareerBuilder](https://github.com/jobapis/jobs-careerbuilder) | jobapis/jobs-careerbuilder| [Karl Hughes](https://github.com/karllhughes)
[Careercast](https://github.com/jobapis/jobs-careercast) | jobapis/jobs-careercast| [Karl Hughes](https://github.com/karllhughes)
[Dice](https://github.com/jobapis/jobs-dice) | jobapis/jobs-dice| [Karl Hughes](https://github.com/karllhughes)
[Elance](https://github.com/jobapis/jobs-elance) | jobapis/jobs-elance| [Steven Maguire](https://github.com/stevenmaguire)
[Github Jobs](https://github.com/jobapis/jobs-github) | jobapis/jobs-github| [Steven Maguire](https://github.com/stevenmaguire)
[Govt](https://github.com/jobapis/jobs-govt) | jobapis/jobs-govt| [Karl Hughes](https://github.com/karllhughes)
[Indeed](https://github.com/jobapis/jobs-indeed) | jobapis/jobs-indeed| [Steven Maguire](https://github.com/stevenmaguire)
[Jobs2Careers](https://github.com/jobapis/jobs-jobs2careers) | jobapis/jobs-jobs2careers| [Karl Hughes](https://github.com/karllhughes)
[Muse](https://github.com/jobapis/jobs-muse) | jobapis/jobs-muse| [Karl Hughes](https://github.com/karllhughes)
[JuJu](https://github.com/jobapis/jobs-juju) | jobapis/jobs-juju| [Karl Hughes](https://github.com/karllhughes)
[SimplyHired](https://github.com/jobapis/jobs-simplyhired) | jobapis/jobs-simplyhired| [Karl Hughes](https://github.com/karllhughes)
[ZipRecruiter](https://github.com/jobapis/jobs-ziprecruiter) | jobapis/jobs-ziprecruiter| [Karl Hughes](https://github.com/karllhughes)

### Third party providers

Expand All @@ -72,37 +70,49 @@ Gateway | Composer Package | Maintainer

### Build your own providers

New providers can be created by cloning the layout of an existing package. When choosing a name for your package, please don’t use the `jobbrander` vendor prefix, as this implies that it is officially supported.
New providers can be created by cloning the layout of an existing package. When choosing a name for your package, please don’t use the `joabpis` vendor prefix, as this implies that it is officially supported.

You should use your own username as the vendor prefix, and prepend `jobs-` to the package name to make it clear that your package works with Jobs Client. For example, if your GitHub username was prometheus, and you were implementing the Dice.com job listing library, a good name for your composer package would be `prometheus/jobs-dice`.
You should use your own username as the vendor prefix, and prepend `jobs-` to the package name to make it clear that your package works with Jobs Common. For example, if your GitHub username were prometheus, and you were implementing the Dice.com job listing API, a good name for your composer package would be `prometheus/jobs-dice`.

#### Implementing your own provider

If you are working with a job board service not supported out-of-the-box or by an existing package, it is quite simple to implement your own. Simply extend `JobBrander\Jobs\Client\Providers\AbstractProvider` and implement the required abstract methods:
If you are working with a job board service not supported out-of-the-box or by an existing package, it is quite simple to implement your own. Simply extend `JobApis\Jobs\Client\Providers\AbstractProvider` and `JobApis\Jobs\Client\Queries\AbstractQuery` and implement the required abstract methods in each:

```php

// JobApis\Jobs\Client\Providers\AbstractProvider

abstract public function createJobObject($payload);
abstract public function getFormat();

abstract public function getDefaultResponseFields();

abstract public function getListingsPath();
abstract public function getUrl();
abstract public function getVerb();


// JobApis\Jobs\Client\Queries\AbstractQuery

abstract public function getBaseUrl();

abstract public function getKeyword();

```

Each of these abstract methods contain a docblock defining their expectations and typical behaviour. Once you have
extended this class, you can simply follow the example above using your new `Provider`.
Each of these abstract methods contain a docblock defining their expectations and typical behavior. Once you have extended these classes, you can simply follow the example above using your new `Provider`.

Each job object that is created will automatically set `source` and `query` based on the criteria passed into the provider. If you would like to customize this `source` value, your provider must implement a `getSource` method that returns a string to identify your provider's source.

For an example of each of the concrete classes you'll need to implement, see the `/tests/fixtures` folder in this repository.

#### Make your provider official

If you want to transfer your provider to the `jobbrander` GitHub organization and add it to the list of officially supported providers, please open a pull request on the jobbrander/jobs-common package. Before new providers will be accepted, they must have 100% unit test code coverage, and follow the conventions and code style used in other Jobs Client providers.
If you want to transfer your provider to the `jobapis` GitHub organization and add it to the list of officially supported providers, please open a pull request on the jobapis/jobs-common package. Before new providers will be accepted, they must have 100% unit test code coverage, and follow the conventions and code style used in other Jobs Client providers.

## Install

Via Composer

``` bash
$ composer require jobbrander/jobs-common
$ composer require jobapis/jobs-common
```

## Testing
Expand All @@ -113,18 +123,14 @@ $ ./vendor/bin/phpunit

## Contributing

Please see [CONTRIBUTING](https://github.com/jobbrander/jobs-common/blob/master/CONTRIBUTING.md) for details.

Please see [CONTRIBUTING](https://github.com/jobapis/jobs-common/blob/master/CONTRIBUTING.md) for details.

## Credits

- [Karl Hughes](https://github.com/karllhughes)
- [Steven Maguire](https://github.com/stevenmaguire)
- [All Contributors](https://github.com/jobbrander/jobs-common/contributors)

- [All Contributors](https://github.com/jobapis/jobs-common/contributors)

## License

The Apache 2.0. Please see [License File](https://github.com/jobbrander/jobs-common/blob/master/LICENSE) for more information.

:)
The Apache 2.0. Please see [License File](https://github.com/jobapis/jobs-common/blob/master/LICENSE) for more information.
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "jobbrander/jobs-common",
"name": "jobapis/jobs-common",
"type": "library",
"description": "Making it simple to integrate your application with job api providers.",
"keywords": [
"job boards",
"jobs",
"api client",
"object"
],
"homepage": "https://github.com/JobBrander/jobs-common",
"homepage": "http://jobapis.com",
"license": "Apache-2.0",
"authors": [
{
Expand All @@ -34,12 +35,13 @@
},
"autoload": {
"psr-4": {
"JobBrander\\Jobs\\Client\\": "src/"
"JobApis\\Jobs\\Client\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"JobBrander\\Jobs\\Client\\Test\\": "test/src/"
"JobApis\\Jobs\\Client\\Tests\\": "tests/src/",
"JobApis\\Jobs\\Client\\Fixtures\\": "tests/fixtures/"
}
}
}
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
</logging>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./test/</directory>
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./</directory>
<exclude>
<directory suffix=".php">./vendor</directory>
<directory suffix=".php">./test</directory>
<directory suffix=".php">./tests</directory>
</exclude>
</whitelist>
</filter>
Expand Down
8 changes: 4 additions & 4 deletions schemas/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ vendor/bin/schema generate-types ./ schemas/jobs.yml

if [ $? -eq 0 ]; then

cp -r ./JobBrander/Jobs/Client/* ./src 2> /dev/null
cp -r ./JobApis/Jobs/Client/* ./src 2> /dev/null

if [ $? -eq 0 ]; then

rm -rf ./JobBrander 2> /dev/null
rm -rf ./JobApis 2> /dev/null

if [ $? -eq 0 ]; then

echo "Created schema classes and copied to ./src"

else

echo "Failed to remove ./JobBrander/Jobs/Client directory"
echo "Failed to remove ./JobApis/Jobs/Client directory"

fi

else

echo "Failed to copy code from ./JobBrander/Jobs/Client to ./src"
echo "Failed to copy code from ./JobApis/Jobs/Client to ./src"

fi

Expand Down
8 changes: 8 additions & 0 deletions schemas/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ fieldVisibility: "protected"
# The list of types and properties we want to use
types:
DataType:
GeoCoordinates:
parent: StructuredValue
properties:
latitude: { range: "Text"}
longitude: { range: "Text"}
Intangible:
JobPosting:
parent: Thing
properties:
Expand Down Expand Up @@ -50,6 +56,7 @@ types:
Place:
properties:
address: { range: "PostalAddress"}
geo: { range: "GeoCoordinates"}
telephone: { range: "Text"}
PostalAddress:
# Disable the generation of the class hierarchy for this type
Expand All @@ -62,6 +69,7 @@ types:
postOfficeBoxNumber: ~
postalCode: ~
streetAddress: ~
StructuredValue:
Text:
# Parent class of JobPosting
Thing:
Expand Down
Loading

0 comments on commit 1be7164

Please sign in to comment.