Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 2.0 release #26

Merged
merged 59 commits into from
Sep 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
f326f96
Updating abstract provider with new methods
karllhughes Mar 29, 2016
5bbc1db
Allowing non-get requests
karllhughes Mar 29, 2016
5f9249a
Removing attribute trait
karllhughes Mar 29, 2016
9d9d842
More adjustment
karllhughes Mar 29, 2016
0f73731
Updating for v2
karllhughes Mar 31, 2016
139b566
Fixing tests
karllhughes Mar 31, 2016
e8d2014
Updating location of calls in attribute trait
karllhughes Mar 31, 2016
34ce249
Alphebetizing
karllhughes Mar 31, 2016
1bdd1fd
Updating tests
karllhughes Mar 31, 2016
05a1235
Moving query method to abs class
karllhughes Apr 3, 2016
87ceb4c
Merge branch 'v2' of github.com:JobBrander/jobs-common into v2
karllhughes Apr 3, 2016
227ab33
Updating tests
karllhughes Apr 3, 2016
44caf2a
Improving tests
karllhughes Apr 4, 2016
12a376b
Adding exception when required parameters are not included
karllhughes Apr 4, 2016
47b9aa3
Fixing required parameter checker
karllhughes Apr 4, 2016
89c0352
Updating changelog
karllhughes Apr 5, 2016
0f4ccb7
Updating readme provider setup instructions
karllhughes Apr 5, 2016
92374e0
Updating set method, removing call from abstract provider
karllhughes Apr 17, 2016
ee153b4
Adding method to get query parameters that have been set
karllhughes Apr 17, 2016
02655d9
Adding test for query params method
karllhughes Apr 17, 2016
cbcc006
Removing attribute trait from abstract provider
karllhughes Apr 17, 2016
c19946e
Formatting issue
karllhughes Apr 17, 2016
f0b8d64
Adding geo coordinates class from schema.org
karllhughes Apr 17, 2016
f77fba6
Adding methods to set and get lat and long to jobs
karllhughes Apr 17, 2016
d6d5d15
Adding a test
karllhughes Apr 17, 2016
99ce2e6
Adding psr 7 to docs
karllhughes Apr 17, 2016
48cf31a
Fixing setter issue, back to the attributeTrait
karllhughes Apr 17, 2016
b77d283
Whoops, method name changed
karllhughes Apr 17, 2016
1de5ba3
damn whitespace
karllhughes Apr 17, 2016
fed1b73
More cleanup of auto-gened classes
karllhughes Apr 17, 2016
fa35632
Starting move to jobapis namespace
karllhughes Aug 26, 2016
3b22faa
Renaming schema
karllhughes Aug 26, 2016
37f2510
Fixing unit tests
karllhughes Aug 26, 2016
4e439e6
Adding concrete provider, tests
karllhughes Aug 26, 2016
97f1920
Allowing setting, getting on query params
karllhughes Aug 26, 2016
99e3ec4
Concrete provider and tests implemented
karllhughes Aug 26, 2016
9af4590
Requiring default job fields
karllhughes Aug 26, 2016
63e7265
Renaming methods
karllhughes Aug 26, 2016
8adc878
Updating formatting
karllhughes Aug 27, 2016
e0fb679
Documentation updates
karllhughes Aug 27, 2016
bab4d8b
Fixing scrutinizer path
karllhughes Aug 27, 2016
89971a9
Cleaning up comments
karllhughes Aug 27, 2016
16810a8
Introducing query object
karllhughes Aug 28, 2016
1d1b85b
Adding basic Query object and concrete test
karllhughes Aug 31, 2016
3a8875f
Adding concrete provider test
karllhughes Aug 31, 2016
7f1ac01
Updating jobs provider to work with new query class
karllhughes Aug 31, 2016
87e2428
Updating jobs provider to work with new query class
karllhughes Aug 31, 2016
b459064
Updating abstract methods on job provider
karllhughes Aug 31, 2016
a7e1ad9
100% coverage on query
karllhughes Aug 31, 2016
987ae10
Fixing formatting issues
karllhughes Sep 1, 2016
a4eb799
Cleaning up formatting, more unit tests
karllhughes Sep 1, 2016
8d68e2b
More test coverage
karllhughes Sep 1, 2016
9e08b5d
Removing extra use statement from abstract query
karllhughes Sep 2, 2016
542b3cf
Updating response mock
karllhughes Sep 2, 2016
2a2b77c
Updating readme and changelog
karllhughes Sep 2, 2016
d2539cf
Fixing bug in constructor
karllhughes Sep 2, 2016
e20d667
Adding test to verify fix
karllhughes Sep 2, 2016
c220db0
Changelog
karllhughes Sep 2, 2016
3305cbd
Updating changelog, readme for v2 release
karllhughes Sep 3, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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