board-client 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/board-client.gemspec +5 -5
- data/lib/board/request.rb +18 -8
- data/spec/board/candidate_search_spec.rb +6 -3
- data/spec/spec_helper.rb +1 -1
- metadata +8 -8
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ begin
|
|
13
13
|
gem.add_dependency "rest-client", "~> 1.6.1"
|
14
14
|
gem.add_dependency "yajl-ruby", "~> 0.7.7"
|
15
15
|
gem.add_development_dependency "rspec", "~> 1.3.0"
|
16
|
-
gem.add_development_dependency "webmock", "~> 1.
|
16
|
+
gem.add_development_dependency "webmock", "~> 1.6.2"
|
17
17
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
18
|
end
|
19
19
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/board-client.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{board-client}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
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-05-
|
12
|
+
s.date = %q{2011-05-04}
|
13
13
|
s.description = %q{A ruby wrapper for the board platform.}
|
14
14
|
s.email = %q{mguterl@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -53,14 +53,14 @@ Gem::Specification.new do |s|
|
|
53
53
|
s.add_runtime_dependency(%q<rest-client>, ["~> 1.6.1"])
|
54
54
|
s.add_runtime_dependency(%q<yajl-ruby>, ["~> 0.7.7"])
|
55
55
|
s.add_development_dependency(%q<rspec>, ["~> 1.3.0"])
|
56
|
-
s.add_development_dependency(%q<webmock>, ["~> 1.
|
56
|
+
s.add_development_dependency(%q<webmock>, ["~> 1.6.2"])
|
57
57
|
else
|
58
58
|
s.add_dependency(%q<rest-client>, ["~> 1.6.1"])
|
59
59
|
s.add_dependency(%q<yajl-ruby>, ["~> 0.7.7"])
|
60
60
|
s.add_dependency(%q<rest-client>, ["~> 1.6.1"])
|
61
61
|
s.add_dependency(%q<yajl-ruby>, ["~> 0.7.7"])
|
62
62
|
s.add_dependency(%q<rspec>, ["~> 1.3.0"])
|
63
|
-
s.add_dependency(%q<webmock>, ["~> 1.
|
63
|
+
s.add_dependency(%q<webmock>, ["~> 1.6.2"])
|
64
64
|
end
|
65
65
|
else
|
66
66
|
s.add_dependency(%q<rest-client>, ["~> 1.6.1"])
|
@@ -68,7 +68,7 @@ Gem::Specification.new do |s|
|
|
68
68
|
s.add_dependency(%q<rest-client>, ["~> 1.6.1"])
|
69
69
|
s.add_dependency(%q<yajl-ruby>, ["~> 0.7.7"])
|
70
70
|
s.add_dependency(%q<rspec>, ["~> 1.3.0"])
|
71
|
-
s.add_dependency(%q<webmock>, ["~> 1.
|
71
|
+
s.add_dependency(%q<webmock>, ["~> 1.6.2"])
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
data/lib/board/request.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'net/http'
|
3
|
+
require 'net/https'
|
4
|
+
|
1
5
|
module Board
|
2
6
|
module Request
|
3
7
|
|
@@ -22,14 +26,20 @@ module Board
|
|
22
26
|
def request(path, params, method)
|
23
27
|
params.merge!(:user_credentials => @api_key)
|
24
28
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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)
|
33
43
|
|
34
44
|
if response.code =~ /2../
|
35
45
|
Yajl::Parser.parse(response.body)
|
@@ -6,11 +6,14 @@ describe Board::CandidateSearch do
|
|
6
6
|
let(:client) { Board::Client.new('VALID_KEY') }
|
7
7
|
|
8
8
|
before do
|
9
|
-
stub_request(:get, "
|
9
|
+
stub_request(:get, "https://board.recruitmilitary.com/api/v1/candidate_searches").
|
10
|
+
with(:body => "user_credentials=VALID_KEY&keywords=ruby").
|
10
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}})
|
11
|
-
stub_request(:get, "
|
12
|
+
stub_request(:get, "https://board.recruitmilitary.com/api/v1/candidate_searches").
|
13
|
+
with(:body => "user_credentials=VALID_KEY&page=2&keywords=ruby").
|
12
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}})
|
13
|
-
stub_request(:get, "
|
15
|
+
stub_request(:get, "https://board.recruitmilitary.com/api/v1/candidate_searches").
|
16
|
+
with(:body => "user_credentials=VALID_KEY&per_page=501").
|
14
17
|
to_return(:body => %q{[["per_page", "must be less than or equal to 500"]]},
|
15
18
|
:status => 422)
|
16
19
|
end
|
data/spec/spec_helper.rb
CHANGED
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:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.3.0
|
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-05-
|
18
|
+
date: 2011-05-04 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -104,12 +104,12 @@ dependencies:
|
|
104
104
|
requirements:
|
105
105
|
- - ~>
|
106
106
|
- !ruby/object:Gem::Version
|
107
|
-
hash:
|
107
|
+
hash: 11
|
108
108
|
segments:
|
109
109
|
- 1
|
110
|
-
-
|
111
|
-
-
|
112
|
-
version: 1.
|
110
|
+
- 6
|
111
|
+
- 2
|
112
|
+
version: 1.6.2
|
113
113
|
version_requirements: *id006
|
114
114
|
name: webmock
|
115
115
|
prerelease: false
|