career_builder 0.2.0 → 0.2.1
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.
- data/VERSION +1 -1
- data/career_builder.gemspec +10 -6
- data/lib/career_builder/resume/lazy_collection.rb +16 -8
- data/spec/career_builder/client/advanced_resume_search_spec.rb +116 -0
- data/spec/career_builder/client/authentication_spec.rb +39 -0
- data/spec/career_builder/{client_spec.rb → client/get_resume_spec.rb} +1 -219
- data/spec/career_builder/client/resume_actions_remaining_today_spec.rb +18 -0
- metadata +12 -8
- data/spec/career_builder/resume_spec.rb +0 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/career_builder.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{career_builder}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Guterl"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-04-04}
|
13
13
|
s.description = %q{Ruby wrapper for the CareerBuilder V2 HTTP XML API}
|
14
14
|
s.email = %q{mguterl@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -47,9 +47,11 @@ Gem::Specification.new do |s|
|
|
47
47
|
"lib/career_builder/errors.rb",
|
48
48
|
"lib/career_builder/resume.rb",
|
49
49
|
"lib/career_builder/resume/lazy_collection.rb",
|
50
|
-
"spec/career_builder/
|
50
|
+
"spec/career_builder/client/advanced_resume_search_spec.rb",
|
51
|
+
"spec/career_builder/client/authentication_spec.rb",
|
52
|
+
"spec/career_builder/client/get_resume_spec.rb",
|
53
|
+
"spec/career_builder/client/resume_actions_remaining_today_spec.rb",
|
51
54
|
"spec/career_builder/resume/lazy_collection_spec.rb",
|
52
|
-
"spec/career_builder/resume_spec.rb",
|
53
55
|
"spec/career_builder_spec.rb",
|
54
56
|
"spec/spec.opts",
|
55
57
|
"spec/spec_helper.rb",
|
@@ -60,9 +62,11 @@ Gem::Specification.new do |s|
|
|
60
62
|
s.rubygems_version = %q{1.3.7}
|
61
63
|
s.summary = %q{Ruby wrapper for the CareerBuilder V2 API}
|
62
64
|
s.test_files = [
|
63
|
-
"spec/career_builder/
|
65
|
+
"spec/career_builder/client/advanced_resume_search_spec.rb",
|
66
|
+
"spec/career_builder/client/authentication_spec.rb",
|
67
|
+
"spec/career_builder/client/get_resume_spec.rb",
|
68
|
+
"spec/career_builder/client/resume_actions_remaining_today_spec.rb",
|
64
69
|
"spec/career_builder/resume/lazy_collection_spec.rb",
|
65
|
-
"spec/career_builder/resume_spec.rb",
|
66
70
|
"spec/career_builder_spec.rb",
|
67
71
|
"spec/spec_helper.rb",
|
68
72
|
"spec/support/webmock.rb"
|
@@ -7,28 +7,36 @@ module CareerBuilder
|
|
7
7
|
def initialize(client, options)
|
8
8
|
@client = client
|
9
9
|
@search_options = options
|
10
|
+
@current_page = @search_options[:page] || 1
|
10
11
|
end
|
11
12
|
|
12
13
|
def each
|
13
|
-
|
14
|
-
|
15
|
-
search = client.advanced_resume_search(search_options.merge(:page_number => current_page, :rows_per_page => 500))
|
16
|
-
|
17
|
-
results = search.results
|
14
|
+
results = results_for @current_page
|
18
15
|
|
19
16
|
loop do
|
20
17
|
results.each do |resume|
|
21
18
|
yield Resume.new(client, resume)
|
22
19
|
end
|
23
20
|
|
24
|
-
current_page += 1
|
21
|
+
@current_page += 1
|
25
22
|
|
26
|
-
|
27
|
-
results = search.results
|
23
|
+
results = results_for @current_page
|
28
24
|
break if results.empty?
|
29
25
|
end
|
30
26
|
end
|
31
27
|
|
28
|
+
private
|
29
|
+
|
30
|
+
def results_for(page)
|
31
|
+
attempts = 0
|
32
|
+
search = client.advanced_resume_search(search_options.merge(:page_number => page, :rows_per_page => 500))
|
33
|
+
search.results
|
34
|
+
rescue Errno::ECONNRESET => e
|
35
|
+
attempts += 1
|
36
|
+
retry if attempts < 5
|
37
|
+
raise e
|
38
|
+
end
|
39
|
+
|
32
40
|
end
|
33
41
|
|
34
42
|
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CareerBuilder::Client do
|
4
|
+
|
5
|
+
describe "#advanced_resume_search" do
|
6
|
+
context "with invalid credentials" do
|
7
|
+
before do
|
8
|
+
@client = CareerBuilder::Client.new("valid_email", "invalid_password")
|
9
|
+
@client.stub(:authenticate).and_return(false)
|
10
|
+
end
|
11
|
+
|
12
|
+
context "with valid options" do
|
13
|
+
it 'should raise InvalidCredentials' do
|
14
|
+
expect {
|
15
|
+
@client.advanced_resume_search(:keywords => "Ruby")
|
16
|
+
}.to raise_error(CareerBuilder::InvalidCredentials)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "with invalid options" do
|
21
|
+
it 'should raise ArgumentError' do
|
22
|
+
expect {
|
23
|
+
@client.advanced_resume_search(:foo => "bar")
|
24
|
+
}.to raise_error(ArgumentError)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "with valid credentials" do
|
30
|
+
before do
|
31
|
+
@client = CareerBuilder::Client.new("valid_email", "valid_password")
|
32
|
+
@client.stub(:session_token).and_return(42)
|
33
|
+
@client.stub(:authenticate).and_return(true)
|
34
|
+
end
|
35
|
+
|
36
|
+
context "with valid options" do
|
37
|
+
before do
|
38
|
+
stub_request(:post, "http://ws.careerbuilder.com/resumes/resumes.asmx/V2_AdvancedResumeSearch").with(:body => 'Packet=%3cPacket%3e%3cSessionToken%3e42%3c%2fSessionToken%3e%3cKeywords%3eRuby%3c%2fKeywords%3e%3c%2fPacket%3e').to_return(:body => "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<string xmlns=\"http://ws.careerbuilder.com/resumes/\"><Packet><Errors /><PageNumber>1</PageNumber><SearchTime>06/25/2010 12:03:14</SearchTime><FirstRec>1</FirstRec><LastRec>100</LastRec><Hits>3</Hits><MaxPage>1</MaxPage><Results><ResumeResultItem_V3><ContactEmail>Rhd4G067G4JVTLW99H7_A7C14Q67VKG000YBSCR~CBWS^U7A3LY6YY46V1MT0RJK@resume.cbdr.com</ContactEmail><ContactName>Rebecca Bernard</ContactName><HomeLocation>US-OH-Milford</HomeLocation><LastUpdate>2010/5/13</LastUpdate><ResumeTitle>BERNARD_SYSTEMS_ENGINEER</ResumeTitle><JobTitle>BERNARD_SYSTEMS_ENGINEER</JobTitle><RecentEmployer>TATA CONSULTANCY SERVICES</RecentEmployer><RecentJobTitle>CONSULTANCY SERVICES- Systems Engineer</RecentJobTitle><RecentPay>0</RecentPay><ResumeID>Rhd4G067G4JVTLW99H7</ResumeID><UserDID>U7X86R61VVKS4FWS03T</UserDID><ContactEmailMD5>139013c2fa2b945bdc340f8a698b009e</ContactEmailMD5></ResumeResultItem_V3><ResumeResultItem_V3><ContactEmail>Rhe7TZ764LHG1GQTPSM_A7C14Q67VKG000YBSCR~CBWS^U7A3LY6YY46V1MT0RJK@resume.cbdr.com</ContactEmail><ContactName>chris grader</ContactName><HomeLocation>US-OH-Milford</HomeLocation><LastUpdate>2010/6/4</LastUpdate><ResumeTitle>Chris Grader resume</ResumeTitle><JobTitle>Chris Grader resume</JobTitle><RecentEmployer>Millennial Medical, Inc</RecentEmployer><RecentJobTitle>Regional Sales Manager/Midwest Distributor</RecentJobTitle><RecentPay>0</RecentPay><ResumeID>Rhe7TZ764LHG1GQTPSM</ResumeID><UserDID>U346V1MKGCHPGCF9S8</UserDID><ContactEmailMD5>cfba57bf848b78211d99348cf0f90879</ContactEmailMD5></ResumeResultItem_V3><ResumeResultItem_V3><ContactEmail>RH52G867678F7GH02Q3_A7C14Q67VKG000YBSCR~CBWS^U7A3LY6YY46V1MT0RJK@resume.cbdr.com</ContactEmail><ContactName>Jeffrey Davis</ContactName><HomeLocation>US-OH-Goshen</HomeLocation><LastUpdate>2010/5/23</LastUpdate><ResumeTitle>Warehouse Distribution Specialist</ResumeTitle><JobTitle>Warehouse Distribution Specialist</JobTitle><RecentEmployer>OWENS &amp; MINOR</RecentEmployer><RecentJobTitle>Warehouse Lead Supervisor</RecentJobTitle><RecentPay>35776</RecentPay><ResumeID>RH52G867678F7GH02Q3</ResumeID><UserDID>U1C29V68M3YM95SP0XK</UserDID><ContactEmailMD5>e814ebaa93aae5c3719e27d26d5af917</ContactEmailMD5></ResumeResultItem_V3></Results></Packet></string>")
|
39
|
+
@search = @client.advanced_resume_search(:keywords => "Ruby")
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should have the correct page number' do
|
43
|
+
@search.page_number.should == 1
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should have the correct search time' do
|
47
|
+
@search.search_time.should == Time.mktime(2010, 6, 25, 12, 3, 14)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should return the correct number of hits' do
|
51
|
+
@search.hits.should == 3
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should return the correct max page' do
|
55
|
+
@search.max_page.should == 1
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "#results" do
|
59
|
+
before do
|
60
|
+
@results = @search.results
|
61
|
+
@result = @results.first
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should return the correct contact email' do
|
65
|
+
@result.contact_email.should == "Rhd4G067G4JVTLW99H7_A7C14Q67VKG000YBSCR~CBWS^U7A3LY6YY46V1MT0RJK@resume.cbdr.com"
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should return the correct contact name' do
|
69
|
+
@result.contact_name.should == "Rebecca Bernard"
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should return the correct home location' do
|
73
|
+
@result.home_location.should == "US-OH-Milford"
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should return the correct last update' do
|
77
|
+
@result.last_update.should == Date.new(2010, 5, 13)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should return the correct resume title' do
|
81
|
+
@result.title.should == "BERNARD_SYSTEMS_ENGINEER"
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should return the correct job title' do
|
85
|
+
@result.job_title.should == "BERNARD_SYSTEMS_ENGINEER"
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should return the correct recent pay' do
|
89
|
+
@result.recent_pay.should == 0
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should return the correct id' do
|
93
|
+
@result.id.should == "Rhd4G067G4JVTLW99H7"
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'should return the correct user id' do
|
97
|
+
@result.user_did.should == "U7X86R61VVKS4FWS03T"
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'should return the correct contact email md5' do
|
101
|
+
@result.contact_email_md5.should == "139013c2fa2b945bdc340f8a698b009e"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context "with invalid options" do
|
107
|
+
it 'should raise ArgumentError' do
|
108
|
+
expect {
|
109
|
+
@client.advanced_resume_search(:foo => "bar")
|
110
|
+
}.to raise_error(ArgumentError)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CareerBuilder::Client do
|
4
|
+
|
5
|
+
describe "#authenticate" do
|
6
|
+
context "with valid credentials" do
|
7
|
+
before do
|
8
|
+
stub_request(:post, "http://ws.careerbuilder.com/resumes/resumes.asmx/BeginSessionV2").with(:body => 'Packet=%3cPacket%3e%3cEmail%3evalid_email%3c%2fEmail%3e%3cPassword%3evalid_password%3c%2fPassword%3e%3c%2fPacket%3e').to_return(:body => "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<string xmlns=\"http://ws.careerbuilder.com/resumes/\"><Packet><Errors /><SessionToken>42df77a98a874c6ca8644cf8e8ceffa6-330779842-RY-4</SessionToken></Packet></string>")
|
9
|
+
@client = CareerBuilder::Client.new("valid_email", "valid_password")
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should return true' do
|
13
|
+
@client.authenticate.should be_true
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should be authenticated' do
|
17
|
+
@client.authenticate
|
18
|
+
@client.should be_authenticated
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "with invalid credentials" do
|
23
|
+
before do
|
24
|
+
stub_request(:post, "http://ws.careerbuilder.com/resumes/resumes.asmx/BeginSessionV2").with(:body => 'Packet=%3cPacket%3e%3cEmail%3evalid_email%3c%2fEmail%3e%3cPassword%3einvalid_password%3c%2fPassword%3e%3c%2fPacket%3e').to_return(:body => "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<string xmlns=\"http://ws.careerbuilder.com/resumes/\"><Packet><Errors><CBError><Code>300</Code><Text>300|Email (ryan@recruitmilitary.com) and password (AZG24N4) could not be validated.</Text></CBError></Errors><SessionToken>Invalid</SessionToken></Packet></string>")
|
25
|
+
@client = CareerBuilder::Client.new("valid_email", "invalid_password")
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should return false' do
|
29
|
+
@client.authenticate.should be_false
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should not be authenticated' do
|
33
|
+
@client.authenticate
|
34
|
+
@client.should_not be_authenticated
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -2,206 +2,31 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe CareerBuilder::Client do
|
4
4
|
|
5
|
-
describe "#
|
6
|
-
|
7
|
-
context "with valid credentials" do
|
8
|
-
|
9
|
-
before do
|
10
|
-
stub_request(:post, "http://ws.careerbuilder.com/resumes/resumes.asmx/BeginSessionV2").with(:body => 'Packet=%3cPacket%3e%3cEmail%3evalid_email%3c%2fEmail%3e%3cPassword%3evalid_password%3c%2fPassword%3e%3c%2fPacket%3e').to_return(:body => "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<string xmlns=\"http://ws.careerbuilder.com/resumes/\"><Packet><Errors /><SessionToken>42df77a98a874c6ca8644cf8e8ceffa6-330779842-RY-4</SessionToken></Packet></string>")
|
11
|
-
@client = CareerBuilder::Client.new("valid_email", "valid_password")
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should return true' do
|
15
|
-
@client.authenticate.should be_true
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should be authenticated' do
|
19
|
-
@client.authenticate
|
20
|
-
@client.should be_authenticated
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
5
|
+
describe "#get_resume" do
|
25
6
|
context "with invalid credentials" do
|
26
|
-
|
27
|
-
before do
|
28
|
-
stub_request(:post, "http://ws.careerbuilder.com/resumes/resumes.asmx/BeginSessionV2").with(:body => 'Packet=%3cPacket%3e%3cEmail%3evalid_email%3c%2fEmail%3e%3cPassword%3einvalid_password%3c%2fPassword%3e%3c%2fPacket%3e').to_return(:body => "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<string xmlns=\"http://ws.careerbuilder.com/resumes/\"><Packet><Errors><CBError><Code>300</Code><Text>300|Email (ryan@recruitmilitary.com) and password (AZG24N4) could not be validated.</Text></CBError></Errors><SessionToken>Invalid</SessionToken></Packet></string>")
|
29
|
-
@client = CareerBuilder::Client.new("valid_email", "invalid_password")
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should return false' do
|
33
|
-
@client.authenticate.should be_false
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'should not be authenticated' do
|
37
|
-
@client.authenticate
|
38
|
-
@client.should_not be_authenticated
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
describe "#advanced_resume_search" do
|
46
|
-
|
47
|
-
context "with invalid credentials" do
|
48
|
-
|
49
7
|
before do
|
50
8
|
@client = CareerBuilder::Client.new("valid_email", "invalid_password")
|
51
9
|
@client.stub(:authenticate).and_return(false)
|
52
10
|
end
|
53
11
|
|
54
12
|
context "with valid options" do
|
55
|
-
|
56
|
-
it 'should raise InvalidCredentials' do
|
57
|
-
expect {
|
58
|
-
@client.advanced_resume_search(:keywords => "Ruby")
|
59
|
-
}.to raise_error(CareerBuilder::InvalidCredentials)
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
context "with invalid options" do
|
65
|
-
|
66
|
-
it 'should raise ArgumentError' do
|
67
|
-
expect {
|
68
|
-
@client.advanced_resume_search(:foo => "bar")
|
69
|
-
}.to raise_error(ArgumentError)
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
context "with valid credentials" do
|
77
|
-
|
78
|
-
before do
|
79
|
-
@client = CareerBuilder::Client.new("valid_email", "valid_password")
|
80
|
-
@client.stub(:session_token).and_return(42)
|
81
|
-
@client.stub(:authenticate).and_return(true)
|
82
|
-
end
|
83
|
-
|
84
|
-
context "with valid options" do
|
85
|
-
|
86
|
-
before do
|
87
|
-
stub_request(:post, "http://ws.careerbuilder.com/resumes/resumes.asmx/V2_AdvancedResumeSearch").with(:body => 'Packet=%3cPacket%3e%3cSessionToken%3e42%3c%2fSessionToken%3e%3cKeywords%3eRuby%3c%2fKeywords%3e%3c%2fPacket%3e').to_return(:body => "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<string xmlns=\"http://ws.careerbuilder.com/resumes/\"><Packet><Errors /><PageNumber>1</PageNumber><SearchTime>06/25/2010 12:03:14</SearchTime><FirstRec>1</FirstRec><LastRec>100</LastRec><Hits>3</Hits><MaxPage>1</MaxPage><Results><ResumeResultItem_V3><ContactEmail>Rhd4G067G4JVTLW99H7_A7C14Q67VKG000YBSCR~CBWS^U7A3LY6YY46V1MT0RJK@resume.cbdr.com</ContactEmail><ContactName>Rebecca Bernard</ContactName><HomeLocation>US-OH-Milford</HomeLocation><LastUpdate>2010/5/13</LastUpdate><ResumeTitle>BERNARD_SYSTEMS_ENGINEER</ResumeTitle><JobTitle>BERNARD_SYSTEMS_ENGINEER</JobTitle><RecentEmployer>TATA CONSULTANCY SERVICES</RecentEmployer><RecentJobTitle>CONSULTANCY SERVICES- Systems Engineer</RecentJobTitle><RecentPay>0</RecentPay><ResumeID>Rhd4G067G4JVTLW99H7</ResumeID><UserDID>U7X86R61VVKS4FWS03T</UserDID><ContactEmailMD5>139013c2fa2b945bdc340f8a698b009e</ContactEmailMD5></ResumeResultItem_V3><ResumeResultItem_V3><ContactEmail>Rhe7TZ764LHG1GQTPSM_A7C14Q67VKG000YBSCR~CBWS^U7A3LY6YY46V1MT0RJK@resume.cbdr.com</ContactEmail><ContactName>chris grader</ContactName><HomeLocation>US-OH-Milford</HomeLocation><LastUpdate>2010/6/4</LastUpdate><ResumeTitle>Chris Grader resume</ResumeTitle><JobTitle>Chris Grader resume</JobTitle><RecentEmployer>Millennial Medical, Inc</RecentEmployer><RecentJobTitle>Regional Sales Manager/Midwest Distributor</RecentJobTitle><RecentPay>0</RecentPay><ResumeID>Rhe7TZ764LHG1GQTPSM</ResumeID><UserDID>U346V1MKGCHPGCF9S8</UserDID><ContactEmailMD5>cfba57bf848b78211d99348cf0f90879</ContactEmailMD5></ResumeResultItem_V3><ResumeResultItem_V3><ContactEmail>RH52G867678F7GH02Q3_A7C14Q67VKG000YBSCR~CBWS^U7A3LY6YY46V1MT0RJK@resume.cbdr.com</ContactEmail><ContactName>Jeffrey Davis</ContactName><HomeLocation>US-OH-Goshen</HomeLocation><LastUpdate>2010/5/23</LastUpdate><ResumeTitle>Warehouse Distribution Specialist</ResumeTitle><JobTitle>Warehouse Distribution Specialist</JobTitle><RecentEmployer>OWENS &amp; MINOR</RecentEmployer><RecentJobTitle>Warehouse Lead Supervisor</RecentJobTitle><RecentPay>35776</RecentPay><ResumeID>RH52G867678F7GH02Q3</ResumeID><UserDID>U1C29V68M3YM95SP0XK</UserDID><ContactEmailMD5>e814ebaa93aae5c3719e27d26d5af917</ContactEmailMD5></ResumeResultItem_V3></Results></Packet></string>")
|
88
|
-
@search = @client.advanced_resume_search(:keywords => "Ruby")
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'should have the correct page number' do
|
92
|
-
@search.page_number.should == 1
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'should have the correct search time' do
|
96
|
-
@search.search_time.should == Time.mktime(2010, 6, 25, 12, 3, 14)
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'should return the correct number of hits' do
|
100
|
-
@search.hits.should == 3
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'should return the correct max page' do
|
104
|
-
@search.max_page.should == 1
|
105
|
-
end
|
106
|
-
|
107
|
-
describe "#results" do
|
108
|
-
|
109
|
-
before do
|
110
|
-
@results = @search.results
|
111
|
-
@result = @results.first
|
112
|
-
end
|
113
|
-
|
114
|
-
it 'should return the correct contact email' do
|
115
|
-
@result.contact_email.should == "Rhd4G067G4JVTLW99H7_A7C14Q67VKG000YBSCR~CBWS^U7A3LY6YY46V1MT0RJK@resume.cbdr.com"
|
116
|
-
end
|
117
|
-
|
118
|
-
it 'should return the correct contact name' do
|
119
|
-
@result.contact_name.should == "Rebecca Bernard"
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'should return the correct home location' do
|
123
|
-
@result.home_location.should == "US-OH-Milford"
|
124
|
-
end
|
125
|
-
|
126
|
-
it 'should return the correct last update' do
|
127
|
-
@result.last_update.should == Date.new(2010, 5, 13)
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'should return the correct resume title' do
|
131
|
-
@result.title.should == "BERNARD_SYSTEMS_ENGINEER"
|
132
|
-
end
|
133
|
-
|
134
|
-
it 'should return the correct job title' do
|
135
|
-
@result.job_title.should == "BERNARD_SYSTEMS_ENGINEER"
|
136
|
-
end
|
137
|
-
|
138
|
-
it 'should return the correct recent pay' do
|
139
|
-
@result.recent_pay.should == 0
|
140
|
-
end
|
141
|
-
|
142
|
-
it 'should return the correct id' do
|
143
|
-
@result.id.should == "Rhd4G067G4JVTLW99H7"
|
144
|
-
end
|
145
|
-
|
146
|
-
it 'should return the correct user id' do
|
147
|
-
@result.user_did.should == "U7X86R61VVKS4FWS03T"
|
148
|
-
end
|
149
|
-
|
150
|
-
it 'should return the correct contact email md5' do
|
151
|
-
@result.contact_email_md5.should == "139013c2fa2b945bdc340f8a698b009e"
|
152
|
-
end
|
153
|
-
|
154
|
-
end
|
155
|
-
|
156
|
-
end
|
157
|
-
|
158
|
-
context "with invalid options" do
|
159
|
-
|
160
|
-
it 'should raise ArgumentError' do
|
161
|
-
expect {
|
162
|
-
@client.advanced_resume_search(:foo => "bar")
|
163
|
-
}.to raise_error(ArgumentError)
|
164
|
-
end
|
165
|
-
|
166
|
-
end
|
167
|
-
|
168
|
-
end
|
169
|
-
|
170
|
-
end
|
171
|
-
|
172
|
-
describe "get_resume" do
|
173
|
-
|
174
|
-
context "with invalid credentials" do
|
175
|
-
|
176
|
-
before do
|
177
|
-
@client = CareerBuilder::Client.new("valid_email", "invalid_password")
|
178
|
-
@client.stub(:authenticate).and_return(false)
|
179
|
-
end
|
180
|
-
|
181
|
-
context "with valid options" do
|
182
|
-
|
183
13
|
it 'should raise InvalidCredentials' do
|
184
14
|
expect {
|
185
15
|
@client.get_resume(:resume_id => "4242424242")
|
186
16
|
}.to raise_error(CareerBuilder::InvalidCredentials)
|
187
17
|
end
|
188
|
-
|
189
18
|
end
|
190
19
|
|
191
20
|
context "with invalid options" do
|
192
|
-
|
193
21
|
it 'should raise ArgumentError' do
|
194
22
|
expect {
|
195
23
|
@client.get_resume(:foo => "bar")
|
196
24
|
}.to raise_error(ArgumentError)
|
197
25
|
end
|
198
|
-
|
199
26
|
end
|
200
|
-
|
201
27
|
end
|
202
28
|
|
203
29
|
context "with valid credentials" do
|
204
|
-
|
205
30
|
before do
|
206
31
|
@client = CareerBuilder::Client.new("valid_email", "valid_password")
|
207
32
|
@client.stub(:session_token).and_return(42)
|
@@ -209,17 +34,14 @@ describe CareerBuilder::Client do
|
|
209
34
|
end
|
210
35
|
|
211
36
|
context "with invalid options" do
|
212
|
-
|
213
37
|
it 'should raise ArgumentError' do
|
214
38
|
expect {
|
215
39
|
@client.get_resume(:foo => "bar")
|
216
40
|
}.to raise_error(ArgumentError)
|
217
41
|
end
|
218
|
-
|
219
42
|
end
|
220
43
|
|
221
44
|
context "when out of credits" do
|
222
|
-
|
223
45
|
before do
|
224
46
|
stub_request(:post, "http://ws.careerbuilder.com/resumes/resumes.asmx/V2_GetResume").with(:body => 'Packet=%3cPacket%3e%3cSessionToken%3e42%3c%2fSessionToken%3e%3cResumeID%3eRH52G867678F7GH02Q3%3c%2fResumeID%3e%3c%2fPacket%3e').to_return(:body => "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<string xmlns=\"http://ws.careerbuilder.com/resumes/\"><Packet><Warning></Warning></Packet></string>")
|
225
47
|
end
|
@@ -229,11 +51,9 @@ describe CareerBuilder::Client do
|
|
229
51
|
@resume = @client.get_resume(:resume_id => "RH52G867678F7GH02Q3")
|
230
52
|
}.to raise_error(CareerBuilder::OutOfCredits)
|
231
53
|
end
|
232
|
-
|
233
54
|
end
|
234
55
|
|
235
56
|
context "with valid options" do
|
236
|
-
|
237
57
|
RAW_RESUME_RESPONSE = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<string xmlns=\"http://ws.careerbuilder.com/resumes/\"><Packet><TimeStamp>6/25/2010 3:19:20 PM</TimeStamp><ResumeID>RH52G867678F7GH02Q3</ResumeID><ResumeTitle>Warehouse Distribution Specialist</ResumeTitle><ContactName>Jeffrey Davis</ContactName><ContactEmail>Jeffd1969@aol.com</ContactEmail><ContactPhone>513-625-7228</ContactPhone><HomeLocation><City>Goshen</City><State>OH</State><Country>US</Country><ZipCode>45122</ZipCode><WorkStatus>Can work for any employer</WorkStatus></HomeLocation><Relocations><ExtLocation><City>Tokyo</City><State/><Country>JP</Country><ZipCode /><WorkStatus>Can work for any employer</WorkStatus></ExtLocation></Relocations><MaxCommuteMiles>10</MaxCommuteMiles><TravelPreference>Up to 25%</TravelPreference><CurrentlyEmployed>Yes</CurrentlyEmployed><MostRecentPay><Amount>35776</Amount><Per>year</Per></MostRecentPay><DesiredPay><Amount>45000</Amount><Per>year</Per></DesiredPay><DesiredJobTypes><string>Full Time</string></DesiredJobTypes><MostRecentTitle>Warehouse Lead Supervisor</MostRecentTitle><ExperienceMonths>216</ExperienceMonths><Management><ManagedOthers>No</ManagedOthers><NumberManaged>0</NumberManaged></Management><JobsLastThreeYears>0</JobsLastThreeYears><LastJobTenureMonths>0</LastJobTenureMonths><SecurityClearance>No</SecurityClearance><FelonyConvictions>No</FelonyConvictions><HighestDegree>None</HighestDegree><Certifications /><MotivationToChangeJobs /><EmploymentType /><LastUpdated>5/23/2010 10:41:12 PM</LastUpdated><Languages><string>English</string></Languages><DesiredShiftPreferences><string /></DesiredShiftPreferences><Interests><ExtInterest><Interest>Warehouse</Interest><ExperienceMonths>216</ExperienceMonths></ExtInterest></Interests><ResumeText>JEFFREY A. DAVIS</ResumeText><MilitaryExperience>Veteran</MilitaryExperience><WorkHistory><ExtCompany><CompanyName>OWENS &amp; MINOR</CompanyName><JobTitle>Warehouse Lead Supervisor</JobTitle><Tenure>01/01/2008 - Present</Tenure></ExtCompany><ExtCompany><CompanyName>THE HOME DEPOT</CompanyName><JobTitle>- Sales Specialist</JobTitle><Tenure>01/01/2005 - Present</Tenure></ExtCompany><ExtCompany><CompanyName>RUBIES COSTUME CO</CompanyName><JobTitle>- Warehouse Assistant Manager</JobTitle><Tenure>01/01/2004 - 01/01/2006</Tenure></ExtCompany><ExtCompany><CompanyName>UNITED ELECTRIC POWER</CompanyName><JobTitle>Inventory Operations Manager</JobTitle><Tenure>01/01/2000 - 01/01/2004</Tenure></ExtCompany><ExtCompany><CompanyName>VEECO INSTRUMENTS, INC</CompanyName><JobTitle>Warehouse Supervisor</JobTitle><Tenure>01/01/1996 - 01/01/2000</Tenure></ExtCompany></WorkHistory><EducationHistory><ExtSchool><SchoolName>Eastern Oklahoma State College</SchoolName><Major>Business Management</Major><Degree /><GraduationDate>11993</GraduationDate></ExtSchool><ExtSchool><SchoolName>Suffolk County Community College</SchoolName><Major>Business Management</Major><Degree /><GraduationDate>11997</GraduationDate></ExtSchool></EducationHistory><Warning></Warning></Packet></string>".freeze
|
238
58
|
|
239
59
|
before do
|
@@ -273,7 +93,6 @@ describe CareerBuilder::Client do
|
|
273
93
|
end
|
274
94
|
|
275
95
|
describe "#home_location" do
|
276
|
-
|
277
96
|
before do
|
278
97
|
@home_location = @resume.home_location
|
279
98
|
end
|
@@ -297,11 +116,9 @@ describe CareerBuilder::Client do
|
|
297
116
|
it 'should return the correct work status' do
|
298
117
|
@home_location.work_status.should == "Can work for any employer"
|
299
118
|
end
|
300
|
-
|
301
119
|
end
|
302
120
|
|
303
121
|
describe "#relocations" do
|
304
|
-
|
305
122
|
before do
|
306
123
|
@relocations = @resume.relocations
|
307
124
|
@relocation = @relocations.first
|
@@ -326,7 +143,6 @@ describe CareerBuilder::Client do
|
|
326
143
|
it 'should return the correct work status' do
|
327
144
|
@relocation.work_status.should == "Can work for any employer"
|
328
145
|
end
|
329
|
-
|
330
146
|
end
|
331
147
|
|
332
148
|
it 'should return the correct max commute miles' do
|
@@ -342,7 +158,6 @@ describe CareerBuilder::Client do
|
|
342
158
|
end
|
343
159
|
|
344
160
|
describe "#most_recent_pay" do
|
345
|
-
|
346
161
|
before do
|
347
162
|
@most_recent_pay = @resume.most_recent_pay
|
348
163
|
end
|
@@ -354,11 +169,9 @@ describe CareerBuilder::Client do
|
|
354
169
|
it 'should return the correct per' do
|
355
170
|
@most_recent_pay.per.should == "year"
|
356
171
|
end
|
357
|
-
|
358
172
|
end
|
359
173
|
|
360
174
|
describe "#desired_pay" do
|
361
|
-
|
362
175
|
before do
|
363
176
|
@desired_pay = @resume.desired_pay
|
364
177
|
end
|
@@ -370,11 +183,9 @@ describe CareerBuilder::Client do
|
|
370
183
|
it 'should return the correct per' do
|
371
184
|
@desired_pay.per.should == "year"
|
372
185
|
end
|
373
|
-
|
374
186
|
end
|
375
187
|
|
376
188
|
describe "#desired_job_types" do
|
377
|
-
|
378
189
|
before do
|
379
190
|
@desired_job_types = @resume.desired_job_types
|
380
191
|
@desired_job_type = @desired_job_types.first
|
@@ -383,7 +194,6 @@ describe CareerBuilder::Client do
|
|
383
194
|
it 'should return the correct text' do
|
384
195
|
@desired_job_type.text.should == "Full Time"
|
385
196
|
end
|
386
|
-
|
387
197
|
end
|
388
198
|
|
389
199
|
it 'should return the correct most recent title' do
|
@@ -439,7 +249,6 @@ describe CareerBuilder::Client do
|
|
439
249
|
end
|
440
250
|
|
441
251
|
describe "#languages" do
|
442
|
-
|
443
252
|
before do
|
444
253
|
@languages = @resume.languages
|
445
254
|
@language = @languages.first
|
@@ -448,11 +257,9 @@ describe CareerBuilder::Client do
|
|
448
257
|
it 'should return the correct text' do
|
449
258
|
@language.text.should == "English"
|
450
259
|
end
|
451
|
-
|
452
260
|
end
|
453
261
|
|
454
262
|
describe "#desired_shift_preferences" do
|
455
|
-
|
456
263
|
before do
|
457
264
|
@desired_shift_preferences = @resume.desired_shift_preferences
|
458
265
|
@desired_shift_preference = @desired_shift_preferences.first
|
@@ -461,11 +268,9 @@ describe CareerBuilder::Client do
|
|
461
268
|
it 'should return the correct desired shift preferences' do
|
462
269
|
@desired_shift_preference.text.should == ""
|
463
270
|
end
|
464
|
-
|
465
271
|
end
|
466
272
|
|
467
273
|
describe "#interests" do
|
468
|
-
|
469
274
|
before do
|
470
275
|
@interests = @resume.interests
|
471
276
|
@interest = @interests.first
|
@@ -478,7 +283,6 @@ describe CareerBuilder::Client do
|
|
478
283
|
it 'should return the correct experience in months' do
|
479
284
|
@interest.experience_months.should == 216
|
480
285
|
end
|
481
|
-
|
482
286
|
end
|
483
287
|
|
484
288
|
it 'should return the correct resume text' do
|
@@ -490,7 +294,6 @@ describe CareerBuilder::Client do
|
|
490
294
|
end
|
491
295
|
|
492
296
|
describe "#companies" do
|
493
|
-
|
494
297
|
before do
|
495
298
|
@companies = @resume.companies
|
496
299
|
@company = @companies.first
|
@@ -507,11 +310,9 @@ describe CareerBuilder::Client do
|
|
507
310
|
it 'should return the correct tenure' do
|
508
311
|
@company.tenure.should == "01/01/2008 - Present"
|
509
312
|
end
|
510
|
-
|
511
313
|
end
|
512
314
|
|
513
315
|
describe "#schools" do
|
514
|
-
|
515
316
|
before do
|
516
317
|
@schools = @resume.schools
|
517
318
|
@school = @schools.first
|
@@ -532,32 +333,13 @@ describe CareerBuilder::Client do
|
|
532
333
|
it 'should return the correct graduation date' do
|
533
334
|
@school.graduation_date.should == "11993"
|
534
335
|
end
|
535
|
-
|
536
336
|
end
|
537
337
|
|
538
338
|
it 'should return the correct warning' do
|
539
339
|
@resume.warning.should == ""
|
540
340
|
end
|
541
|
-
|
542
341
|
end
|
543
|
-
|
544
|
-
end
|
545
|
-
|
546
|
-
end
|
547
|
-
|
548
|
-
describe "#resume_actions_remaining_today" do
|
549
|
-
|
550
|
-
before do
|
551
|
-
stub_request(:post, "http://ws.careerbuilder.com/resumes/resumes.asmx/V2_ResumeActionsRemainingToday").with(:body => 'Packet=%3cPacket%3e%3cSessionToken%3e42%3c%2fSessionToken%3e%3cAccountDID%3eD7D15Q67VKG105ZB12%3c%2fAccountDID%3e%3c%2fPacket%3e').to_return(:body => "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<string xmlns=\"http://ws.careerbuilder.com/resumes/\"><Packet>1</Packet></string>")
|
552
|
-
@client = CareerBuilder::Client.new("valid_email", "valid_password")
|
553
|
-
@client.stub(:session_token).and_return(42)
|
554
|
-
@client.stub(:authenticate).and_return(true)
|
555
342
|
end
|
556
|
-
|
557
|
-
it 'should return the number of credits remaining' do
|
558
|
-
@client.resume_actions_remaining_today(:account_did => "D7D15Q67VKG105ZB12").should == 1
|
559
|
-
end
|
560
|
-
|
561
343
|
end
|
562
344
|
|
563
345
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CareerBuilder::Client do
|
4
|
+
|
5
|
+
describe "#resume_actions_remaining_today" do
|
6
|
+
before do
|
7
|
+
stub_request(:post, "http://ws.careerbuilder.com/resumes/resumes.asmx/V2_ResumeActionsRemainingToday").with(:body => 'Packet=%3cPacket%3e%3cSessionToken%3e42%3c%2fSessionToken%3e%3cAccountDID%3eD7D15Q67VKG105ZB12%3c%2fAccountDID%3e%3c%2fPacket%3e').to_return(:body => "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<string xmlns=\"http://ws.careerbuilder.com/resumes/\"><Packet>1</Packet></string>")
|
8
|
+
@client = CareerBuilder::Client.new("valid_email", "valid_password")
|
9
|
+
@client.stub(:session_token).and_return(42)
|
10
|
+
@client.stub(:authenticate).and_return(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should return the number of credits remaining' do
|
14
|
+
@client.resume_actions_remaining_today(:account_did => "D7D15Q67VKG105ZB12").should == 1
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: career_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Guterl
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-04-04 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -174,9 +174,11 @@ files:
|
|
174
174
|
- lib/career_builder/errors.rb
|
175
175
|
- lib/career_builder/resume.rb
|
176
176
|
- lib/career_builder/resume/lazy_collection.rb
|
177
|
-
- spec/career_builder/
|
177
|
+
- spec/career_builder/client/advanced_resume_search_spec.rb
|
178
|
+
- spec/career_builder/client/authentication_spec.rb
|
179
|
+
- spec/career_builder/client/get_resume_spec.rb
|
180
|
+
- spec/career_builder/client/resume_actions_remaining_today_spec.rb
|
178
181
|
- spec/career_builder/resume/lazy_collection_spec.rb
|
179
|
-
- spec/career_builder/resume_spec.rb
|
180
182
|
- spec/career_builder_spec.rb
|
181
183
|
- spec/spec.opts
|
182
184
|
- spec/spec_helper.rb
|
@@ -216,9 +218,11 @@ signing_key:
|
|
216
218
|
specification_version: 3
|
217
219
|
summary: Ruby wrapper for the CareerBuilder V2 API
|
218
220
|
test_files:
|
219
|
-
- spec/career_builder/
|
221
|
+
- spec/career_builder/client/advanced_resume_search_spec.rb
|
222
|
+
- spec/career_builder/client/authentication_spec.rb
|
223
|
+
- spec/career_builder/client/get_resume_spec.rb
|
224
|
+
- spec/career_builder/client/resume_actions_remaining_today_spec.rb
|
220
225
|
- spec/career_builder/resume/lazy_collection_spec.rb
|
221
|
-
- spec/career_builder/resume_spec.rb
|
222
226
|
- spec/career_builder_spec.rb
|
223
227
|
- spec/spec_helper.rb
|
224
228
|
- spec/support/webmock.rb
|