career_builder 0.1.0

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.
Files changed (39) hide show
  1. data/.document +5 -0
  2. data/.gitignore +22 -0
  3. data/Gemfile +10 -0
  4. data/LICENSE +20 -0
  5. data/README.md +91 -0
  6. data/Rakefile +48 -0
  7. data/VERSION +1 -0
  8. data/career_builder.gemspec +95 -0
  9. data/lib/career_builder.rb +39 -0
  10. data/lib/career_builder/api/company.rb +17 -0
  11. data/lib/career_builder/api/interest.rb +16 -0
  12. data/lib/career_builder/api/job_type.rb +15 -0
  13. data/lib/career_builder/api/language.rb +15 -0
  14. data/lib/career_builder/api/location.rb +19 -0
  15. data/lib/career_builder/api/pay.rb +16 -0
  16. data/lib/career_builder/api/resume.rb +67 -0
  17. data/lib/career_builder/api/resume_search.rb +22 -0
  18. data/lib/career_builder/api/resume_search_result.rb +28 -0
  19. data/lib/career_builder/api/school.rb +18 -0
  20. data/lib/career_builder/api/shift_preference.rb +15 -0
  21. data/lib/career_builder/api/word_document.rb +16 -0
  22. data/lib/career_builder/client.rb +37 -0
  23. data/lib/career_builder/errors.rb +7 -0
  24. data/lib/career_builder/request.rb +82 -0
  25. data/lib/career_builder/request/authenticated.rb +23 -0
  26. data/lib/career_builder/requests/advanced_resume_search.rb +41 -0
  27. data/lib/career_builder/requests/authentication.rb +25 -0
  28. data/lib/career_builder/requests/get_resume.rb +24 -0
  29. data/lib/career_builder/requests/resume_actions_remaining_today.rb +21 -0
  30. data/lib/career_builder/resume.rb +44 -0
  31. data/lib/career_builder/resume/lazy_collection.rb +39 -0
  32. data/spec/career_builder/client_spec.rb +554 -0
  33. data/spec/career_builder/resume/lazy_collection_spec.rb +30 -0
  34. data/spec/career_builder/resume_spec.rb +5 -0
  35. data/spec/career_builder_spec.rb +5 -0
  36. data/spec/spec.opts +1 -0
  37. data/spec/spec_helper.rb +13 -0
  38. data/spec/support/webmock.rb +7 -0
  39. metadata +169 -0
@@ -0,0 +1,44 @@
1
+ module CareerBuilder
2
+
3
+ class Resume < BasicObject
4
+
5
+ attr_reader :client
6
+
7
+ def initialize(client, partial_resume)
8
+ @partial_resume = partial_resume
9
+ @client = client
10
+ end
11
+
12
+ def real_contact_email
13
+ full_resume.contact_email
14
+ end
15
+
16
+ def home_location
17
+ full_resume.home_location
18
+ end
19
+
20
+ private
21
+
22
+ def method_missing(meth, *args, &block)
23
+ if partial_resume.respond_to?(meth)
24
+ partial_resume.send(meth, *args, &block)
25
+ else
26
+ if full_resume.respond_to?(meth)
27
+ full_resume.send(meth, *args, &block)
28
+ else
29
+ super
30
+ end
31
+ end
32
+ end
33
+
34
+ def partial_resume
35
+ @partial_resume
36
+ end
37
+
38
+ def full_resume
39
+ @full_resume ||= client.get_resume(:resume_id => @partial_resume.id)
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -0,0 +1,39 @@
1
+ module CareerBuilder
2
+
3
+ class Resume::LazyCollection
4
+
5
+ attr_reader :search_options, :client
6
+
7
+ def initialize(client, options)
8
+ @client = client
9
+ @search_options = options
10
+ end
11
+
12
+ def each
13
+ current_page = search_options[:page] || 1
14
+
15
+ search = client.advanced_resume_search(search_options.merge(:page_number => current_page))
16
+
17
+ results = search.results
18
+ hits = search.hits
19
+ max_page = search.max_page
20
+
21
+ loop do
22
+
23
+ results.each do |resume|
24
+ yield Resume.new(client, resume)
25
+ end
26
+
27
+ current_page += 1
28
+
29
+ break if current_page > max_page
30
+
31
+ search = client.advanced_resume_search(search_options.merge(:page_number => current_page))
32
+ results = search.results
33
+
34
+ end
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,554 @@
1
+ require 'spec_helper'
2
+
3
+ describe CareerBuilder::Client do
4
+
5
+ describe "#authenticate" do
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/\">&lt;Packet&gt;&lt;Errors /&gt;&lt;SessionToken&gt;42df77a98a874c6ca8644cf8e8ceffa6-330779842-RY-4&lt;/SessionToken&gt;&lt;/Packet&gt;</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
+
25
+ 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/\">&lt;Packet&gt;&lt;Errors&gt;&lt;CBError&gt;&lt;Code&gt;300&lt;/Code&gt;&lt;Text&gt;300|Email (ryan@recruitmilitary.com) and password (AZG24N4) could not be validated.&lt;/Text&gt;&lt;/CBError&gt;&lt;/Errors&gt;&lt;SessionToken&gt;Invalid&lt;/SessionToken&gt;&lt;/Packet&gt;</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
+ before do
50
+ @client = CareerBuilder::Client.new("valid_email", "invalid_password")
51
+ @client.stub(:authenticate).and_return(false)
52
+ end
53
+
54
+ 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/\">&lt;Packet&gt;&lt;Errors /&gt;&lt;PageNumber&gt;1&lt;/PageNumber&gt;&lt;SearchTime&gt;06/25/2010 12:03:14&lt;/SearchTime&gt;&lt;FirstRec&gt;1&lt;/FirstRec&gt;&lt;LastRec&gt;100&lt;/LastRec&gt;&lt;Hits&gt;3&lt;/Hits&gt;&lt;MaxPage&gt;1&lt;/MaxPage&gt;&lt;Results&gt;&lt;ResumeResultItem_V3&gt;&lt;ContactEmail&gt;Rhd4G067G4JVTLW99H7_A7C14Q67VKG000YBSCR~CBWS^U7A3LY6YY46V1MT0RJK@resume.cbdr.com&lt;/ContactEmail&gt;&lt;ContactName&gt;Rebecca Bernard&lt;/ContactName&gt;&lt;HomeLocation&gt;US-OH-Milford&lt;/HomeLocation&gt;&lt;LastUpdate&gt;2010/5/13&lt;/LastUpdate&gt;&lt;ResumeTitle&gt;BERNARD_SYSTEMS_ENGINEER&lt;/ResumeTitle&gt;&lt;JobTitle&gt;BERNARD_SYSTEMS_ENGINEER&lt;/JobTitle&gt;&lt;RecentEmployer&gt;TATA CONSULTANCY SERVICES&lt;/RecentEmployer&gt;&lt;RecentJobTitle&gt;CONSULTANCY SERVICES- Systems Engineer&lt;/RecentJobTitle&gt;&lt;RecentPay&gt;0&lt;/RecentPay&gt;&lt;ResumeID&gt;Rhd4G067G4JVTLW99H7&lt;/ResumeID&gt;&lt;UserDID&gt;U7X86R61VVKS4FWS03T&lt;/UserDID&gt;&lt;ContactEmailMD5&gt;139013c2fa2b945bdc340f8a698b009e&lt;/ContactEmailMD5&gt;&lt;/ResumeResultItem_V3&gt;&lt;ResumeResultItem_V3&gt;&lt;ContactEmail&gt;Rhe7TZ764LHG1GQTPSM_A7C14Q67VKG000YBSCR~CBWS^U7A3LY6YY46V1MT0RJK@resume.cbdr.com&lt;/ContactEmail&gt;&lt;ContactName&gt;chris grader&lt;/ContactName&gt;&lt;HomeLocation&gt;US-OH-Milford&lt;/HomeLocation&gt;&lt;LastUpdate&gt;2010/6/4&lt;/LastUpdate&gt;&lt;ResumeTitle&gt;Chris Grader resume&lt;/ResumeTitle&gt;&lt;JobTitle&gt;Chris Grader resume&lt;/JobTitle&gt;&lt;RecentEmployer&gt;Millennial Medical, Inc&lt;/RecentEmployer&gt;&lt;RecentJobTitle&gt;Regional Sales Manager/Midwest Distributor&lt;/RecentJobTitle&gt;&lt;RecentPay&gt;0&lt;/RecentPay&gt;&lt;ResumeID&gt;Rhe7TZ764LHG1GQTPSM&lt;/ResumeID&gt;&lt;UserDID&gt;U346V1MKGCHPGCF9S8&lt;/UserDID&gt;&lt;ContactEmailMD5&gt;cfba57bf848b78211d99348cf0f90879&lt;/ContactEmailMD5&gt;&lt;/ResumeResultItem_V3&gt;&lt;ResumeResultItem_V3&gt;&lt;ContactEmail&gt;RH52G867678F7GH02Q3_A7C14Q67VKG000YBSCR~CBWS^U7A3LY6YY46V1MT0RJK@resume.cbdr.com&lt;/ContactEmail&gt;&lt;ContactName&gt;Jeffrey Davis&lt;/ContactName&gt;&lt;HomeLocation&gt;US-OH-Goshen&lt;/HomeLocation&gt;&lt;LastUpdate&gt;2010/5/23&lt;/LastUpdate&gt;&lt;ResumeTitle&gt;Warehouse Distribution Specialist&lt;/ResumeTitle&gt;&lt;JobTitle&gt;Warehouse Distribution Specialist&lt;/JobTitle&gt;&lt;RecentEmployer&gt;OWENS &amp;amp; MINOR&lt;/RecentEmployer&gt;&lt;RecentJobTitle&gt;Warehouse Lead Supervisor&lt;/RecentJobTitle&gt;&lt;RecentPay&gt;35776&lt;/RecentPay&gt;&lt;ResumeID&gt;RH52G867678F7GH02Q3&lt;/ResumeID&gt;&lt;UserDID&gt;U1C29V68M3YM95SP0XK&lt;/UserDID&gt;&lt;ContactEmailMD5&gt;e814ebaa93aae5c3719e27d26d5af917&lt;/ContactEmailMD5&gt;&lt;/ResumeResultItem_V3&gt;&lt;/Results&gt;&lt;/Packet&gt;</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
+ it 'should raise InvalidCredentials' do
184
+ expect {
185
+ @client.get_resume(:resume_id => "4242424242")
186
+ }.to raise_error(CareerBuilder::InvalidCredentials)
187
+ end
188
+
189
+ end
190
+
191
+ context "with invalid options" do
192
+
193
+ it 'should raise ArgumentError' do
194
+ expect {
195
+ @client.get_resume(:foo => "bar")
196
+ }.to raise_error(ArgumentError)
197
+ end
198
+
199
+ end
200
+
201
+ end
202
+
203
+ context "with valid credentials" do
204
+
205
+ before do
206
+ @client = CareerBuilder::Client.new("valid_email", "valid_password")
207
+ @client.stub(:session_token).and_return(42)
208
+ @client.stub(:authenticate).and_return(true)
209
+ end
210
+
211
+ context "with invalid options" do
212
+
213
+ it 'should raise ArgumentError' do
214
+ expect {
215
+ @client.get_resume(:foo => "bar")
216
+ }.to raise_error(ArgumentError)
217
+ end
218
+
219
+ end
220
+
221
+ context "when out of credits" do
222
+
223
+ before do
224
+ 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/\">&lt;Packet&gt;&lt;Warning&gt;&lt;/Warning&gt;&lt;/Packet&gt;</string>")
225
+ end
226
+
227
+ it 'should raise OutOfCredits' do
228
+ expect {
229
+ @resume = @client.get_resume(:resume_id => "RH52G867678F7GH02Q3")
230
+ }.to raise_error(CareerBuilder::OutOfCredits)
231
+ end
232
+
233
+ end
234
+
235
+ context "with valid options" do
236
+
237
+ before do
238
+ 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/\">&lt;Packet&gt;&lt;TimeStamp&gt;6/25/2010 3:19:20 PM&lt;/TimeStamp&gt;&lt;ResumeID&gt;RH52G867678F7GH02Q3&lt;/ResumeID&gt;&lt;ResumeTitle&gt;Warehouse Distribution Specialist&lt;/ResumeTitle&gt;&lt;ContactName&gt;Jeffrey Davis&lt;/ContactName&gt;&lt;ContactEmail&gt;Jeffd1969@aol.com&lt;/ContactEmail&gt;&lt;ContactPhone&gt;513-625-7228&lt;/ContactPhone&gt;&lt;HomeLocation&gt;&lt;City&gt;Goshen&lt;/City&gt;&lt;State&gt;OH&lt;/State&gt;&lt;Country&gt;US&lt;/Country&gt;&lt;ZipCode&gt;45122&lt;/ZipCode&gt;&lt;WorkStatus&gt;Can work for any employer&lt;/WorkStatus&gt;&lt;/HomeLocation&gt;&lt;Relocations&gt;&lt;ExtLocation&gt;&lt;City&gt;Tokyo&lt;/City&gt;&lt;State/&gt;&lt;Country&gt;JP&lt;/Country&gt;&lt;ZipCode /&gt;&lt;WorkStatus&gt;Can work for any employer&lt;/WorkStatus&gt;&lt;/ExtLocation&gt;&lt;/Relocations&gt;&lt;MaxCommuteMiles&gt;10&lt;/MaxCommuteMiles&gt;&lt;TravelPreference&gt;Up to 25%&lt;/TravelPreference&gt;&lt;CurrentlyEmployed&gt;Yes&lt;/CurrentlyEmployed&gt;&lt;MostRecentPay&gt;&lt;Amount&gt;35776&lt;/Amount&gt;&lt;Per&gt;year&lt;/Per&gt;&lt;/MostRecentPay&gt;&lt;DesiredPay&gt;&lt;Amount&gt;45000&lt;/Amount&gt;&lt;Per&gt;year&lt;/Per&gt;&lt;/DesiredPay&gt;&lt;DesiredJobTypes&gt;&lt;string&gt;Full Time&lt;/string&gt;&lt;/DesiredJobTypes&gt;&lt;MostRecentTitle&gt;Warehouse Lead Supervisor&lt;/MostRecentTitle&gt;&lt;ExperienceMonths&gt;216&lt;/ExperienceMonths&gt;&lt;Management&gt;&lt;ManagedOthers&gt;No&lt;/ManagedOthers&gt;&lt;NumberManaged&gt;0&lt;/NumberManaged&gt;&lt;/Management&gt;&lt;JobsLastThreeYears&gt;0&lt;/JobsLastThreeYears&gt;&lt;LastJobTenureMonths&gt;0&lt;/LastJobTenureMonths&gt;&lt;SecurityClearance&gt;No&lt;/SecurityClearance&gt;&lt;FelonyConvictions&gt;No&lt;/FelonyConvictions&gt;&lt;HighestDegree&gt;None&lt;/HighestDegree&gt;&lt;Certifications /&gt;&lt;MotivationToChangeJobs /&gt;&lt;EmploymentType /&gt;&lt;LastUpdated&gt;5/23/2010 10:41:12 PM&lt;/LastUpdated&gt;&lt;Languages&gt;&lt;string&gt;English&lt;/string&gt;&lt;/Languages&gt;&lt;DesiredShiftPreferences&gt;&lt;string /&gt;&lt;/DesiredShiftPreferences&gt;&lt;Interests&gt;&lt;ExtInterest&gt;&lt;Interest&gt;Warehouse&lt;/Interest&gt;&lt;ExperienceMonths&gt;216&lt;/ExperienceMonths&gt;&lt;/ExtInterest&gt;&lt;/Interests&gt;&lt;ResumeText&gt;JEFFREY A. DAVIS&lt;/ResumeText&gt;&lt;MilitaryExperience&gt;Veteran&lt;/MilitaryExperience&gt;&lt;WorkHistory&gt;&lt;ExtCompany&gt;&lt;CompanyName&gt;OWENS &amp;amp; MINOR&lt;/CompanyName&gt;&lt;JobTitle&gt;Warehouse Lead Supervisor&lt;/JobTitle&gt;&lt;Tenure&gt;01/01/2008 - Present&lt;/Tenure&gt;&lt;/ExtCompany&gt;&lt;ExtCompany&gt;&lt;CompanyName&gt;THE HOME DEPOT&lt;/CompanyName&gt;&lt;JobTitle&gt;- Sales Specialist&lt;/JobTitle&gt;&lt;Tenure&gt;01/01/2005 - Present&lt;/Tenure&gt;&lt;/ExtCompany&gt;&lt;ExtCompany&gt;&lt;CompanyName&gt;RUBIES COSTUME CO&lt;/CompanyName&gt;&lt;JobTitle&gt;- Warehouse Assistant Manager&lt;/JobTitle&gt;&lt;Tenure&gt;01/01/2004 - 01/01/2006&lt;/Tenure&gt;&lt;/ExtCompany&gt;&lt;ExtCompany&gt;&lt;CompanyName&gt;UNITED ELECTRIC POWER&lt;/CompanyName&gt;&lt;JobTitle&gt;Inventory Operations Manager&lt;/JobTitle&gt;&lt;Tenure&gt;01/01/2000 - 01/01/2004&lt;/Tenure&gt;&lt;/ExtCompany&gt;&lt;ExtCompany&gt;&lt;CompanyName&gt;VEECO INSTRUMENTS, INC&lt;/CompanyName&gt;&lt;JobTitle&gt;Warehouse Supervisor&lt;/JobTitle&gt;&lt;Tenure&gt;01/01/1996 - 01/01/2000&lt;/Tenure&gt;&lt;/ExtCompany&gt;&lt;/WorkHistory&gt;&lt;EducationHistory&gt;&lt;ExtSchool&gt;&lt;SchoolName&gt;Eastern Oklahoma State College&lt;/SchoolName&gt;&lt;Major&gt;Business Management&lt;/Major&gt;&lt;Degree /&gt;&lt;GraduationDate&gt;11993&lt;/GraduationDate&gt;&lt;/ExtSchool&gt;&lt;ExtSchool&gt;&lt;SchoolName&gt;Suffolk County Community College&lt;/SchoolName&gt;&lt;Major&gt;Business Management&lt;/Major&gt;&lt;Degree /&gt;&lt;GraduationDate&gt;11997&lt;/GraduationDate&gt;&lt;/ExtSchool&gt;&lt;/EducationHistory&gt;&lt;Warning&gt;&lt;/Warning&gt;&lt;/Packet&gt;</string>")
239
+ @resume = @client.get_resume(:resume_id => "RH52G867678F7GH02Q3")
240
+ end
241
+
242
+ it 'should return the correct timestamp' do
243
+ @resume.timestamp.should == Time.mktime(2010, 6, 25, 15, 19, 20)
244
+ end
245
+
246
+ it 'should return the correct id' do
247
+ @resume.id.should == "RH52G867678F7GH02Q3"
248
+ end
249
+
250
+ it 'should return the correct title' do
251
+ @resume.title.should == "Warehouse Distribution Specialist"
252
+ end
253
+
254
+ it 'should return the correct contact name' do
255
+ @resume.contact_name.should == "Jeffrey Davis"
256
+ end
257
+
258
+ it 'should return the correct contact email' do
259
+ @resume.contact_email.should == "Jeffd1969@aol.com"
260
+ end
261
+
262
+ it 'should return the correct contact phone' do
263
+ @resume.contact_phone.should == "513-625-7228"
264
+ end
265
+
266
+ describe "#home_location" do
267
+
268
+ before do
269
+ @home_location = @resume.home_location
270
+ end
271
+
272
+ it 'should return the correct city' do
273
+ @home_location.city.should == "Goshen"
274
+ end
275
+
276
+ it 'should return the correct state' do
277
+ @home_location.state.should == "OH"
278
+ end
279
+
280
+ it 'should return the correct zip code' do
281
+ @home_location.zip_code.should == "45122"
282
+ end
283
+
284
+ it 'should return the correct country' do
285
+ @home_location.country.should == "US"
286
+ end
287
+
288
+ it 'should return the correct work status' do
289
+ @home_location.work_status.should == "Can work for any employer"
290
+ end
291
+
292
+ end
293
+
294
+ describe "#relocations" do
295
+
296
+ before do
297
+ @relocations = @resume.relocations
298
+ @relocation = @relocations.first
299
+ end
300
+
301
+ it 'should return the correct city' do
302
+ @relocation.city.should == "Tokyo"
303
+ end
304
+
305
+ it 'should return the correct state' do
306
+ @relocation.state.should == ""
307
+ end
308
+
309
+ it 'should return the correct zip code' do
310
+ @relocation.zip_code.should == ""
311
+ end
312
+
313
+ it 'should return the correct country' do
314
+ @relocation.country.should == "JP"
315
+ end
316
+
317
+ it 'should return the correct work status' do
318
+ @relocation.work_status.should == "Can work for any employer"
319
+ end
320
+
321
+ end
322
+
323
+ it 'should return the correct max commute miles' do
324
+ @resume.max_commute_miles.should == 10
325
+ end
326
+
327
+ it 'should return the correct travel preference' do
328
+ @resume.travel_preference.should == "Up to 25%"
329
+ end
330
+
331
+ it 'should return the correct currently employed' do
332
+ @resume.currently_employed.should == "Yes"
333
+ end
334
+
335
+ describe "#most_recent_pay" do
336
+
337
+ before do
338
+ @most_recent_pay = @resume.most_recent_pay
339
+ end
340
+
341
+ it 'should return the correct amount' do
342
+ @most_recent_pay.amount.should == 35776
343
+ end
344
+
345
+ it 'should return the correct per' do
346
+ @most_recent_pay.per.should == "year"
347
+ end
348
+
349
+ end
350
+
351
+ describe "#desired_pay" do
352
+
353
+ before do
354
+ @desired_pay = @resume.desired_pay
355
+ end
356
+
357
+ it 'should return the correct amount' do
358
+ @desired_pay.amount.should == 45000
359
+ end
360
+
361
+ it 'should return the correct per' do
362
+ @desired_pay.per.should == "year"
363
+ end
364
+
365
+ end
366
+
367
+ describe "#desired_job_types" do
368
+
369
+ before do
370
+ @desired_job_types = @resume.desired_job_types
371
+ @desired_job_type = @desired_job_types.first
372
+ end
373
+
374
+ it 'should return the correct text' do
375
+ @desired_job_type.text.should == "Full Time"
376
+ end
377
+
378
+ end
379
+
380
+ it 'should return the correct most recent title' do
381
+ @resume.most_recent_title.should == "Warehouse Lead Supervisor"
382
+ end
383
+
384
+ it 'should return the correct experience months' do
385
+ @resume.experience_months.should == 216
386
+ end
387
+
388
+ it 'should return the correct managed others' do
389
+ @resume.managed_others.should == "No"
390
+ end
391
+
392
+ it 'should return the correct number managed' do
393
+ @resume.number_managed.should == 0
394
+ end
395
+
396
+ it 'should return the correct jobs last three years' do
397
+ @resume.jobs_last_three_years.should == 0
398
+ end
399
+
400
+ it 'should return the correct last job tenure months' do
401
+ @resume.last_job_tenure_months.should == 0
402
+ end
403
+
404
+ it 'should return the correct security clearance' do
405
+ @resume.security_clearance.should == "No"
406
+ end
407
+
408
+ it 'should return the correct felony convictions' do
409
+ @resume.felony_convictions.should == "No"
410
+ end
411
+
412
+ it 'should return the correct highest degree' do
413
+ @resume.highest_degree.should == "None"
414
+ end
415
+
416
+ it 'should return the correct certifications' do
417
+ @resume.certifications.should == ""
418
+ end
419
+
420
+ it 'should return the correct motivation to change jobs' do
421
+ @resume.motivation_to_change_jobs.should == ""
422
+ end
423
+
424
+ it 'should return the correct employment type' do
425
+ @resume.employment_type.should == ""
426
+ end
427
+
428
+ it 'should return the correct last updated' do
429
+ @resume.last_updated.should == Time.mktime(2010, 5, 23, 22, 41, 12)
430
+ end
431
+
432
+ describe "#languages" do
433
+
434
+ before do
435
+ @languages = @resume.languages
436
+ @language = @languages.first
437
+ end
438
+
439
+ it 'should return the correct text' do
440
+ @language.text.should == "English"
441
+ end
442
+
443
+ end
444
+
445
+ describe "#desired_shift_preferences" do
446
+
447
+ before do
448
+ @desired_shift_preferences = @resume.desired_shift_preferences
449
+ @desired_shift_preference = @desired_shift_preferences.first
450
+ end
451
+
452
+ it 'should return the correct desired shift preferences' do
453
+ @desired_shift_preference.text.should == ""
454
+ end
455
+
456
+ end
457
+
458
+ describe "#interests" do
459
+
460
+ before do
461
+ @interests = @resume.interests
462
+ @interest = @interests.first
463
+ end
464
+
465
+ it 'should return the correct interest' do
466
+ @interest.interest.should == "Warehouse"
467
+ end
468
+
469
+ it 'should return the correct experience in months' do
470
+ @interest.experience_months.should == 216
471
+ end
472
+
473
+ end
474
+
475
+ it 'should return the correct resume text' do
476
+ @resume.text.should == "JEFFREY A. DAVIS"
477
+ end
478
+
479
+ it 'should return the military experience' do
480
+ @resume.military_experience.should == "Veteran"
481
+ end
482
+
483
+ describe "#companies" do
484
+
485
+ before do
486
+ @companies = @resume.companies
487
+ @company = @companies.first
488
+ end
489
+
490
+ it 'should return the correct company name' do
491
+ @company.name.should == "OWENS & MINOR"
492
+ end
493
+
494
+ it 'should return the correct job title' do
495
+ @company.job_title.should == "Warehouse Lead Supervisor"
496
+ end
497
+
498
+ it 'should return the correct tenure' do
499
+ @company.tenure.should == "01/01/2008 - Present"
500
+ end
501
+
502
+ end
503
+
504
+ describe "#schools" do
505
+
506
+ before do
507
+ @schools = @resume.schools
508
+ @school = @schools.first
509
+ end
510
+
511
+ it 'should return the correct school name' do
512
+ @school.name.should == "Eastern Oklahoma State College"
513
+ end
514
+
515
+ it 'should return the correct major' do
516
+ @school.major.should == "Business Management"
517
+ end
518
+
519
+ it 'should return the correct degree' do
520
+ @school.degree.should == ""
521
+ end
522
+
523
+ it 'should return the correct graduation date' do
524
+ @school.graduation_date.should == "11993"
525
+ end
526
+
527
+ end
528
+
529
+ it 'should return the correct warning' do
530
+ @resume.warning.should == ""
531
+ end
532
+
533
+ end
534
+
535
+ end
536
+
537
+ end
538
+
539
+ describe "#resume_actions_remaining_today" do
540
+
541
+ before do
542
+ 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/\">&lt;Packet&gt;1&lt;/Packet&gt;</string>")
543
+ @client = CareerBuilder::Client.new("valid_email", "valid_password")
544
+ @client.stub(:session_token).and_return(42)
545
+ @client.stub(:authenticate).and_return(true)
546
+ end
547
+
548
+ it 'should return the number of credits remaining' do
549
+ @client.resume_actions_remaining_today(:account_did => "D7D15Q67VKG105ZB12").should == 1
550
+ end
551
+
552
+ end
553
+
554
+ end