board-client 0.3.0 → 0.99.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 (61) hide show
  1. data/.gitignore +4 -0
  2. data/.rspec +1 -0
  3. data/.rvmrc +47 -0
  4. data/Gemfile +1 -7
  5. data/README.md +63 -17
  6. data/Rakefile +4 -44
  7. data/board-client.gemspec +22 -66
  8. data/lib/board/client.rb +41 -22
  9. data/lib/board/client/api.rb +29 -0
  10. data/lib/board/client/candidates.rb +13 -0
  11. data/lib/board/client/organizations.rb +17 -0
  12. data/lib/board/client/request.rb +98 -0
  13. data/lib/board/client/user_organizations.rb +20 -0
  14. data/lib/board/client/users.rb +21 -0
  15. data/lib/board/client/version.rb +5 -0
  16. data/spec/board/client_spec.rb +27 -83
  17. data/spec/cassettes/candidate_exists_with_id.yml +30 -0
  18. data/spec/cassettes/candidate_id_does_not_exist.yml +336 -0
  19. data/spec/cassettes/candidate_invite_email_exists.yml +30 -0
  20. data/spec/cassettes/candidate_invite_when_invalid.yml +30 -0
  21. data/spec/cassettes/candidate_invite_when_valid.yml +32 -0
  22. data/spec/cassettes/list_user_organizations_with_invalid_id.yml +346 -0
  23. data/spec/cassettes/list_user_organizations_with_valid_id.yml +30 -0
  24. data/spec/cassettes/organization_add_user.yml +26 -0
  25. data/spec/cassettes/organization_add_user_-_organization_does_not_exist.yml +356 -0
  26. data/spec/cassettes/organization_add_user_-_user_does_not_exist.yml +348 -0
  27. data/spec/cassettes/organization_create_is_invalid.yml +30 -0
  28. data/spec/cassettes/organization_create_is_valid.yml +32 -0
  29. data/spec/cassettes/organization_exists_with_email.yml +30 -0
  30. data/spec/cassettes/organization_exists_with_id.yml +30 -0
  31. data/spec/cassettes/organization_id_does_not_exist.yml +354 -0
  32. data/spec/cassettes/organization_name_does_not_exist.yml +334 -0
  33. data/spec/cassettes/unsubscribe_email_does_not_exist.yml +340 -0
  34. data/spec/cassettes/unsubscribe_email_exists.yml +30 -0
  35. data/spec/cassettes/user_does_exist.yml +30 -0
  36. data/spec/cassettes/user_does_not_exist.yml +32 -0
  37. data/spec/cassettes/user_email_does_not_exist.yml +334 -0
  38. data/spec/cassettes/user_email_md5_does_not_exist.yml +334 -0
  39. data/spec/cassettes/user_exists_with_email.yml +30 -0
  40. data/spec/cassettes/user_exists_with_email_md5.yml +30 -0
  41. data/spec/cassettes/user_exists_with_id.yml +30 -0
  42. data/spec/cassettes/user_id_does_not_exist.yml +346 -0
  43. data/spec/cassettes/user_missing_attributes.yml +30 -0
  44. data/spec/integration/candidates/find_spec.rb +28 -0
  45. data/spec/integration/candidates/invite_spec.rb +48 -0
  46. data/spec/integration/organizations/add_user_spec.rb +34 -0
  47. data/spec/integration/organizations/create_spec.rb +38 -0
  48. data/spec/integration/organizations/find_spec.rb +50 -0
  49. data/spec/integration/users/create_spec.rb +54 -0
  50. data/spec/integration/users/find_spec.rb +73 -0
  51. data/spec/integration/users/list_organizations_spec.rb +36 -0
  52. data/spec/integration/users/unsubscribe_spec.rb +27 -0
  53. data/spec/spec_helper.rb +6 -5
  54. data/spec/support/integration_helpers.rb +17 -0
  55. data/spec/support/vcr.rb +11 -0
  56. metadata +144 -52
  57. data/Gemfile.lock +0 -22
  58. data/lib/board/candidate_search.rb +0 -45
  59. data/lib/board/request.rb +0 -78
  60. data/spec/board/candidate_search_spec.rb +0 -45
  61. data/spec/spec.opts +0 -1
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: board-client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 403
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
8
+ - 99
9
9
  - 0
10
- version: 0.3.0
10
+ version: 0.99.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Guterl
@@ -15,10 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-04 00:00:00 -04:00
19
- default_executable:
18
+ date: 2011-08-29 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
21
+ name: rest-client
22
+ prerelease: false
22
23
  requirement: &id001 !ruby/object:Gem::Requirement
23
24
  none: false
24
25
  requirements:
@@ -30,11 +31,11 @@ dependencies:
30
31
  - 6
31
32
  - 1
32
33
  version: 1.6.1
33
- version_requirements: *id001
34
- name: rest-client
35
- prerelease: false
36
34
  type: :runtime
35
+ version_requirements: *id001
37
36
  - !ruby/object:Gem::Dependency
37
+ name: yajl-ruby
38
+ prerelease: false
38
39
  requirement: &id002 !ruby/object:Gem::Requirement
39
40
  none: false
40
41
  requirements:
@@ -46,102 +47,156 @@ dependencies:
46
47
  - 7
47
48
  - 7
48
49
  version: 0.7.7
49
- version_requirements: *id002
50
- name: yajl-ruby
51
- prerelease: false
52
50
  type: :runtime
51
+ version_requirements: *id002
53
52
  - !ruby/object:Gem::Dependency
53
+ name: hashie
54
+ prerelease: false
54
55
  requirement: &id003 !ruby/object:Gem::Requirement
55
56
  none: false
56
57
  requirements:
57
58
  - - ~>
58
59
  - !ruby/object:Gem::Version
59
- hash: 13
60
+ hash: 19
60
61
  segments:
61
62
  - 1
62
- - 6
63
63
  - 1
64
- version: 1.6.1
65
- version_requirements: *id003
66
- name: rest-client
67
- prerelease: false
64
+ - 0
65
+ version: 1.1.0
68
66
  type: :runtime
67
+ version_requirements: *id003
69
68
  - !ruby/object:Gem::Dependency
69
+ name: rspec
70
+ prerelease: false
70
71
  requirement: &id004 !ruby/object:Gem::Requirement
71
72
  none: false
72
73
  requirements:
73
74
  - - ~>
74
75
  - !ruby/object:Gem::Version
75
- hash: 13
76
+ hash: 23
76
77
  segments:
78
+ - 2
79
+ - 6
77
80
  - 0
78
- - 7
79
- - 7
80
- version: 0.7.7
81
+ version: 2.6.0
82
+ type: :development
81
83
  version_requirements: *id004
82
- name: yajl-ruby
83
- prerelease: false
84
- type: :runtime
85
84
  - !ruby/object:Gem::Dependency
85
+ name: vcr
86
+ prerelease: false
86
87
  requirement: &id005 !ruby/object:Gem::Requirement
87
88
  none: false
88
89
  requirements:
89
90
  - - ~>
90
91
  - !ruby/object:Gem::Version
91
- hash: 27
92
+ hash: 57
92
93
  segments:
93
94
  - 1
94
- - 3
95
- - 0
96
- version: 1.3.0
97
- version_requirements: *id005
98
- name: rspec
99
- prerelease: false
95
+ - 11
96
+ - 1
97
+ version: 1.11.1
100
98
  type: :development
99
+ version_requirements: *id005
101
100
  - !ruby/object:Gem::Dependency
101
+ name: webmock
102
+ prerelease: false
102
103
  requirement: &id006 !ruby/object:Gem::Requirement
103
104
  none: false
104
105
  requirements:
105
106
  - - ~>
106
107
  - !ruby/object:Gem::Version
107
- hash: 11
108
+ hash: 3
108
109
  segments:
109
110
  - 1
110
- - 6
111
- - 2
112
- version: 1.6.2
111
+ - 7
112
+ - 4
113
+ version: 1.7.4
114
+ type: :development
113
115
  version_requirements: *id006
114
- name: webmock
116
+ - !ruby/object:Gem::Dependency
117
+ name: ruby-debug
115
118
  prerelease: false
119
+ requirement: &id007 !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ hash: 3
125
+ segments:
126
+ - 0
127
+ version: "0"
116
128
  type: :development
117
- description: A ruby wrapper for the board platform.
118
- email: mguterl@gmail.com
129
+ version_requirements: *id007
130
+ description: A ruby wrapper for the RecruitMilitary Board HTTP API
131
+ email:
132
+ - mguterl@gmail.com
119
133
  executables: []
120
134
 
121
135
  extensions: []
122
136
 
123
- extra_rdoc_files:
124
- - LICENSE
125
- - README.md
137
+ extra_rdoc_files: []
138
+
126
139
  files:
127
140
  - .document
141
+ - .gitignore
142
+ - .rspec
143
+ - .rvmrc
128
144
  - Gemfile
129
- - Gemfile.lock
130
145
  - LICENSE
131
146
  - README.md
132
147
  - Rakefile
133
148
  - VERSION
134
149
  - board-client.gemspec
135
150
  - lib/board-client.rb
136
- - lib/board/candidate_search.rb
137
151
  - lib/board/client.rb
138
- - lib/board/request.rb
139
- - spec/board/candidate_search_spec.rb
152
+ - lib/board/client/api.rb
153
+ - lib/board/client/candidates.rb
154
+ - lib/board/client/organizations.rb
155
+ - lib/board/client/request.rb
156
+ - lib/board/client/user_organizations.rb
157
+ - lib/board/client/users.rb
158
+ - lib/board/client/version.rb
140
159
  - spec/board/client_spec.rb
141
- - spec/spec.opts
160
+ - spec/cassettes/candidate_exists_with_id.yml
161
+ - spec/cassettes/candidate_id_does_not_exist.yml
162
+ - spec/cassettes/candidate_invite_email_exists.yml
163
+ - spec/cassettes/candidate_invite_when_invalid.yml
164
+ - spec/cassettes/candidate_invite_when_valid.yml
165
+ - spec/cassettes/list_user_organizations_with_invalid_id.yml
166
+ - spec/cassettes/list_user_organizations_with_valid_id.yml
167
+ - spec/cassettes/organization_add_user.yml
168
+ - spec/cassettes/organization_add_user_-_organization_does_not_exist.yml
169
+ - spec/cassettes/organization_add_user_-_user_does_not_exist.yml
170
+ - spec/cassettes/organization_create_is_invalid.yml
171
+ - spec/cassettes/organization_create_is_valid.yml
172
+ - spec/cassettes/organization_exists_with_email.yml
173
+ - spec/cassettes/organization_exists_with_id.yml
174
+ - spec/cassettes/organization_id_does_not_exist.yml
175
+ - spec/cassettes/organization_name_does_not_exist.yml
176
+ - spec/cassettes/unsubscribe_email_does_not_exist.yml
177
+ - spec/cassettes/unsubscribe_email_exists.yml
178
+ - spec/cassettes/user_does_exist.yml
179
+ - spec/cassettes/user_does_not_exist.yml
180
+ - spec/cassettes/user_email_does_not_exist.yml
181
+ - spec/cassettes/user_email_md5_does_not_exist.yml
182
+ - spec/cassettes/user_exists_with_email.yml
183
+ - spec/cassettes/user_exists_with_email_md5.yml
184
+ - spec/cassettes/user_exists_with_id.yml
185
+ - spec/cassettes/user_id_does_not_exist.yml
186
+ - spec/cassettes/user_missing_attributes.yml
187
+ - spec/integration/candidates/find_spec.rb
188
+ - spec/integration/candidates/invite_spec.rb
189
+ - spec/integration/organizations/add_user_spec.rb
190
+ - spec/integration/organizations/create_spec.rb
191
+ - spec/integration/organizations/find_spec.rb
192
+ - spec/integration/users/create_spec.rb
193
+ - spec/integration/users/find_spec.rb
194
+ - spec/integration/users/list_organizations_spec.rb
195
+ - spec/integration/users/unsubscribe_spec.rb
142
196
  - spec/spec_helper.rb
143
- has_rdoc: true
144
- homepage: http://github.com/mguterl/board-client
197
+ - spec/support/integration_helpers.rb
198
+ - spec/support/vcr.rb
199
+ homepage: http://github.com/recruitmilitary/board-client
145
200
  licenses: []
146
201
 
147
202
  post_install_message:
@@ -169,12 +224,49 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
224
  version: "0"
170
225
  requirements: []
171
226
 
172
- rubyforge_project:
173
- rubygems_version: 1.5.2
227
+ rubyforge_project: board-client
228
+ rubygems_version: 1.8.6
174
229
  signing_key:
175
230
  specification_version: 3
176
- summary: A ruby wrapper for the board platform
231
+ summary: A ruby wrapper for the RecruitMilitary Board HTTP API
177
232
  test_files:
178
- - spec/board/candidate_search_spec.rb
179
233
  - spec/board/client_spec.rb
234
+ - spec/cassettes/candidate_exists_with_id.yml
235
+ - spec/cassettes/candidate_id_does_not_exist.yml
236
+ - spec/cassettes/candidate_invite_email_exists.yml
237
+ - spec/cassettes/candidate_invite_when_invalid.yml
238
+ - spec/cassettes/candidate_invite_when_valid.yml
239
+ - spec/cassettes/list_user_organizations_with_invalid_id.yml
240
+ - spec/cassettes/list_user_organizations_with_valid_id.yml
241
+ - spec/cassettes/organization_add_user.yml
242
+ - spec/cassettes/organization_add_user_-_organization_does_not_exist.yml
243
+ - spec/cassettes/organization_add_user_-_user_does_not_exist.yml
244
+ - spec/cassettes/organization_create_is_invalid.yml
245
+ - spec/cassettes/organization_create_is_valid.yml
246
+ - spec/cassettes/organization_exists_with_email.yml
247
+ - spec/cassettes/organization_exists_with_id.yml
248
+ - spec/cassettes/organization_id_does_not_exist.yml
249
+ - spec/cassettes/organization_name_does_not_exist.yml
250
+ - spec/cassettes/unsubscribe_email_does_not_exist.yml
251
+ - spec/cassettes/unsubscribe_email_exists.yml
252
+ - spec/cassettes/user_does_exist.yml
253
+ - spec/cassettes/user_does_not_exist.yml
254
+ - spec/cassettes/user_email_does_not_exist.yml
255
+ - spec/cassettes/user_email_md5_does_not_exist.yml
256
+ - spec/cassettes/user_exists_with_email.yml
257
+ - spec/cassettes/user_exists_with_email_md5.yml
258
+ - spec/cassettes/user_exists_with_id.yml
259
+ - spec/cassettes/user_id_does_not_exist.yml
260
+ - spec/cassettes/user_missing_attributes.yml
261
+ - spec/integration/candidates/find_spec.rb
262
+ - spec/integration/candidates/invite_spec.rb
263
+ - spec/integration/organizations/add_user_spec.rb
264
+ - spec/integration/organizations/create_spec.rb
265
+ - spec/integration/organizations/find_spec.rb
266
+ - spec/integration/users/create_spec.rb
267
+ - spec/integration/users/find_spec.rb
268
+ - spec/integration/users/list_organizations_spec.rb
269
+ - spec/integration/users/unsubscribe_spec.rb
180
270
  - spec/spec_helper.rb
271
+ - spec/support/integration_helpers.rb
272
+ - spec/support/vcr.rb
@@ -1,22 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- addressable (2.2.1)
5
- crack (0.1.8)
6
- mime-types (1.16)
7
- rest-client (1.6.1)
8
- mime-types (>= 1.16)
9
- rspec (1.3.0)
10
- webmock (1.3.5)
11
- addressable (>= 2.1.1)
12
- crack (>= 0.1.7)
13
- yajl-ruby (0.7.7)
14
-
15
- PLATFORMS
16
- ruby
17
-
18
- DEPENDENCIES
19
- rest-client (~> 1.6.1)
20
- rspec (~> 1.3.0)
21
- webmock (~> 1.3.5)
22
- yajl-ruby (~> 0.7.7)
@@ -1,45 +0,0 @@
1
- module Board
2
-
3
- class CandidateSearch
4
-
5
- attr_reader :errors
6
-
7
- def initialize(client, params = {})
8
- @client = client
9
- @params = params
10
- @errors = []
11
- end
12
-
13
- def results
14
- initial_search['results']
15
- end
16
-
17
- def each_result
18
- total = initial_search['total']
19
- pages = (total / 10.0).ceil
20
-
21
- initial_search['results'].each { |r| yield r }
22
-
23
- (2..pages).each do |page|
24
- search = @client.candidate_searches(@params.merge(:page => page))
25
- results = search['results']
26
- results.each { |r| yield r }
27
- end
28
- end
29
-
30
- def valid?
31
- perform_search and @errors.empty?
32
- end
33
-
34
- private
35
-
36
- def initial_search
37
- @initial_search ||= @client.candidate_searches(@params)
38
- rescue Board::Request::Error => e
39
- @errors = Yajl::Parser.parse(e.response.body)
40
- end
41
- alias perform_search initial_search
42
-
43
- end
44
-
45
- end
@@ -1,78 +0,0 @@
1
- require 'uri'
2
- require 'net/http'
3
- require 'net/https'
4
-
5
- module Board
6
- module Request
7
-
8
- class Error < StandardError
9
- attr_reader :response
10
-
11
- def initialize(response)
12
- @response = response
13
- end
14
- end
15
-
16
- private
17
-
18
- def post(path, params)
19
- request path, params, :post
20
- end
21
-
22
- def get(path, params)
23
- request path, params, :get
24
- end
25
-
26
- def request(path, params, method)
27
- params.merge!(:user_credentials => @api_key)
28
-
29
- uri = URI.parse(@url + path)
30
- http = Net::HTTP.new(uri.host, uri.port)
31
- http.use_ssl = true
32
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
33
-
34
- case method
35
- when :get
36
- request = Net::HTTP::Get.new(uri.request_uri)
37
- when :post
38
- request = Net::HTTP::Post.new(uri.request_uri)
39
- end
40
-
41
- request.set_form_data(params)
42
- response = http.request(request)
43
-
44
- if response.code =~ /2../
45
- Yajl::Parser.parse(response.body)
46
- else
47
- raise Error.new(response)
48
- end
49
- end
50
-
51
- def hash_to_query_string(hash)
52
- params = ''
53
- stack = []
54
-
55
- hash.each do |k, v|
56
- if v.is_a?(Hash)
57
- stack << [k,v]
58
- else
59
- params << "#{k}=#{v}&"
60
- end
61
- end
62
-
63
- stack.each do |parent, hash|
64
- hash.each do |k, v|
65
- if v.is_a?(Hash)
66
- stack << ["#{parent}[#{k}]", v]
67
- else
68
- params << "#{parent}[#{k}]=#{v}&"
69
- end
70
- end
71
- end
72
-
73
- params.chop! # trailing &
74
- params
75
- end
76
-
77
- end
78
- end
@@ -1,45 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Board::CandidateSearch do
4
-
5
- let(:search) { Board::CandidateSearch.new(client, :keywords => 'ruby') }
6
- let(:client) { Board::Client.new('VALID_KEY') }
7
-
8
- before do
9
- stub_request(:get, "https://board.recruitmilitary.com/api/v1/candidate_searches").
10
- with(:body => "user_credentials=VALID_KEY&keywords=ruby").
11
- to_return(:body => %q{{"results":[{"email":"candidate@recruitmilitary.com","zip_code":null,"last_activity_at":"2010-11-24T14:13:26Z","phone":null,"state":"OH","last_name":"Smith","first_name":"Rodolfo","resume_url":null,"location":"Hagenesside, OH","city":"Hagenesside"},{"email":"benton@effertz.info","zip_code":null,"last_activity_at":"2010-11-16T14:13:26Z","phone":null,"state":"OH","last_name":"Bins","first_name":"Alfred","resume_url":null,"location":"East Elizabeth, OH","city":"East Elizabeth"},{"email":"melba@armstrong.us","zip_code":null,"last_activity_at":"2010-11-22T14:13:27Z","phone":null,"state":"OH","last_name":"Pouros","first_name":"Warren","resume_url":null,"location":"Margemouth, OH","city":"Margemouth"},{"email":"yvette@lynch.name","zip_code":null,"last_activity_at":"2010-11-25T14:13:27Z","phone":null,"state":"OH","last_name":"Denesik","first_name":"Isai","resume_url":null,"location":"Lake Othaton, OH","city":"Lake Othaton"},{"email":"hipolito.mosciski@schoenbrown.uk","zip_code":null,"last_activity_at":"2010-11-25T14:13:28Z","phone":null,"state":"OH","last_name":"Paucek","first_name":"Cristina","resume_url":"https://localhost/resumes/1/resume.pdf","location":"East Aiden, OH","city":"East Aiden"},{"email":"lydia@cassin.name","zip_code":null,"last_activity_at":"2010-11-13T14:13:29Z","phone":null,"state":"OH","last_name":"Johnson","first_name":"Marianna","resume_url":null,"location":"Bartonhaven, OH","city":"Bartonhaven"},{"email":"gabe@price.ca","zip_code":null,"last_activity_at":"2010-11-16T14:13:29Z","phone":null,"state":"OH","last_name":"Wolf","first_name":"Idell","resume_url":"https://localhost/resumes/2/resume.pdf","location":"South Angelinestad, OH","city":"South Angelinestad"},{"email":"monserrat_douglas@zemlakbrekke.biz","zip_code":null,"last_activity_at":"2010-11-16T14:13:30Z","phone":null,"state":"OH","last_name":"Shanahan","first_name":"Zelda","resume_url":null,"location":"Mosesstad, OH","city":"Mosesstad"},{"email":"vada.hauck@gaylordbosco.co.uk","zip_code":null,"last_activity_at":"2010-11-12T14:13:30Z","phone":null,"state":"OH","last_name":"Bergstrom","first_name":"Anabelle","resume_url":null,"location":"Cliffordhaven, OH","city":"Cliffordhaven"},{"email":"maeve@abernathywaelchi.info","zip_code":null,"last_activity_at":"2010-12-01T14:13:31Z","phone":null,"state":"OH","last_name":"Gibson","first_name":"Rubie","resume_url":null,"location":"New Tre, OH","city":"New Tre"}],"page":1,"total":15}})
12
- stub_request(:get, "https://board.recruitmilitary.com/api/v1/candidate_searches").
13
- with(:body => "user_credentials=VALID_KEY&page=2&keywords=ruby").
14
- to_return(:body => %q{{"results":[{"email":"candidate@recruitmilitary.com","zip_code":null,"last_activity_at":"2010-11-24T14:13:26Z","phone":null,"state":"OH","last_name":"Smith","first_name":"Rodolfo","resume_url":null,"location":"Hagenesside, OH","city":"Hagenesside"},{"email":"benton@effertz.info","zip_code":null,"last_activity_at":"2010-11-16T14:13:26Z","phone":null,"state":"OH","last_name":"Bins","first_name":"Alfred","resume_url":null,"location":"East Elizabeth, OH","city":"East Elizabeth"},{"email":"melba@armstrong.us","zip_code":null,"last_activity_at":"2010-11-22T14:13:27Z","phone":null,"state":"OH","last_name":"Pouros","first_name":"Warren","resume_url":null,"location":"Margemouth, OH","city":"Margemouth"},{"email":"yvette@lynch.name","zip_code":null,"last_activity_at":"2010-11-25T14:13:27Z","phone":null,"state":"OH","last_name":"Denesik","first_name":"Isai","resume_url":null,"location":"Lake Othaton, OH","city":"Lake Othaton"},{"email":"hipolito.mosciski@schoenbrown.uk","zip_code":null,"last_activity_at":"2010-11-25T14:13:28Z","phone":null,"state":"OH","last_name":"Paucek","first_name":"Cristina","resume_url":"https://localhost/resumes/1/resume.pdf","location":"East Aiden, OH","city":"East Aiden"}],"page":2,"total":15}})
15
- stub_request(:get, "https://board.recruitmilitary.com/api/v1/candidate_searches").
16
- with(:body => "user_credentials=VALID_KEY&per_page=501").
17
- to_return(:body => %q{[["per_page", "must be less than or equal to 500"]]},
18
- :status => 422)
19
- end
20
-
21
- describe "searching", "when valid" do
22
- it 'returns the correct number of results' do
23
- search.results.size.should == 10
24
- end
25
-
26
- it 'iterates through all results' do
27
- results = []
28
- search.each_result do |result|
29
- results << result
30
- end
31
- results.size.should == 15
32
- end
33
- end
34
-
35
- describe "searching", "when invalid" do
36
- let(:search) { Board::CandidateSearch.new(client, :per_page => '501') }
37
-
38
- it 'returns a collection of errors' do
39
- search.valid?
40
-
41
- search.errors.should == [["per_page", "must be less than or equal to 500"]]
42
- end
43
- end
44
-
45
- end