hawatel_search_jobs 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.codeclimate.yml +18 -17
- data/.gitignore +11 -11
- data/.rspec +2 -2
- data/.rubocop.yml +1169 -1169
- data/.travis.yml +6 -6
- data/CODE_OF_CONDUCT.md +13 -13
- data/CONTRIBUTING.md +69 -69
- data/Gemfile +4 -4
- data/LICENSE.txt +21 -21
- data/README.md +152 -152
- data/Rakefile +6 -6
- data/hawatel_search_jobs.gemspec +32 -32
- data/lib/hawatel_search_jobs.rb +64 -64
- data/lib/hawatel_search_jobs/api.rb +9 -9
- data/lib/hawatel_search_jobs/api/careerbuilder.rb +169 -169
- data/lib/hawatel_search_jobs/api/careerjet.rb +126 -126
- data/lib/hawatel_search_jobs/api/indeed.rb +157 -157
- data/lib/hawatel_search_jobs/api/reed.rb +185 -185
- data/lib/hawatel_search_jobs/client.rb +172 -165
- data/lib/hawatel_search_jobs/version.rb +1 -1
- data/spec/careerbuilder_spec.rb +82 -86
- data/spec/careerjet_spec.rb +58 -58
- data/spec/client_spec.rb +87 -61
- data/spec/indeed_spec.rb +59 -61
- data/spec/reed_spec.rb +77 -80
- data/spec/spec_helper.rb +2 -2
- data/spec/xing_spec.rb +46 -47
- metadata +2 -2
data/.travis.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.0.0
|
4
|
-
- 2.1.0
|
5
|
-
- 2.2.1
|
6
|
-
- 2.2.4
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.0.0
|
4
|
+
- 2.1.0
|
5
|
+
- 2.2.1
|
6
|
+
- 2.2.4
|
7
7
|
before_install: gem install bundler -v 1.10.6
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
# Contributor Code of Conduct
|
2
|
-
|
3
|
-
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
-
|
5
|
-
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
-
|
7
|
-
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
-
|
9
|
-
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
-
|
11
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
-
|
13
|
-
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/CONTRIBUTING.md
CHANGED
@@ -1,70 +1,70 @@
|
|
1
|
-
# Contributing
|
2
|
-
|
3
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/Hawatel/hawatel_search_jobs. This project is intended to be a safe, welcoming space for collaboration, and contributors.
|
4
|
-
|
5
|
-
1. [Fork](https://help.github.com/articles/fork-a-repo/) the project, clone your fork,
|
6
|
-
and configure the remotes:
|
7
|
-
|
8
|
-
```sh
|
9
|
-
# Clone your fork of the repo into the current directory
|
10
|
-
git clone https://github.com/<your-username>/hawatel_search_jobs
|
11
|
-
# Navigate to the newly cloned directory
|
12
|
-
cd hawatel_search_jobs
|
13
|
-
# Assign the original repo to a remote called "upstream"
|
14
|
-
git remote add upstream https://github.com/Hawatel/hawatel_search_jobs
|
15
|
-
```
|
16
|
-
|
17
|
-
2. If you cloned a while ago, get the latest changes from upstream:
|
18
|
-
|
19
|
-
```bash
|
20
|
-
git checkout master
|
21
|
-
git pull upstream master
|
22
|
-
```
|
23
|
-
|
24
|
-
3. Create a new topic branch (off of `master`) to contain your feature, change,
|
25
|
-
or fix.
|
26
|
-
|
27
|
-
**IMPORTANT**: Making changes in `master` is discouraged. You should always
|
28
|
-
keep your local `master` in sync with upstream `master` and make your
|
29
|
-
changes in topic branches.
|
30
|
-
|
31
|
-
```sh
|
32
|
-
git checkout -b <topic-branch-name>
|
33
|
-
```
|
34
|
-
|
35
|
-
4. Commit your changes in logical chunks. Keep your commit messages organized,
|
36
|
-
with a short description in the first line and more detailed information on
|
37
|
-
the following lines. Feel free to use Git's
|
38
|
-
[interactive rebase](https://help.github.com/articles/about-git-rebase/)
|
39
|
-
feature to tidy up your commits before making them public.
|
40
|
-
|
41
|
-
5. Make sure all the tests are still passing.
|
42
|
-
|
43
|
-
```sh
|
44
|
-
rake
|
45
|
-
```
|
46
|
-
|
47
|
-
6. Push your topic branch up to your fork:
|
48
|
-
|
49
|
-
```sh
|
50
|
-
git push origin <topic-branch-name>
|
51
|
-
```
|
52
|
-
|
53
|
-
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
|
54
|
-
with a clear title and description.
|
55
|
-
|
56
|
-
8. If you haven't updated your pull request for a while, you should consider
|
57
|
-
rebasing on master and resolving any conflicts.
|
58
|
-
|
59
|
-
**IMPORTANT**: _Never ever_ merge upstream `master` into your branches. You
|
60
|
-
should always `git rebase` on `master` to bring your changes up to date when
|
61
|
-
necessary.
|
62
|
-
|
63
|
-
```sh
|
64
|
-
git checkout master
|
65
|
-
git pull upstream master
|
66
|
-
git checkout <your-topic-branch>
|
67
|
-
git rebase master
|
68
|
-
```
|
69
|
-
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Hawatel/hawatel_search_jobs. This project is intended to be a safe, welcoming space for collaboration, and contributors.
|
4
|
+
|
5
|
+
1. [Fork](https://help.github.com/articles/fork-a-repo/) the project, clone your fork,
|
6
|
+
and configure the remotes:
|
7
|
+
|
8
|
+
```sh
|
9
|
+
# Clone your fork of the repo into the current directory
|
10
|
+
git clone https://github.com/<your-username>/hawatel_search_jobs
|
11
|
+
# Navigate to the newly cloned directory
|
12
|
+
cd hawatel_search_jobs
|
13
|
+
# Assign the original repo to a remote called "upstream"
|
14
|
+
git remote add upstream https://github.com/Hawatel/hawatel_search_jobs
|
15
|
+
```
|
16
|
+
|
17
|
+
2. If you cloned a while ago, get the latest changes from upstream:
|
18
|
+
|
19
|
+
```bash
|
20
|
+
git checkout master
|
21
|
+
git pull upstream master
|
22
|
+
```
|
23
|
+
|
24
|
+
3. Create a new topic branch (off of `master`) to contain your feature, change,
|
25
|
+
or fix.
|
26
|
+
|
27
|
+
**IMPORTANT**: Making changes in `master` is discouraged. You should always
|
28
|
+
keep your local `master` in sync with upstream `master` and make your
|
29
|
+
changes in topic branches.
|
30
|
+
|
31
|
+
```sh
|
32
|
+
git checkout -b <topic-branch-name>
|
33
|
+
```
|
34
|
+
|
35
|
+
4. Commit your changes in logical chunks. Keep your commit messages organized,
|
36
|
+
with a short description in the first line and more detailed information on
|
37
|
+
the following lines. Feel free to use Git's
|
38
|
+
[interactive rebase](https://help.github.com/articles/about-git-rebase/)
|
39
|
+
feature to tidy up your commits before making them public.
|
40
|
+
|
41
|
+
5. Make sure all the tests are still passing.
|
42
|
+
|
43
|
+
```sh
|
44
|
+
rake
|
45
|
+
```
|
46
|
+
|
47
|
+
6. Push your topic branch up to your fork:
|
48
|
+
|
49
|
+
```sh
|
50
|
+
git push origin <topic-branch-name>
|
51
|
+
```
|
52
|
+
|
53
|
+
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
|
54
|
+
with a clear title and description.
|
55
|
+
|
56
|
+
8. If you haven't updated your pull request for a while, you should consider
|
57
|
+
rebasing on master and resolving any conflicts.
|
58
|
+
|
59
|
+
**IMPORTANT**: _Never ever_ merge upstream `master` into your branches. You
|
60
|
+
should always `git rebase` on `master` to bring your changes up to date when
|
61
|
+
necessary.
|
62
|
+
|
63
|
+
```sh
|
64
|
+
git checkout master
|
65
|
+
git pull upstream master
|
66
|
+
git checkout <your-topic-branch>
|
67
|
+
git rebase master
|
68
|
+
```
|
69
|
+
|
70
70
|
Thank you for your contributions!
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in hawatel_search_jobs.gemspec
|
4
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in hawatel_search_jobs.gemspec
|
4
|
+
gemspec
|
data/LICENSE.txt
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2016 Daniel Iwaniuk
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Daniel Iwaniuk
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,152 +1,152 @@
|
|
1
|
-
[](https://travis-ci.org/Hawatel/hawatel_search_jobs)
|
2
|
-
[](https://codeclimate.com/github/Hawatel/hawatel_search_jobs)
|
3
|
-
[](http://inch-ci.org/github/Hawatel/hawatel_search_jobs)
|
4
|
-
[](https://badge.fury.io/rb/hawatel_search_jobs)
|
5
|
-
[](https://gemnasium.com/Hawatel/hawatel_search_jobs)
|
6
|
-
|
7
|
-
# Hawatel Search Jobs
|
8
|
-
|
9
|
-
Hawatel_search_jobs, it is gem which provides ease access to API from popular job websites to get current job offers. At this moment, supported backends are indeed.com, careerjet.com, xing.com, careerbuilder.com and reed.co.uk.
|
10
|
-
|
11
|
-
Before you can start using the gem, you need have an accounts/tokens for each portal where is required by API.
|
12
|
-
|
13
|
-
## Installation
|
14
|
-
|
15
|
-
Add this line to your application's Gemfile:
|
16
|
-
|
17
|
-
```ruby
|
18
|
-
gem 'hawatel_search_jobs'
|
19
|
-
```
|
20
|
-
|
21
|
-
And then execute:
|
22
|
-
|
23
|
-
$ bundle
|
24
|
-
|
25
|
-
Or install it yourself as:
|
26
|
-
|
27
|
-
$ gem install hawatel_search_jobs
|
28
|
-
|
29
|
-
## Usage
|
30
|
-
|
31
|
-
#### How to configure access to search engine APIs
|
32
|
-
```ruby
|
33
|
-
HawatelSearchJobs.configure do |config|
|
34
|
-
config.indeed[:activated] = true
|
35
|
-
config.indeed[:api] = 'api.indeed.com'
|
36
|
-
config.indeed[:version] = '2'
|
37
|
-
config.indeed[:publisher] = 'secret-key'
|
38
|
-
|
39
|
-
config.xing[:activated] = true
|
40
|
-
config.xing[:consumer_key] = 'secret-key'
|
41
|
-
config.xing[:consumer_secret] = 'secret-key'
|
42
|
-
config.xing[:oauth_token] = 'secret-key'
|
43
|
-
config.xing[:oauth_token_secret] = 'secret-key'
|
44
|
-
|
45
|
-
config.reed[:activated] = true
|
46
|
-
config.reed[:api] = 'reed.co.uk/api'
|
47
|
-
config.reed[:clientid] = 'secret-key'
|
48
|
-
config.reed[:version] = '1.0'
|
49
|
-
|
50
|
-
config.careerbuilder[:activated] = true
|
51
|
-
config.careerbuilder[:api] = 'api.careerbuilder.com'
|
52
|
-
config.careerbuilder[:clientid] = 'secret-key'
|
53
|
-
config.careerbuilder[:version] = 'v2'
|
54
|
-
|
55
|
-
config.careerjet[:activated] = true
|
56
|
-
config.careerjet[:api] = 'public.api.careerjet.net'
|
57
|
-
end
|
58
|
-
```
|
59
|
-
|
60
|
-
#### Where to get a secret-key
|
61
|
-
1. Indeed: http://www.indeed.com/jsp/apiinfo.jsp
|
62
|
-
2. Xing: https://dev.xing.com
|
63
|
-
3. Reed: https://www.reed.co.uk/developers/jobseeker
|
64
|
-
4. Careerbuilder: http://developer.careerbuilder.com
|
65
|
-
5. Careerjet: secret-key is no needed (http://www.careerjet.com/partners/api/)
|
66
|
-
|
67
|
-
#### Get first page of job offers
|
68
|
-
There are two ways to read the returned job offers.
|
69
|
-
|
70
|
-
+ Returned job offers by search_jobs method:
|
71
|
-
```ruby
|
72
|
-
client = HawatelSearchJobs::Client.new
|
73
|
-
result = client.search_jobs({:keywords => 'ruby'})
|
74
|
-
p result[:indeed]
|
75
|
-
p result[:xing]
|
76
|
-
p result[:reed]
|
77
|
-
p result[:careerbuilder]
|
78
|
-
p result[:careerjet]
|
79
|
-
```
|
80
|
-
|
81
|
-
+ Access to the instance variable jobs_table.
|
82
|
-
Instance variable *jobs_table* always has last returned job offers.
|
83
|
-
```ruby
|
84
|
-
client = HawatelSearchJobs::Client.new
|
85
|
-
client.search_jobs({:keywords => 'ruby'})
|
86
|
-
p client.jobs_table
|
87
|
-
```
|
88
|
-
|
89
|
-
Each API has a limit of returned records. For consistency, each API returns maximum `25` records.
|
90
|
-
|
91
|
-
#### Get next page of job offers
|
92
|
-
```ruby
|
93
|
-
client = HawatelSearchJobs::Client.new
|
94
|
-
client.search_jobs({:keywords => 'ruby'})
|
95
|
-
p client.next
|
96
|
-
```
|
97
|
-
|
98
|
-
#### Get all pages of job offers
|
99
|
-
```ruby
|
100
|
-
client = HawatelSearchJobs::Client.new
|
101
|
-
client.search_jobs({:keywords => 'ruby'})
|
102
|
-
|
103
|
-
job_offers = Array.new
|
104
|
-
|
105
|
-
|
106
|
-
job_offers << client.jobs_table
|
107
|
-
end
|
108
|
-
```
|
109
|
-
If keywords will be too general probably each API will return loads of data and then a daily limit for an API provider can be exceeded.
|
110
|
-
Reed about your daily limit for each API on the provider side.
|
111
|
-
|
112
|
-
#### How many job offers were found
|
113
|
-
```ruby
|
114
|
-
client = HawatelSearchJobs::Client.new
|
115
|
-
client.search_jobs({:keywords => 'ruby'})
|
116
|
-
p client.count # for all APIs
|
117
|
-
p client.count('indeed') # for a particular API
|
118
|
-
```
|
119
|
-
The `client.count` returns count of total results for each APIs which can be returned to you if you use `client.next` method.
|
120
|
-
|
121
|
-
## Structure of job offers table
|
122
|
-
Below is an example for indeed but each API has the same result structure.
|
123
|
-
```ruby
|
124
|
-
client = HawatelSearchJobs::Client.new
|
125
|
-
client.search_jobs({:keywords => 'ruby'})
|
126
|
-
result = client.jobs_table
|
127
|
-
|
128
|
-
result[:indeed][:code] # HTTP status code (see https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
|
129
|
-
result[:indeed][:message] # HTTP message (seee https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
|
130
|
-
|
131
|
-
result[:indeed][:totalResults] # Total results of job offers which matches to your search criteria on API provider
|
132
|
-
result[:indeed][:page] # Current results page number counted from index 0
|
133
|
-
result[:indeed][:last] # Last results page number
|
134
|
-
result[:indeed][:key] # Internal key which usuely keep last URL sent to API or last used keywords
|
135
|
-
|
136
|
-
result[:indeed][:jobs] # OpenStruct array which store returned job offers from API provider
|
137
|
-
result[:indeed][:jobs].jobtitle # Job title
|
138
|
-
result[:indeed][:jobs].location # Job location
|
139
|
-
result[:indeed][:jobs].company # Company name which posted the job
|
140
|
-
result[:indeed][:jobs].date # Date of the posted job (format %d/%m/%y)
|
141
|
-
result[:indeed][:jobs].url # Source URL to the job offer
|
142
|
-
```
|
143
|
-
|
144
|
-
## Contributing
|
145
|
-
|
146
|
-
See [CONTRIBUTING](CONTRIBUTING.md)
|
147
|
-
|
148
|
-
|
149
|
-
## License
|
150
|
-
|
151
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
152
|
-
|
1
|
+
[](https://travis-ci.org/Hawatel/hawatel_search_jobs)
|
2
|
+
[](https://codeclimate.com/github/Hawatel/hawatel_search_jobs)
|
3
|
+
[](http://inch-ci.org/github/Hawatel/hawatel_search_jobs)
|
4
|
+
[](https://badge.fury.io/rb/hawatel_search_jobs)
|
5
|
+
[](https://gemnasium.com/Hawatel/hawatel_search_jobs)
|
6
|
+
|
7
|
+
# Hawatel Search Jobs
|
8
|
+
|
9
|
+
Hawatel_search_jobs, it is gem which provides ease access to API from popular job websites to get current job offers. At this moment, supported backends are indeed.com, careerjet.com, xing.com, careerbuilder.com and reed.co.uk.
|
10
|
+
|
11
|
+
Before you can start using the gem, you need have an accounts/tokens for each portal where is required by API.
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'hawatel_search_jobs'
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install hawatel_search_jobs
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
#### How to configure access to search engine APIs
|
32
|
+
```ruby
|
33
|
+
HawatelSearchJobs.configure do |config|
|
34
|
+
config.indeed[:activated] = true
|
35
|
+
config.indeed[:api] = 'api.indeed.com'
|
36
|
+
config.indeed[:version] = '2'
|
37
|
+
config.indeed[:publisher] = 'secret-key'
|
38
|
+
|
39
|
+
config.xing[:activated] = true
|
40
|
+
config.xing[:consumer_key] = 'secret-key'
|
41
|
+
config.xing[:consumer_secret] = 'secret-key'
|
42
|
+
config.xing[:oauth_token] = 'secret-key'
|
43
|
+
config.xing[:oauth_token_secret] = 'secret-key'
|
44
|
+
|
45
|
+
config.reed[:activated] = true
|
46
|
+
config.reed[:api] = 'reed.co.uk/api'
|
47
|
+
config.reed[:clientid] = 'secret-key'
|
48
|
+
config.reed[:version] = '1.0'
|
49
|
+
|
50
|
+
config.careerbuilder[:activated] = true
|
51
|
+
config.careerbuilder[:api] = 'api.careerbuilder.com'
|
52
|
+
config.careerbuilder[:clientid] = 'secret-key'
|
53
|
+
config.careerbuilder[:version] = 'v2'
|
54
|
+
|
55
|
+
config.careerjet[:activated] = true
|
56
|
+
config.careerjet[:api] = 'public.api.careerjet.net'
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
#### Where to get a secret-key
|
61
|
+
1. Indeed: http://www.indeed.com/jsp/apiinfo.jsp
|
62
|
+
2. Xing: https://dev.xing.com
|
63
|
+
3. Reed: https://www.reed.co.uk/developers/jobseeker
|
64
|
+
4. Careerbuilder: http://developer.careerbuilder.com
|
65
|
+
5. Careerjet: secret-key is no needed (http://www.careerjet.com/partners/api/)
|
66
|
+
|
67
|
+
#### Get first page of job offers
|
68
|
+
There are two ways to read the returned job offers.
|
69
|
+
|
70
|
+
+ Returned job offers by search_jobs method:
|
71
|
+
```ruby
|
72
|
+
client = HawatelSearchJobs::Client.new
|
73
|
+
result = client.search_jobs({:keywords => 'ruby'})
|
74
|
+
p result[:indeed]
|
75
|
+
p result[:xing]
|
76
|
+
p result[:reed]
|
77
|
+
p result[:careerbuilder]
|
78
|
+
p result[:careerjet]
|
79
|
+
```
|
80
|
+
|
81
|
+
+ Access to the instance variable jobs_table.
|
82
|
+
Instance variable *jobs_table* always has last returned job offers.
|
83
|
+
```ruby
|
84
|
+
client = HawatelSearchJobs::Client.new
|
85
|
+
client.search_jobs({:keywords => 'ruby'})
|
86
|
+
p client.jobs_table
|
87
|
+
```
|
88
|
+
|
89
|
+
Each API has a limit of returned records. For consistency, each API returns maximum `25` records.
|
90
|
+
|
91
|
+
#### Get next page of job offers
|
92
|
+
```ruby
|
93
|
+
client = HawatelSearchJobs::Client.new
|
94
|
+
client.search_jobs({:keywords => 'ruby'})
|
95
|
+
p client.next
|
96
|
+
```
|
97
|
+
|
98
|
+
#### Get all pages of job offers
|
99
|
+
```ruby
|
100
|
+
client = HawatelSearchJobs::Client.new
|
101
|
+
client.search_jobs({:keywords => 'ruby'})
|
102
|
+
|
103
|
+
job_offers = Array.new
|
104
|
+
|
105
|
+
begin
|
106
|
+
job_offers << client.jobs_table
|
107
|
+
end while(client.next)
|
108
|
+
```
|
109
|
+
If keywords will be too general probably each API will return loads of data and then a daily limit for an API provider can be exceeded.
|
110
|
+
Reed about your daily limit for each API on the provider side.
|
111
|
+
|
112
|
+
#### How many job offers were found
|
113
|
+
```ruby
|
114
|
+
client = HawatelSearchJobs::Client.new
|
115
|
+
client.search_jobs({:keywords => 'ruby'})
|
116
|
+
p client.count # for all APIs
|
117
|
+
p client.count('indeed') # for a particular API
|
118
|
+
```
|
119
|
+
The `client.count` returns count of total results for each APIs which can be returned to you if you use `client.next` method.
|
120
|
+
|
121
|
+
## Structure of job offers table
|
122
|
+
Below is an example for indeed but each API has the same result structure.
|
123
|
+
```ruby
|
124
|
+
client = HawatelSearchJobs::Client.new
|
125
|
+
client.search_jobs({:keywords => 'ruby'})
|
126
|
+
result = client.jobs_table
|
127
|
+
|
128
|
+
result[:indeed][:code] # HTTP status code (see https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
|
129
|
+
result[:indeed][:message] # HTTP message (seee https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
|
130
|
+
|
131
|
+
result[:indeed][:totalResults] # Total results of job offers which matches to your search criteria on API provider
|
132
|
+
result[:indeed][:page] # Current results page number counted from index 0
|
133
|
+
result[:indeed][:last] # Last results page number
|
134
|
+
result[:indeed][:key] # Internal key which usuely keep last URL sent to API or last used keywords
|
135
|
+
|
136
|
+
result[:indeed][:jobs] # OpenStruct array which store returned job offers from API provider
|
137
|
+
result[:indeed][:jobs].jobtitle # Job title
|
138
|
+
result[:indeed][:jobs].location # Job location
|
139
|
+
result[:indeed][:jobs].company # Company name which posted the job
|
140
|
+
result[:indeed][:jobs].date # Date of the posted job (format %d/%m/%y)
|
141
|
+
result[:indeed][:jobs].url # Source URL to the job offer
|
142
|
+
```
|
143
|
+
|
144
|
+
## Contributing
|
145
|
+
|
146
|
+
See [CONTRIBUTING](CONTRIBUTING.md)
|
147
|
+
|
148
|
+
|
149
|
+
## License
|
150
|
+
|
151
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
152
|
+
|