gds-api-adapters 37.5.1 → 38.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -11
- data/lib/gds-api-adapters.rb +0 -1
- data/lib/gds_api/asset_manager.rb +1 -0
- data/lib/gds_api/content_store.rb +3 -10
- data/lib/gds_api/email_alert_api.rb +1 -0
- data/lib/gds_api/helpers.rb +1 -6
- data/lib/gds_api/json_client.rb +2 -15
- data/lib/gds_api/list_response.rb +1 -5
- data/lib/gds_api/need_api.rb +4 -0
- data/lib/gds_api/publishing_api.rb +0 -17
- data/lib/gds_api/publishing_api_v2.rb +12 -20
- data/lib/gds_api/response.rb +0 -26
- data/lib/gds_api/rummager.rb +14 -3
- data/lib/gds_api/support_api.rb +1 -0
- data/lib/gds_api/test_helpers/need_api.rb +7 -0
- data/lib/gds_api/test_helpers/publishing_api.rb +0 -27
- data/lib/gds_api/version.rb +1 -1
- data/test/content_store_test.rb +0 -43
- data/test/helpers_test.rb +0 -1
- data/test/json_client_test.rb +0 -135
- data/test/need_api_test.rb +16 -0
- data/test/publishing_api_test.rb +0 -58
- data/test/response_test.rb +0 -63
- data/test/rummager_test.rb +2 -2
- data/test/test_helpers/publishing_api_test.rb +0 -29
- metadata +2 -12
- data/lib/gds_api/config.rb +0 -76
- data/lib/gds_api/external_link_tracker.rb +0 -7
- data/lib/gds_api/needotron.rb +0 -19
- data/lib/gds_api/part_methods.rb +0 -44
- data/lib/gds_api/publisher.rb +0 -51
- data/lib/gds_api/test_helpers/publisher.rb +0 -60
- data/test/external_link_tracker_test.rb +0 -40
- data/test/publisher_api_test.rb +0 -109
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23123cc90f6e6077cdf5a7de6e74d907edc342ff
|
4
|
+
data.tar.gz: ee93d8020f7a0fe4ed2e5423ba74b0aae2fd1ba5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3c79f7ac64677d81e32ce74c4d902f0c20df897a64d5f707cafb8e4277a65d837cd39423b00b234e521693e56e3bf99ab25279ecf35ab1986c8869314df7faf
|
7
|
+
data.tar.gz: 0366d6b00750732521a469f260bac9323698f7b6d14986c86267e44adbe63a7d7f726728c4c324d14c141b87e8e50f2cc3ac40bb26a1ba7eda9fe803a38b84ef
|
data/README.md
CHANGED
@@ -16,17 +16,6 @@ Example adapters for frequently used applications:
|
|
16
16
|
- [Content Store](lib/gds_api/content_store.rb) ([docs](http://www.rubydoc.info/gems/gds-api-adapters/GdsApi/ContentStore), [test helper code](https://github.com/alphagov/gds-api-adapters/blob/master/lib/gds_api/test_helpers/content_store.rb), [test helper docs](http://www.rubydoc.info/gems/gds-api-adapters/GdsApi/TestHelpers/ContentStore))
|
17
17
|
- [Rummager](lib/gds_api/rummager.rb) ([docs](http://www.rubydoc.info/gems/gds-api-adapters/GdsApi/Rummager), [test helper code](https://github.com/alphagov/gds-api-adapters/blob/master/lib/gds_api/test_helpers/rummager.rb), [test helper docs](http://www.rubydoc.info/gems/gds-api-adapters/GdsApi/TestHelpers/Rummager))
|
18
18
|
|
19
|
-
## Configuration
|
20
|
-
|
21
|
-
From December 1st, 2016 it won't be possible to use the following configuration
|
22
|
-
options:
|
23
|
-
|
24
|
-
- `always_raise_for_not_found`
|
25
|
-
- `hash_response_for_requests`
|
26
|
-
|
27
|
-
Please remove these configuration options from your client application and
|
28
|
-
migrate to the new behaviour as soon as possible.
|
29
|
-
|
30
19
|
## Logging
|
31
20
|
|
32
21
|
Each HTTP request can be logged as JSON. Example:
|
data/lib/gds-api-adapters.rb
CHANGED
@@ -10,20 +10,13 @@ class GdsApi::ContentStore < GdsApi::Base
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def content_item(base_path)
|
13
|
-
get_json(content_item_url(base_path))
|
14
|
-
end
|
15
|
-
|
16
|
-
def incoming_links!(base_path, params = {})
|
17
|
-
query = query_string(params)
|
18
|
-
get_json!("#{endpoint}/incoming-links#{base_path}#{query}")
|
13
|
+
get_json!(content_item_url(base_path))
|
19
14
|
rescue GdsApi::HTTPNotFound => e
|
20
15
|
raise ItemNotFound.build_from(e)
|
21
16
|
end
|
22
17
|
|
23
|
-
def content_item!(
|
24
|
-
|
25
|
-
rescue GdsApi::HTTPNotFound => e
|
26
|
-
raise ItemNotFound.build_from(e)
|
18
|
+
def content_item!(_)
|
19
|
+
raise "`ContentStore#content_item!` is deprecated. Use `ContentStore#content_item` instead"
|
27
20
|
end
|
28
21
|
|
29
22
|
private
|
data/lib/gds_api/helpers.rb
CHANGED
@@ -6,7 +6,6 @@ require 'gds_api/imminence'
|
|
6
6
|
require 'gds_api/licence_application'
|
7
7
|
require 'gds_api/need_api'
|
8
8
|
require 'gds_api/panopticon'
|
9
|
-
require 'gds_api/publisher'
|
10
9
|
require 'gds_api/worldwide'
|
11
10
|
require 'gds_api/email_alert_api'
|
12
11
|
|
@@ -28,10 +27,6 @@ module GdsApi
|
|
28
27
|
@content_store ||= GdsApi::ContentStore.new(Plek.current.find("content-store"), options)
|
29
28
|
end
|
30
29
|
|
31
|
-
def publisher_api(options = {})
|
32
|
-
@api ||= GdsApi::Publisher.new(Plek.current.find("publisher"), options)
|
33
|
-
end
|
34
|
-
|
35
30
|
def imminence_api(options = {})
|
36
31
|
@imminence_api ||= GdsApi::Imminence.new(Plek.current.find("imminence"), options)
|
37
32
|
end
|
@@ -62,7 +57,7 @@ module GdsApi
|
|
62
57
|
|
63
58
|
def self.included(klass)
|
64
59
|
if klass.respond_to?(:helper_method)
|
65
|
-
klass.helper_method :
|
60
|
+
klass.helper_method :panopticon_api, :imminence_api, :content_api, :licence_application_api
|
66
61
|
end
|
67
62
|
end
|
68
63
|
end
|
data/lib/gds_api/json_client.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require_relative 'config'
|
2
1
|
require_relative 'response'
|
3
2
|
require_relative 'exceptions'
|
4
3
|
require_relative 'version'
|
@@ -75,13 +74,7 @@ module GdsApi
|
|
75
74
|
end
|
76
75
|
|
77
76
|
def get_raw(url)
|
78
|
-
|
79
|
-
get_raw!(url)
|
80
|
-
else
|
81
|
-
ignoring_missing do
|
82
|
-
get_raw!(url)
|
83
|
-
end
|
84
|
-
end
|
77
|
+
get_raw!(url)
|
85
78
|
end
|
86
79
|
|
87
80
|
# Define "safe" methods for each supported HTTP method
|
@@ -92,13 +85,7 @@ module GdsApi
|
|
92
85
|
[:get, :post, :put, :patch, :delete].each do |http_method|
|
93
86
|
method_name = "#{http_method}_json"
|
94
87
|
define_method method_name do |url, *args, &block|
|
95
|
-
|
96
|
-
send (method_name + "!"), url, *args, &block
|
97
|
-
else
|
98
|
-
ignoring_missing do
|
99
|
-
send (method_name + "!"), url, *args, &block
|
100
|
-
end
|
101
|
-
end
|
88
|
+
send (method_name + "!"), url, *args, &block
|
102
89
|
end
|
103
90
|
end
|
104
91
|
|
@@ -26,11 +26,7 @@ module GdsApi
|
|
26
26
|
# support group_by results from the content api by checking if there is a
|
27
27
|
# grouped_results key present first. if it's not, then fallback to the
|
28
28
|
# results key
|
29
|
-
|
30
|
-
to_hash["grouped_results"] || to_hash["results"]
|
31
|
-
else
|
32
|
-
to_ostruct.grouped_results || to_ostruct.results
|
33
|
-
end
|
29
|
+
to_hash["grouped_results"] || to_hash["results"]
|
34
30
|
end
|
35
31
|
|
36
32
|
def has_next_page?
|
data/lib/gds_api/need_api.rb
CHANGED
@@ -8,6 +8,10 @@ class GdsApi::NeedApi < GdsApi::Base
|
|
8
8
|
get_list!("#{endpoint}/needs#{query}")
|
9
9
|
end
|
10
10
|
|
11
|
+
def content_id(need_id)
|
12
|
+
get_raw("#{endpoint}/needs/#{CGI.escape(need_id.to_s)}/content_id")
|
13
|
+
end
|
14
|
+
|
11
15
|
def needs_by_id(*ids)
|
12
16
|
ids_string = ids.flatten.map(&:to_i).sort.join(',')
|
13
17
|
query = query_string(ids: ids_string)
|
@@ -3,14 +3,6 @@ require_relative 'exceptions'
|
|
3
3
|
|
4
4
|
class GdsApi::PublishingApi < GdsApi::Base
|
5
5
|
|
6
|
-
def put_draft_content_item(base_path, payload)
|
7
|
-
put_json!(draft_content_item_url(base_path), payload)
|
8
|
-
end
|
9
|
-
|
10
|
-
def put_content_item(base_path, payload)
|
11
|
-
put_json!(content_item_url(base_path), payload)
|
12
|
-
end
|
13
|
-
|
14
6
|
def put_intent(base_path, payload)
|
15
7
|
put_json!(intent_url(base_path), payload)
|
16
8
|
end
|
@@ -25,17 +17,8 @@ class GdsApi::PublishingApi < GdsApi::Base
|
|
25
17
|
put_json!(paths_url(base_path), payload)
|
26
18
|
end
|
27
19
|
|
28
|
-
|
29
20
|
private
|
30
21
|
|
31
|
-
def draft_content_item_url(base_path)
|
32
|
-
"#{endpoint}/draft-content#{base_path}"
|
33
|
-
end
|
34
|
-
|
35
|
-
def content_item_url(base_path)
|
36
|
-
"#{endpoint}/content#{base_path}"
|
37
|
-
end
|
38
|
-
|
39
22
|
def intent_url(base_path)
|
40
23
|
"#{endpoint}/publish-intent#{base_path}"
|
41
24
|
end
|
@@ -5,6 +5,7 @@ require_relative 'base'
|
|
5
5
|
# @see https://github.com/alphagov/publishing-api
|
6
6
|
# @see https://github.com/alphagov/publishing-api/blob/master/doc/publishing-application-examples.md
|
7
7
|
# @see https://github.com/alphagov/publishing-api/blob/master/doc/model.md
|
8
|
+
# @api documented
|
8
9
|
class GdsApi::PublishingApiV2 < GdsApi::Base
|
9
10
|
# Put a content item
|
10
11
|
#
|
@@ -18,32 +19,23 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
18
19
|
|
19
20
|
# Return a content item
|
20
21
|
#
|
21
|
-
#
|
22
|
+
# Raises exception if the item doesn't exist.
|
22
23
|
#
|
23
24
|
# @param content_id [UUID]
|
24
25
|
# @param params [Hash]
|
25
26
|
# @option params [String] locale The language, defaults to 'en' in publishing-api.
|
26
27
|
#
|
27
28
|
# @return [GdsApi::Response] a content item
|
29
|
+
#
|
30
|
+
# @raise [HTTPNotFound] when the content item is not found
|
28
31
|
# @see https://github.com/alphagov/publishing-api/blob/master/doc/api.md#get-v2contentcontent_id
|
29
32
|
def get_content(content_id, params = {})
|
30
33
|
get_json(content_url(content_id, params))
|
31
34
|
end
|
32
35
|
|
33
|
-
#
|
34
|
-
|
35
|
-
|
36
|
-
#
|
37
|
-
# @param content_id [UUID]
|
38
|
-
# @param params [Hash]
|
39
|
-
# @option params [String] locale The language, defaults to 'en' in publishing-api.
|
40
|
-
#
|
41
|
-
# @return [GdsApi::Response] a content item
|
42
|
-
#
|
43
|
-
# @raise [HTTPNotFound] when the content item is not found
|
44
|
-
# @see https://github.com/alphagov/publishing-api/blob/master/doc/api.md#get-v2contentcontent_id
|
45
|
-
def get_content!(content_id, params = {})
|
46
|
-
get_json!(content_url(content_id, params))
|
36
|
+
# @private
|
37
|
+
def get_content!(*)
|
38
|
+
raise "`PublishingApiV2#delete_content!` is deprecated. Use `PublishingApiV2#delete_content`"
|
47
39
|
end
|
48
40
|
|
49
41
|
# Find the content_ids for a list of base_paths.
|
@@ -88,8 +80,8 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
88
80
|
#
|
89
81
|
# @param content_id [UUID]
|
90
82
|
# @param update_type [String] Either 'major', 'minor' or 'republish'
|
91
|
-
# @param
|
92
|
-
# @option
|
83
|
+
# @param options [Hash]
|
84
|
+
# @option options [String] locale The language, defaults to 'en' in publishing-api.
|
93
85
|
#
|
94
86
|
# @see https://github.com/alphagov/publishing-api/blob/master/doc/api.md#post-v2contentcontent_idpublish
|
95
87
|
def publish(content_id, update_type, options = {})
|
@@ -142,9 +134,9 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
142
134
|
#
|
143
135
|
# Deletes the draft content item.
|
144
136
|
#
|
145
|
-
# @param
|
146
|
-
# @option
|
147
|
-
# @option
|
137
|
+
# @param options [Hash]
|
138
|
+
# @option options [String] locale The language, defaults to 'en' in publishing-api.
|
139
|
+
# @option options [Integer] previous_version used to ensure the request is discarding the latest lock version of the draft
|
148
140
|
#
|
149
141
|
# @see https://github.com/alphagov/publishing-api/blob/master/doc/api.md#post-v2contentcontent_iddiscard-draft
|
150
142
|
def discard_draft(content_id, options = {})
|
data/lib/gds_api/response.rb
CHANGED
@@ -78,21 +78,6 @@ module GdsApi
|
|
78
78
|
@parsed_content ||= transform_parsed(JSON.parse(@http_response.body))
|
79
79
|
end
|
80
80
|
|
81
|
-
def to_ostruct
|
82
|
-
raise NoMethodError if GdsApi.config.hash_response_for_requests
|
83
|
-
@ostruct ||= self.class.build_ostruct_recursively(parsed_content)
|
84
|
-
end
|
85
|
-
|
86
|
-
def method_missing(method_sym, *arguments, &block)
|
87
|
-
super if GdsApi.config.hash_response_for_requests
|
88
|
-
to_ostruct.public_send(method_sym, *arguments, &block)
|
89
|
-
end
|
90
|
-
|
91
|
-
def respond_to_missing?(method, include_private)
|
92
|
-
super if GdsApi.config.hash_response_for_requests
|
93
|
-
to_ostruct.respond_to?(method, include_private)
|
94
|
-
end
|
95
|
-
|
96
81
|
def present?; true; end
|
97
82
|
def blank?; false; end
|
98
83
|
|
@@ -123,16 +108,5 @@ module GdsApi
|
|
123
108
|
value
|
124
109
|
end
|
125
110
|
end
|
126
|
-
|
127
|
-
def self.build_ostruct_recursively(value)
|
128
|
-
case value
|
129
|
-
when Hash
|
130
|
-
OpenStruct.new(Hash[value.map { |k, v| [k, build_ostruct_recursively(v)] }])
|
131
|
-
when Array
|
132
|
-
value.map { |v| build_ostruct_recursively(v) }
|
133
|
-
else
|
134
|
-
value
|
135
|
-
end
|
136
|
-
end
|
137
111
|
end
|
138
112
|
end
|
data/lib/gds_api/rummager.rb
CHANGED
@@ -2,11 +2,12 @@ require 'gds_api/base'
|
|
2
2
|
require 'rack/utils'
|
3
3
|
|
4
4
|
module GdsApi
|
5
|
+
# @api documented
|
5
6
|
class Rummager < Base
|
6
7
|
|
7
8
|
# Perform a search.
|
8
9
|
#
|
9
|
-
# @param
|
10
|
+
# @param args [Hash] A valid search query. See Rummager documentation for options.
|
10
11
|
#
|
11
12
|
# @see https://github.com/alphagov/rummager/blob/master/docs/search-api.md
|
12
13
|
def search(args)
|
@@ -49,11 +50,16 @@ module GdsApi
|
|
49
50
|
#
|
50
51
|
# @param base_path Base path of the page on GOV.UK.
|
51
52
|
# @see https://github.com/alphagov/rummager/blob/master/docs/content-api.md
|
52
|
-
def delete_content
|
53
|
+
def delete_content(base_path)
|
53
54
|
request_url = "#{base_url}/content?link=#{base_path}"
|
54
55
|
delete_json!(request_url)
|
55
56
|
end
|
56
57
|
|
58
|
+
# @private
|
59
|
+
def delete_content!(*)
|
60
|
+
raise "`Rummager#delete_content!` is deprecated. Use `Rummager#delete_content`"
|
61
|
+
end
|
62
|
+
|
57
63
|
# Retrieve a content-document from the index.
|
58
64
|
#
|
59
65
|
# Content documents are pages on GOV.UK that have a base path and are
|
@@ -62,11 +68,16 @@ module GdsApi
|
|
62
68
|
#
|
63
69
|
# @param base_path [String] Base path of the page on GOV.UK.
|
64
70
|
# @see https://github.com/alphagov/rummager/blob/master/docs/content-api.md
|
65
|
-
def get_content
|
71
|
+
def get_content(base_path)
|
66
72
|
request_url = "#{base_url}/content?link=#{base_path}"
|
67
73
|
get_json!(request_url)
|
68
74
|
end
|
69
75
|
|
76
|
+
# @private
|
77
|
+
def get_content!(*)
|
78
|
+
raise "`Rummager#get_content!` is deprecated. Use `Rummager#get_content`"
|
79
|
+
end
|
80
|
+
|
70
81
|
# Delete a non-content document from the search index.
|
71
82
|
#
|
72
83
|
# For example, best bets, recommended links, or contacts.
|
data/lib/gds_api/support_api.rb
CHANGED
@@ -68,6 +68,13 @@ module GdsApi
|
|
68
68
|
stub_request(:get, url).to_return(status: 200, body: need.to_json, headers: {})
|
69
69
|
end
|
70
70
|
|
71
|
+
def need_api_has_content_id_for_need(need)
|
72
|
+
need_id = need["id"] || need[:id]
|
73
|
+
|
74
|
+
url = NEED_API_ENDPOINT + "/needs/#{need_id}/content_id"
|
75
|
+
stub_request(:get, url).to_return(body: need[:content_id])
|
76
|
+
end
|
77
|
+
|
71
78
|
def need_api_has_raw_response_for_page(response, page = nil)
|
72
79
|
url = NEED_API_ENDPOINT + "/needs"
|
73
80
|
url << "?page=#{page}" unless page.nil?
|
@@ -11,15 +11,6 @@ module GdsApi
|
|
11
11
|
|
12
12
|
PUBLISHING_API_ENDPOINT = Plek.current.find('publishing-api')
|
13
13
|
|
14
|
-
def stub_publishing_api_put_draft_item(base_path, body = content_item_for_publishing_api(base_path))
|
15
|
-
stub_publishing_api_put_item(base_path, body, '/draft-content')
|
16
|
-
end
|
17
|
-
|
18
|
-
def stub_publishing_api_put_item(base_path, body = content_item_for_publishing_api(base_path), resource_path = '/content')
|
19
|
-
url = PUBLISHING_API_ENDPOINT + resource_path + base_path
|
20
|
-
stub_request(:put, url).with(body: body).to_return(status: 200, body: '{}', headers: {"Content-Type" => "application/json; charset=utf-8"})
|
21
|
-
end
|
22
|
-
|
23
14
|
def stub_publishing_api_put_intent(base_path, body = intent_for_publishing_api(base_path))
|
24
15
|
url = PUBLISHING_API_ENDPOINT + "/publish-intent" + base_path
|
25
16
|
body = body.to_json unless body.is_a?(String)
|
@@ -31,28 +22,10 @@ module GdsApi
|
|
31
22
|
stub_request(:delete, url).to_return(status: 200, body: '{}', headers: {"Content-Type" => "application/json; charset=utf-8"})
|
32
23
|
end
|
33
24
|
|
34
|
-
def stub_default_publishing_api_put()
|
35
|
-
stub_request(:put, %r{\A#{PUBLISHING_API_ENDPOINT}/content})
|
36
|
-
end
|
37
|
-
|
38
|
-
def stub_default_publishing_api_put_draft()
|
39
|
-
stub_request(:put, %r{\A#{PUBLISHING_API_ENDPOINT}/draft-content})
|
40
|
-
end
|
41
|
-
|
42
25
|
def stub_default_publishing_api_put_intent()
|
43
26
|
stub_request(:put, %r{\A#{PUBLISHING_API_ENDPOINT}/publish-intent})
|
44
27
|
end
|
45
28
|
|
46
|
-
def assert_publishing_api_put_item(base_path, attributes_or_matcher = {}, times = 1)
|
47
|
-
url = PUBLISHING_API_ENDPOINT + "/content" + base_path
|
48
|
-
assert_publishing_api_put(url, attributes_or_matcher, times)
|
49
|
-
end
|
50
|
-
|
51
|
-
def assert_publishing_api_put_draft_item(base_path, attributes_or_matcher = {}, times = 1)
|
52
|
-
url = PUBLISHING_API_ENDPOINT + "/draft-content" + base_path
|
53
|
-
assert_publishing_api_put(url, attributes_or_matcher, times)
|
54
|
-
end
|
55
|
-
|
56
29
|
def assert_publishing_api_put_intent(base_path, attributes_or_matcher = {}, times = 1)
|
57
30
|
url = PUBLISHING_API_ENDPOINT + "/publish-intent" + base_path
|
58
31
|
assert_publishing_api_put(url, attributes_or_matcher, times)
|
data/lib/gds_api/version.rb
CHANGED
data/test/content_store_test.rb
CHANGED
@@ -52,47 +52,4 @@ describe GdsApi::ContentStore do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
56
|
-
describe "#content_item!" do
|
57
|
-
it "returns the item" do
|
58
|
-
base_path = "/test-from-content-store"
|
59
|
-
content_store_has_item(base_path)
|
60
|
-
|
61
|
-
response = @api.content_item!(base_path)
|
62
|
-
|
63
|
-
assert_equal base_path, response["base_path"]
|
64
|
-
end
|
65
|
-
|
66
|
-
it "raises if the item doesn't exist" do
|
67
|
-
content_store_does_not_have_item("/non-existent")
|
68
|
-
|
69
|
-
e = assert_raises GdsApi::ContentStore::ItemNotFound do
|
70
|
-
@api.content_item!("/non-existent")
|
71
|
-
end
|
72
|
-
|
73
|
-
assert_equal 404, e.code
|
74
|
-
assert_equal "URL: #{@base_api_url}/content/non-existent\nResponse body:\n\n\nRequest body:", e.message.strip
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe "#incoming_links!" do
|
79
|
-
it "returns the item" do
|
80
|
-
base_path = "/test-from-content-store?types%5B%5D=a&types%5B%5D=b"
|
81
|
-
content_store_has_incoming_links(base_path, [ { title: "Yolo" }])
|
82
|
-
|
83
|
-
response = @api.incoming_links!('/test-from-content-store', types: [:a, :b])
|
84
|
-
|
85
|
-
assert_equal [ { "title" => "Yolo" } ], response.to_hash
|
86
|
-
end
|
87
|
-
|
88
|
-
it "raises if the item doesn't exist" do
|
89
|
-
content_store_does_not_have_item("/non-existent")
|
90
|
-
|
91
|
-
e = assert_raises GdsApi::ContentStore::ItemNotFound do
|
92
|
-
response = @api.incoming_links!("/non-existent")
|
93
|
-
end
|
94
|
-
|
95
|
-
assert_equal 404, e.code
|
96
|
-
end
|
97
|
-
end
|
98
55
|
end
|