simplyhired 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +53 -0
- data/Rakefile +9 -0
- data/lib/simplyhired.rb +8 -0
- data/lib/simplyhired/client.rb +139 -0
- data/lib/simplyhired/configuration.rb +27 -0
- data/lib/simplyhired/job.rb +21 -0
- data/lib/simplyhired/version.rb +3 -0
- data/simplyhired.gemspec +27 -0
- data/test/helper.rb +4 -0
- data/test/phrase.xml +30 -0
- data/test/pn-1.xml +282 -0
- data/test/pn-2.xml +294 -0
- data/test/pn-3.xml +229 -0
- data/test/pn-4.xml +10 -0
- data/test/simplyhired/configuration_test.rb +22 -0
- data/test/simplyhired/simplyhired_test.rb +91 -0
- metadata +127 -0
data/test/pn-4.xml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe 'configuration' do
|
4
|
+
after do
|
5
|
+
Simplyhired.reset
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '.configure' do
|
9
|
+
it "should set the pshid" do
|
10
|
+
Simplyhired.configure do |config|
|
11
|
+
config.send("pshid=", 'keyvalueset')
|
12
|
+
Simplyhired.send('pshid').must_equal 'keyvalueset'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '.pshid' do
|
18
|
+
it 'should raise an exception' do
|
19
|
+
assert Simplyhired.pshid.must_be_nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Simplyhired do
|
4
|
+
|
5
|
+
describe "version number" do
|
6
|
+
it 'should have a version' do
|
7
|
+
Simplyhired::VERSION.wont_be_nil
|
8
|
+
end
|
9
|
+
end
|
10
|
+
describe "configuration" do
|
11
|
+
it "should provide appropriate error" do
|
12
|
+
Simplyhired.configure do |config|
|
13
|
+
# config.pshid = "49755"
|
14
|
+
config.jbd = "mysite.jobamatic.com"
|
15
|
+
end
|
16
|
+
|
17
|
+
sh = Simplyhired::Client.new('50.19.85.132')
|
18
|
+
jobs = sh.search_jobs(["Rails", "Ajax"], nil, "New York", "NY")
|
19
|
+
assert sh.error == 'define pshid in a configuration file'
|
20
|
+
Simplyhired.configure do |config|
|
21
|
+
config.pshid = nil
|
22
|
+
config.jbd = nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
describe "search for jobs" do
|
27
|
+
before(:each) do
|
28
|
+
Simplyhired.configure do |config|
|
29
|
+
config.pshid = "49511"
|
30
|
+
config.jbd = "subdomain.jobamatic.com"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
after(:each) do
|
34
|
+
Simplyhired.configure do |config|
|
35
|
+
config.pshid = nil
|
36
|
+
config.jbd = nil
|
37
|
+
end
|
38
|
+
end
|
39
|
+
it "should find jobs" do
|
40
|
+
|
41
|
+
stub_request(:get, /api.simplyhired.com.*pn-1.*/).with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => File.new('test/pn-1.xml'), :headers => {})
|
42
|
+
stub_request(:get, /api.simplyhired.com.*pn-2.*/).with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => File.new('test/pn-2.xml'), :headers => {})
|
43
|
+
stub_request(:get, /api.simplyhired.com.*pn-3.*/).with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => File.new('test/pn-3.xml'), :headers => {})
|
44
|
+
|
45
|
+
sh = Simplyhired::Client.new('50.19.85.132')
|
46
|
+
jobs = sh.search_jobs(["Rails", "Ajax"], nil, "New York", "NY", distance: 10, days: 30)
|
47
|
+
|
48
|
+
assert sh.total_jobs_found == 70
|
49
|
+
|
50
|
+
assert jobs[0].title == 'Senior Web Developer (Ruby/Rails/Javascript)'
|
51
|
+
assert jobs[0].company == 'Namtek'
|
52
|
+
assert jobs[0].location == 'New York, NY'
|
53
|
+
assert jobs[0].source == 'Dice'
|
54
|
+
assert jobs[0].date_posted == "2014-01-14T01:06:41Z"
|
55
|
+
|
56
|
+
jobs = sh.next
|
57
|
+
assert jobs[0].title == 'Backend Engineer'
|
58
|
+
|
59
|
+
jobs = sh.next
|
60
|
+
assert jobs[0].title == 'Innovation Engineer - Lamp/Web/Mobile'
|
61
|
+
|
62
|
+
jobs = sh.next
|
63
|
+
jobs.must_be_nil
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should find jobs with all keywords" do
|
68
|
+
|
69
|
+
stub_request(:get, /api.simplyhired.com.*pn-1.*/).with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => File.new('test/pn-1.xml'), :headers => {})
|
70
|
+
|
71
|
+
sh = Simplyhired::Client.new('50.19.85.132')
|
72
|
+
jobs = sh.search_jobs(["Rails", "Ajax"], nil, "New York", "NY", distance: 10, days: 30)
|
73
|
+
assert sh.total_jobs_found == 70
|
74
|
+
|
75
|
+
stub_request(:get, /api.simplyhired.com.*pn-1.*/).with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => File.new('test/phrase.xml'), :headers => {})
|
76
|
+
jobs = sh.search_jobs(["Rails", "Ajax"], nil, "New York", "NY", query_type: :PHRASE, distance: 10, days: 30)
|
77
|
+
assert sh.total_jobs_found == 1
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should return error from simplyhired" do
|
82
|
+
|
83
|
+
stub_request(:get, /api.simplyhired.com.*pn-4.*/).with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).to_return(:status => 200, :body => File.new('test/pn-4.xml'), :headers => {})
|
84
|
+
|
85
|
+
sh = Simplyhired::Client.new('50.19.85.132')
|
86
|
+
jobs = sh.search_jobs(["Rails", "Ajax"], nil, "New York", "NY", query_type: :PHRASE, distance: 10, days: 30, page: 4)
|
87
|
+
assert sh.error == 'noresults'
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simplyhired
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- murty korada
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.1'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: ox
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
description: Wrapper for Simplyhired xml api.
|
70
|
+
email:
|
71
|
+
- ''
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- lib/simplyhired.rb
|
82
|
+
- lib/simplyhired/client.rb
|
83
|
+
- lib/simplyhired/configuration.rb
|
84
|
+
- lib/simplyhired/job.rb
|
85
|
+
- lib/simplyhired/version.rb
|
86
|
+
- simplyhired.gemspec
|
87
|
+
- test/helper.rb
|
88
|
+
- test/phrase.xml
|
89
|
+
- test/pn-1.xml
|
90
|
+
- test/pn-2.xml
|
91
|
+
- test/pn-3.xml
|
92
|
+
- test/pn-4.xml
|
93
|
+
- test/simplyhired/configuration_test.rb
|
94
|
+
- test/simplyhired/simplyhired_test.rb
|
95
|
+
homepage: https://github.com/murtyk/simplyhired
|
96
|
+
licenses:
|
97
|
+
- MIT
|
98
|
+
metadata: {}
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 2.2.1
|
116
|
+
signing_key:
|
117
|
+
specification_version: 4
|
118
|
+
summary: Wrapper for Simplyhired xml api.
|
119
|
+
test_files:
|
120
|
+
- test/helper.rb
|
121
|
+
- test/phrase.xml
|
122
|
+
- test/pn-1.xml
|
123
|
+
- test/pn-2.xml
|
124
|
+
- test/pn-3.xml
|
125
|
+
- test/pn-4.xml
|
126
|
+
- test/simplyhired/configuration_test.rb
|
127
|
+
- test/simplyhired/simplyhired_test.rb
|