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 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.3.5"
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.2.0
1
+ 0.3.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{board-client}
8
- s.version = "0.2.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-03}
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.3.5"])
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.3.5"])
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.3.5"])
71
+ s.add_dependency(%q<webmock>, ["~> 1.6.2"])
72
72
  end
73
73
  end
74
74
 
@@ -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
- response = case method
26
- when :get
27
- uri = URI.parse(@url + path + "?" + hash_to_query_string(params))
28
- Net::HTTP.get_response(uri)
29
- when :post
30
- uri = URI.parse(@url + path)
31
- Net::HTTP.post_form(uri, params)
32
- end
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, "http://board.recruitmilitary.com:443/api/v1/candidate_searches?keywords=ruby&user_credentials=VALID_KEY").
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, "http://board.recruitmilitary.com:443/api/v1/candidate_searches?keywords=ruby&page=2&user_credentials=VALID_KEY").
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, "http://board.recruitmilitary.com:443/api/v1/candidate_searches?per_page=501&user_credentials=VALID_KEY").
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
@@ -8,5 +8,5 @@ require 'webmock/rspec'
8
8
  require 'yajl/json_gem' # required for webmock
9
9
 
10
10
  Spec::Runner.configure do |config|
11
- config.include WebMock
11
+ config.include WebMock::API
12
12
  end
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: 23
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.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-03 00:00:00 -04:00
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: 17
107
+ hash: 11
108
108
  segments:
109
109
  - 1
110
- - 3
111
- - 5
112
- version: 1.3.5
110
+ - 6
111
+ - 2
112
+ version: 1.6.2
113
113
  version_requirements: *id006
114
114
  name: webmock
115
115
  prerelease: false