gds-api-adapters 2.8.0 → 2.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,6 +29,7 @@ module GdsApi
29
29
  request_path << "&format_filter=#{CGI.escape(format_filter)}" if format_filter
30
30
  uri = URI("#{search_uri}#{request_path}")
31
31
  http = Net::HTTP.new(uri.host, uri.port)
32
+ http.use_ssl = true if uri.scheme == 'https'
32
33
  response = http.get(uri.request_uri, {"Accept" => "application/json"})
33
34
  raise SearchServiceError.new("#{response.code}: #{response.body}") unless response.code == "200"
34
35
  response
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '2.8.0'
2
+ VERSION = '2.8.1'
3
3
  end
@@ -72,6 +72,26 @@ describe GdsApi::Rummager do
72
72
  assert_requested :get, /format_filter=specialist_guidance/
73
73
  end
74
74
 
75
+ it "should not tell the http client to use ssl if we're connecting to an http host" do
76
+ response = stub('response', code: '200', body: '[]')
77
+ http = stub('http', get: response)
78
+ Net::HTTP.stubs(:new).returns(http)
79
+
80
+ http.expects(:use_ssl=).never
81
+
82
+ client = GdsApi::Rummager.new("http://example.com").search "search-term"
83
+ end
84
+
85
+ it "should tell the http client to use ssl if we're connecting to an https host" do
86
+ response = stub('response', code: '200', body: '[]')
87
+ http = stub('http', get: response)
88
+ Net::HTTP.stubs(:new).returns(http)
89
+
90
+ http.expects(:use_ssl=).with(true)
91
+
92
+ client = GdsApi::Rummager.new("https://example.com").search "search-term"
93
+ end
94
+
75
95
  it "should add a format filter parameter to autocomplete if provided" do
76
96
  GdsApi::Rummager.new("http://example.com").autocomplete "search-term", "specialist_guidance"
77
97
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.8.0
5
+ version: 2.8.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Stewart
@@ -205,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
- hash: -243511613045247910
208
+ hash: -3426939918744885980
209
209
  segments:
210
210
  - 0
211
211
  version: "0"
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  requirements:
215
215
  - - ">="
216
216
  - !ruby/object:Gem::Version
217
- hash: -243511613045247910
217
+ hash: -3426939918744885980
218
218
  segments:
219
219
  - 0
220
220
  version: "0"