Skip to content

Commit

Permalink
Merge pull request #32 from jobapis/upgrade-multi-library
Browse files Browse the repository at this point in the history
Upgrade multi library
  • Loading branch information
karllhughes authored Dec 23, 2016
2 parents b2132ca + 70fd1cf commit 5b4da18
Show file tree
Hide file tree
Showing 13 changed files with 497 additions and 511 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ MAIL_DRIVER=mail
## Third party integrations (optional)
SENDGRID_API_KEY=
CAREERBUILDER_KEY=
CAREERJET_KEY=
INDEED_KEY=
USAJOBS_KEY=
JUJU_KEY=
Expand Down
46 changes: 0 additions & 46 deletions app/Filters/CollectionFilter.php

This file was deleted.

28 changes: 12 additions & 16 deletions app/Jobs/SearchAndNotifyUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Log;
use JobApis\Jobs\Client\JobsMulti;
use JobApis\JobsToMail\Filters\CollectionFilter;
use JobApis\JobsToMail\Filters\JobFilter;
use JobApis\JobsToMail\Filters\RecruiterFilter;
use JobApis\JobsToMail\Models\Recruiter;
use JobApis\JobsToMail\Models\Search;
Expand Down Expand Up @@ -59,32 +57,30 @@ public function __construct(Search $search)
* Collect and sort jobs from multiple APIs using the JobsMulti client.
*
* @param JobsMulti $jobsClient
* @param CollectionFilter $collectionFilter
* @param JobFilter $jobFilter
* @param RecruiterFilter $recruiterFilter
*
* @return array
*/
public function handle(
JobsMulti $jobsClient,
CollectionFilter $collectionFilter,
JobFilter $jobFilter,
RecruiterFilter $recruiterFilter
) {
// Add options for max results and age
$options = [
'maxAge' => self::MAX_DAYS_OLD,
'maxResults' => self::MAX_JOBS,
'orderBy' => 'datePosted',
'order' => 'desc',
];

// Collect jobs based on the Search keyword and location
$jobsByProvider = $jobsClient->setKeyword($this->search->keyword)
$jobs = $jobsClient->setKeyword($this->search->keyword)
->setLocation($this->search->location)
->setPage(1, self::MAX_JOBS_FROM_PROVIDER)
->getAllJobs();

// Get jobs Array from array of Collections
$jobs = $collectionFilter->getJobsFromCollections($jobsByProvider, self::MAX_JOBS_FROM_PROVIDER);

// Sort the jobs
$jobs = $jobFilter->sort($jobs, self::MAX_DAYS_OLD, self::MAX_JOBS);
->getAllJobs($options);

// Filter jobs from recruiters
$jobs = $recruiterFilter->filter($jobs, $this->search);
// Filter jobs from recruiters and convert to array
$jobs = $recruiterFilter->filter($jobs->all(), $this->search);

// Trigger notification to user
if ($jobs) {
Expand Down
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ All Notable changes to `jobs-to-mail` will be documented in this file.
- `jobs:email` command now uses Search model instead of User model for queries.
- Moved job/collection-related filters into their own folder.
- Added JS dependencies: Jquery, Bootstrap, Tether
- Support for [Jobinventory](https://github.com/jobapis/jobs-jobinventory) job board.
- Support for new job boards.
- Added timezone to .env
- Premium interest page and form.
- Upgraded to [JobsMulti v1.0](https://github.com/jobapis/jobs-multi).

### Fixed
- Plaintext email job listings were showing up as blank.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "project",
"require": {
"php": ">=7.0.0",
"jobapis/jobs-multi": "^0.6.1",
"jobapis/jobs-multi": "^1.0.1",
"laravel/framework": "5.3.*",
"league/csv": "^8.1",
"s-ichikawa/laravel-sendgrid-driver": "^1.1"
Expand Down
Loading

0 comments on commit 5b4da18

Please sign in to comment.