gds-api-adapters 10.0.0 → 10.1.0
Sign up to get free protection for your applications and to get access to all the features.
data/lib/gds_api/version.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'gds_api/external_link_tracker'
|
3
|
+
|
4
|
+
describe GdsApi::ExternalLinkTracker do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@base_api_url = "http://link-tracker-api.example.com"
|
8
|
+
@api = GdsApi::ExternalLinkTracker.new(@base_api_url)
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "managing links" do
|
12
|
+
it "should allow creating an external link" do
|
13
|
+
req = WebMock.stub_request(:put, "#{@base_api_url}/url?url=http%3A%2F%2Ffoo.example.com%2F").
|
14
|
+
to_return(:status => 201,
|
15
|
+
:headers => {"Content-type" => "application/json"})
|
16
|
+
|
17
|
+
response = @api.add_external_link("http://foo.example.com/")
|
18
|
+
assert_equal 201, response.code
|
19
|
+
|
20
|
+
assert_requested(req)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should raise an error if creating an external link fails" do
|
24
|
+
req = WebMock.stub_request(:put, "#{@base_api_url}/url?url=invalid").
|
25
|
+
to_return(:status => 400, :headers => {"Content-type" => "application/json"})
|
26
|
+
|
27
|
+
e = nil
|
28
|
+
begin
|
29
|
+
@api.add_external_link("invalid")
|
30
|
+
rescue GdsApi::HTTPErrorResponse => ex
|
31
|
+
e = ex
|
32
|
+
end
|
33
|
+
|
34
|
+
refute_nil e
|
35
|
+
assert_equal 400, e.code
|
36
|
+
|
37
|
+
assert_requested(req)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-api-adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 10.
|
4
|
+
version: 10.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: plek
|
@@ -325,6 +325,7 @@ files:
|
|
325
325
|
- lib/gds_api/publisher.rb
|
326
326
|
- lib/gds_api/router.rb
|
327
327
|
- lib/gds_api/business_support_api.rb
|
328
|
+
- lib/gds_api/external_link_tracker.rb
|
328
329
|
- lib/gds_api/content_api.rb
|
329
330
|
- README.md
|
330
331
|
- Rakefile
|
@@ -350,6 +351,7 @@ files:
|
|
350
351
|
- test/fixtures/world_organisations_australia.json
|
351
352
|
- test/router_test.rb
|
352
353
|
- test/list_response_test.rb
|
354
|
+
- test/external_link_tracker_test.rb
|
353
355
|
- test/gds_api_base_test.rb
|
354
356
|
- test/worldwide_api_test.rb
|
355
357
|
- test/test_helper.rb
|
@@ -368,7 +370,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
368
370
|
version: '0'
|
369
371
|
segments:
|
370
372
|
- 0
|
371
|
-
hash:
|
373
|
+
hash: 1572270055243404070
|
372
374
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
373
375
|
none: false
|
374
376
|
requirements:
|
@@ -377,7 +379,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
377
379
|
version: '0'
|
378
380
|
segments:
|
379
381
|
- 0
|
380
|
-
hash:
|
382
|
+
hash: 1572270055243404070
|
381
383
|
requirements: []
|
382
384
|
rubyforge_project:
|
383
385
|
rubygems_version: 1.8.23
|
@@ -407,6 +409,7 @@ test_files:
|
|
407
409
|
- test/fixtures/world_organisations_australia.json
|
408
410
|
- test/router_test.rb
|
409
411
|
- test/list_response_test.rb
|
412
|
+
- test/external_link_tracker_test.rb
|
410
413
|
- test/gds_api_base_test.rb
|
411
414
|
- test/worldwide_api_test.rb
|
412
415
|
- test/test_helper.rb
|