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/spec/reed_spec.rb
CHANGED
@@ -1,81 +1,78 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ostruct'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
@
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
expect(page_result.
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
expect(
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
expect(result.
|
76
|
-
expect(result.
|
77
|
-
|
78
|
-
expect(result.key).to match("locationName=#{query_api[:location]}")
|
79
|
-
expect(result.key).to match("keywords=#{query_api[:keywords]}")
|
80
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
xdescribe HawatelSearchJobs::Api::Reed do
|
5
|
+
before(:each) do
|
6
|
+
HawatelSearchJobs.configure do |config|
|
7
|
+
config.reed[:api] = "reed.co.uk/api"
|
8
|
+
config.reed[:clientid] = ''
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'APIs returned jobs' do
|
13
|
+
before(:each) do
|
14
|
+
@query_api = { :keywords => 'ruby', :location => 'London' }
|
15
|
+
|
16
|
+
@result = HawatelSearchJobs::Api::Reed.search(
|
17
|
+
:settings => HawatelSearchJobs.reed,
|
18
|
+
:query => {
|
19
|
+
:keywords => @query_api[:keywords],
|
20
|
+
:location => @query_api[:location]
|
21
|
+
})
|
22
|
+
end
|
23
|
+
|
24
|
+
it '#search' do
|
25
|
+
validate_result(@result, @query_api)
|
26
|
+
expect(@result.page).to be >= 0
|
27
|
+
expect(@result.last).to be >= 0
|
28
|
+
end
|
29
|
+
|
30
|
+
it '#page' do
|
31
|
+
validate_result(@result, @query_api)
|
32
|
+
page_result = HawatelSearchJobs::Api::Reed.page({:settings => HawatelSearchJobs.reed, :query_key => @result.key, :page => 1})
|
33
|
+
expect(page_result.key).to match(/&resultsToSkip=25/)
|
34
|
+
expect(page_result.page).to eq(1)
|
35
|
+
expect(page_result.last).to be >= 0
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'APIs returned empty table' do
|
40
|
+
before(:each) do
|
41
|
+
@query_api = { :keywords => 'job-not-found-zero-records', :location => 'London' }
|
42
|
+
|
43
|
+
@result = HawatelSearchJobs::Api::Reed.search(
|
44
|
+
:settings => HawatelSearchJobs.reed,
|
45
|
+
:query => {
|
46
|
+
:keywords => @query_api[:keywords],
|
47
|
+
:location => @query_api[:location]
|
48
|
+
})
|
49
|
+
end
|
50
|
+
|
51
|
+
it '#search' do
|
52
|
+
validate_result(@result, @query_api)
|
53
|
+
expect(@result.totalResults).to eq(0)
|
54
|
+
expect(@result.page).to be_nil
|
55
|
+
expect(@result.last).to be_nil
|
56
|
+
end
|
57
|
+
|
58
|
+
it '#page' do
|
59
|
+
validate_result(@result, @query_api)
|
60
|
+
page_result = HawatelSearchJobs::Api::Reed.page({:settings => HawatelSearchJobs.reed, :query_key => @result.key, :page => 1})
|
61
|
+
expect(page_result.key).to match(/&resultsToSkip=25/)
|
62
|
+
expect(@result.totalResults).to eq(0)
|
63
|
+
expect(@result.page).to be_nil
|
64
|
+
expect(@result.last).to be_nil
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def validate_result(result, query_api)
|
72
|
+
expect(result.code).to eq(200)
|
73
|
+
expect(result.msg).to eq('OK')
|
74
|
+
expect(result.totalResults).to be >= 0
|
75
|
+
expect(result.key).to match("locationName=#{query_api[:location]}")
|
76
|
+
expect(result.key).to match("keywords=#{query_api[:keywords]}")
|
77
|
+
end
|
81
78
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
-
require 'hawatel_search_jobs'
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
require 'hawatel_search_jobs'
|
data/spec/xing_spec.rb
CHANGED
@@ -1,48 +1,47 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'xing_api'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
HawatelSearchJobs.configure do |config|
|
8
|
-
config.xing[:consumer_key] = ''
|
9
|
-
config.xing[:consumer_secret] = ''
|
10
|
-
config.xing[:oauth_token] = ''
|
11
|
-
config.xing[:oauth_token_secret] = ''
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:client) { return HawatelSearchJobs::Client.new }
|
16
|
-
let(:result) {
|
17
|
-
return HawatelSearchJobs::Api::Xing.search(
|
18
|
-
:settings => HawatelSearchJobs.xing,
|
19
|
-
:query => { :keywords => 'ruby', :company => '' }
|
20
|
-
)}
|
21
|
-
|
22
|
-
|
23
|
-
expect(result.page).to be_a_kind_of(Integer)
|
24
|
-
expect(result.last).to be_a_kind_of(Integer)
|
25
|
-
expect(result.totalResults).to be_a_kind_of(Integer)
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
result.jobs.each do |job|
|
30
|
-
expect(job.jobtitle).to be_a_kind_of(String)
|
31
|
-
expect(job.location).to be_a_kind_of(String)
|
32
|
-
expect(job.company).to be_a_kind_of(String)
|
33
|
-
expect(job.url).to include('http')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
jobs = HawatelSearchJobs::Api::Xing.page({:query_key => result.key})
|
39
|
-
expect(jobs.page).to eq(0)
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
jobs = HawatelSearchJobs::Api::Xing.page({:query_key => result.key, :page => 1})
|
44
|
-
expect(jobs.page).to eq(1)
|
45
|
-
end
|
46
|
-
|
47
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'xing_api'
|
3
|
+
|
4
|
+
xdescribe "HawatelSearchJobs::Api::Xing" do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
HawatelSearchJobs.configure do |config|
|
8
|
+
config.xing[:consumer_key] = ''
|
9
|
+
config.xing[:consumer_secret] = ''
|
10
|
+
config.xing[:oauth_token] = ''
|
11
|
+
config.xing[:oauth_token_secret] = ''
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:client) { return HawatelSearchJobs::Client.new }
|
16
|
+
let(:result) {
|
17
|
+
return HawatelSearchJobs::Api::Xing.search(
|
18
|
+
:settings => HawatelSearchJobs.xing,
|
19
|
+
:query => { :keywords => 'ruby', :company => '' }
|
20
|
+
)}
|
21
|
+
|
22
|
+
it "metadata from search() result" do
|
23
|
+
expect(result.page).to be_a_kind_of(Integer)
|
24
|
+
expect(result.last).to be_a_kind_of(Integer)
|
25
|
+
expect(result.totalResults).to be_a_kind_of(Integer)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "job attributes from search() result" do
|
29
|
+
result.jobs.each do |job|
|
30
|
+
expect(job.jobtitle).to be_a_kind_of(String)
|
31
|
+
expect(job.location).to be_a_kind_of(String)
|
32
|
+
expect(job.company).to be_a_kind_of(String)
|
33
|
+
expect(job.url).to include('http')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "call page() without specified page (default 0)" do
|
38
|
+
jobs = HawatelSearchJobs::Api::Xing.page({:query_key => result.key})
|
39
|
+
expect(jobs.page).to eq(0)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "call page() with specified page" do
|
43
|
+
jobs = HawatelSearchJobs::Api::Xing.page({:query_key => result.key, :page => 1})
|
44
|
+
expect(jobs.page).to eq(1)
|
45
|
+
end
|
46
|
+
|
48
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hawatel_search_jobs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Przemyslaw Mantaj
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-06-
|
12
|
+
date: 2016-06-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: xing_api
|