gds-api-adapters 38.0.0 → 38.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +5 -5
- data/lib/gds_api/asset_manager.rb +7 -7
- data/lib/gds_api/base.rb +13 -11
- data/lib/gds_api/business_support_api.rb +3 -4
- data/lib/gds_api/content_api.rb +31 -44
- data/lib/gds_api/content_store.rb +2 -3
- data/lib/gds_api/email_alert_api.rb +6 -7
- data/lib/gds_api/exceptions.rb +4 -1
- data/lib/gds_api/gov_uk_delivery.rb +9 -8
- data/lib/gds_api/govuk_headers.rb +1 -1
- data/lib/gds_api/imminence.rb +9 -10
- data/lib/gds_api/json_client.rb +21 -34
- data/lib/gds_api/licence_application.rb +2 -2
- data/lib/gds_api/list_response.rb +7 -10
- data/lib/gds_api/local_links_manager.rb +1 -1
- data/lib/gds_api/mapit.rb +5 -6
- data/lib/gds_api/middleware/govuk_header_sniffer.rb +1 -1
- data/lib/gds_api/need_api.rb +7 -8
- data/lib/gds_api/null_cache.rb +2 -2
- data/lib/gds_api/organisations.rb +2 -2
- data/lib/gds_api/panopticon.rb +11 -11
- data/lib/gds_api/performance_platform/data_in.rb +4 -4
- data/lib/gds_api/performance_platform/data_out.rb +1 -1
- data/lib/gds_api/publishing_api.rb +4 -5
- data/lib/gds_api/publishing_api/special_route_publisher.rb +5 -3
- data/lib/gds_api/publishing_api_v2.rb +8 -16
- data/lib/gds_api/response.rb +2 -5
- data/lib/gds_api/router.rb +18 -9
- data/lib/gds_api/rummager.rb +6 -7
- data/lib/gds_api/support.rb +7 -6
- data/lib/gds_api/support_api.rb +14 -14
- data/lib/gds_api/test_helpers/asset_manager.rb +3 -6
- data/lib/gds_api/test_helpers/business_support_api.rb +4 -4
- data/lib/gds_api/test_helpers/business_support_helper.rb +9 -8
- data/lib/gds_api/test_helpers/common_responses.rb +10 -12
- data/lib/gds_api/test_helpers/content_api.rb +23 -23
- data/lib/gds_api/test_helpers/content_api/artefact_stub.rb +13 -12
- data/lib/gds_api/test_helpers/content_item_helpers.rb +4 -4
- data/lib/gds_api/test_helpers/content_store.rb +3 -3
- data/lib/gds_api/test_helpers/email_alert_api.rb +8 -10
- data/lib/gds_api/test_helpers/gov_uk_delivery.rb +0 -1
- data/lib/gds_api/test_helpers/imminence.rb +4 -4
- data/lib/gds_api/test_helpers/intent_helpers.rb +0 -2
- data/lib/gds_api/test_helpers/local_links_manager.rb +12 -13
- data/lib/gds_api/test_helpers/mapit.rb +14 -15
- data/lib/gds_api/test_helpers/need_api.rb +4 -4
- data/lib/gds_api/test_helpers/organisations.rb +13 -15
- data/lib/gds_api/test_helpers/panopticon.rb +6 -6
- data/lib/gds_api/test_helpers/performance_platform/data_in.rb +8 -8
- data/lib/gds_api/test_helpers/publishing_api.rb +19 -20
- data/lib/gds_api/test_helpers/publishing_api_v2.rb +13 -13
- data/lib/gds_api/test_helpers/router.rb +5 -5
- data/lib/gds_api/test_helpers/rummager.rb +5 -4
- data/lib/gds_api/test_helpers/support.rb +11 -11
- data/lib/gds_api/test_helpers/support_api.rb +14 -14
- data/lib/gds_api/test_helpers/whitehall_admin_api.rb +1 -1
- data/lib/gds_api/test_helpers/worldwide.rb +16 -19
- data/lib/gds_api/version.rb +1 -1
- data/lib/gds_api/worldwide.rb +4 -4
- data/test/asset_manager_test.rb +6 -6
- data/test/business_support_api_test.rb +9 -10
- data/test/content_api_test.rb +81 -83
- data/test/email_alert_api_test.rb +3 -5
- data/test/gds_api_base_test.rb +9 -10
- data/test/gov_uk_delivery_test.rb +4 -6
- data/test/imminence_api_test.rb +7 -9
- data/test/json_client_test.rb +71 -64
- data/test/licence_application_api_test.rb +5 -7
- data/test/list_response_test.rb +27 -32
- data/test/mapit_test.rb +7 -9
- data/test/middleware/govuk_header_sniffer_test.rb +1 -1
- data/test/need_api_test.rb +8 -8
- data/test/organisations_api_test.rb +2 -2
- data/test/panopticon_registerer_test.rb +10 -10
- data/test/panopticon_test.rb +5 -5
- data/test/pp_data_in_test.rb +3 -3
- data/test/publishing_api_test.rb +2 -6
- data/test/publishing_api_v2_test.rb +40 -50
- data/test/response_test.rb +21 -22
- data/test/router_test.rb +78 -80
- data/test/rummager_test.rb +14 -14
- data/test/support_api_test.rb +13 -13
- data/test/support_test.rb +15 -16
- data/test/test_helper.rb +1 -1
- data/test/test_helpers/email_alert_api_test.rb +3 -3
- data/test/test_helpers/pact_helper.rb +1 -1
- data/test/test_helpers/panopticon_test.rb +1 -1
- data/test/test_helpers/publishing_api_test.rb +7 -7
- data/test/test_helpers/publishing_api_v2_test.rb +5 -9
- data/test/worldwide_api_test.rb +3 -3
- metadata +2 -3
- data/lib/gds_api/core-ext/openstruct.rb +0 -5
@@ -6,21 +6,21 @@ module GdsApi
|
|
6
6
|
module PerformancePlatform
|
7
7
|
class DataIn < GdsApi::Base
|
8
8
|
def submit_service_feedback_day_aggregate(slug, request_details)
|
9
|
-
post_json
|
9
|
+
post_json("#{endpoint}/data/#{slug}/customer-satisfaction", request_details)
|
10
10
|
rescue GdsApi::HTTPNotFound
|
11
11
|
raise PerformancePlatformDatasetNotConfigured, "Dataset for slug [#{slug}] not set up"
|
12
12
|
end
|
13
13
|
|
14
14
|
def corporate_content_problem_report_count(entries)
|
15
|
-
post_json
|
15
|
+
post_json("#{endpoint}/data/gov-uk-content/feedback-count", entries)
|
16
16
|
end
|
17
17
|
|
18
18
|
def corporate_content_urls_with_the_most_problem_reports(entries)
|
19
|
-
post_json
|
19
|
+
post_json("#{endpoint}/data/gov-uk-content/top-urls", entries)
|
20
20
|
end
|
21
21
|
|
22
22
|
def submit_problem_report_daily_totals(entries)
|
23
|
-
post_json
|
23
|
+
post_json("#{endpoint}/data/govuk-info/page-contacts", entries)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -2,22 +2,21 @@ require_relative 'base'
|
|
2
2
|
require_relative 'exceptions'
|
3
3
|
|
4
4
|
class GdsApi::PublishingApi < GdsApi::Base
|
5
|
-
|
6
5
|
def put_intent(base_path, payload)
|
7
|
-
put_json
|
6
|
+
put_json(intent_url(base_path), payload)
|
8
7
|
end
|
9
8
|
|
10
9
|
def destroy_intent(base_path)
|
11
|
-
delete_json
|
10
|
+
delete_json(intent_url(base_path))
|
12
11
|
rescue GdsApi::HTTPNotFound => e
|
13
12
|
e
|
14
13
|
end
|
15
14
|
|
16
15
|
def put_path(base_path, payload)
|
17
|
-
put_json
|
16
|
+
put_json(paths_url(base_path), payload)
|
18
17
|
end
|
19
18
|
|
20
|
-
|
19
|
+
private
|
21
20
|
|
22
21
|
def intent_url(base_path)
|
23
22
|
"#{endpoint}/publish-intent#{base_path}"
|
@@ -12,7 +12,8 @@ module GdsApi
|
|
12
12
|
def publish(options)
|
13
13
|
logger.info("Publishing #{options.fetch(:type)} route #{options.fetch(:base_path)}, routing to #{options.fetch(:rendering_app)}")
|
14
14
|
|
15
|
-
put_content_response = publishing_api.put_content(
|
15
|
+
put_content_response = publishing_api.put_content(
|
16
|
+
options.fetch(:content_id),
|
16
17
|
base_path: options.fetch(:base_path),
|
17
18
|
document_type: "special_route",
|
18
19
|
schema_name: "special_route",
|
@@ -26,14 +27,15 @@ module GdsApi
|
|
26
27
|
],
|
27
28
|
publishing_app: options.fetch(:publishing_app),
|
28
29
|
rendering_app: options.fetch(:rendering_app),
|
29
|
-
public_updated_at: time.now.iso8601
|
30
|
-
|
30
|
+
public_updated_at: time.now.iso8601)
|
31
|
+
|
31
32
|
publishing_api.patch_links(options.fetch(:content_id), links: options[:links]) if options[:links]
|
32
33
|
publishing_api.publish(options.fetch(:content_id), 'major')
|
33
34
|
put_content_response
|
34
35
|
end
|
35
36
|
|
36
37
|
private
|
38
|
+
|
37
39
|
attr_reader :logger, :publishing_api
|
38
40
|
|
39
41
|
def time
|
@@ -14,7 +14,7 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
14
14
|
#
|
15
15
|
# @see https://github.com/alphagov/publishing-api/blob/master/doc/api.md#put-v2contentcontent_id
|
16
16
|
def put_content(content_id, payload)
|
17
|
-
put_json
|
17
|
+
put_json(content_url(content_id), payload)
|
18
18
|
end
|
19
19
|
|
20
20
|
# Return a content item
|
@@ -49,7 +49,7 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
49
49
|
#
|
50
50
|
# @see https://github.com/alphagov/publishing-api/blob/master/doc/api.md#post-lookup-by-base-path
|
51
51
|
def lookup_content_ids(base_paths:)
|
52
|
-
response = post_json
|
52
|
+
response = post_json("#{endpoint}/lookup-by-base-path", base_paths: base_paths)
|
53
53
|
response.to_hash
|
54
54
|
end
|
55
55
|
|
@@ -96,7 +96,7 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
96
96
|
|
97
97
|
params = merge_optional_keys(params, options, optional_keys)
|
98
98
|
|
99
|
-
post_json
|
99
|
+
post_json(publish_url(content_id), params)
|
100
100
|
end
|
101
101
|
|
102
102
|
# Unpublish a content item
|
@@ -127,7 +127,7 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
127
127
|
params[:locale] = locale if locale
|
128
128
|
params[:unpublished_at] = unpublished_at.utc.iso8601 if unpublished_at
|
129
129
|
|
130
|
-
post_json
|
130
|
+
post_json(unpublish_url(content_id), params)
|
131
131
|
end
|
132
132
|
|
133
133
|
# Discard a draft
|
@@ -147,7 +147,7 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
147
147
|
|
148
148
|
params = merge_optional_keys({}, options, optional_keys)
|
149
149
|
|
150
|
-
post_json
|
150
|
+
post_json(discard_url(content_id), params)
|
151
151
|
end
|
152
152
|
|
153
153
|
# Get the link set for the given content_id.
|
@@ -232,7 +232,7 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
232
232
|
|
233
233
|
payload = merge_optional_keys(payload, params, [:previous_version, :bulk_publishing])
|
234
234
|
|
235
|
-
patch_json
|
235
|
+
patch_json(links_url(content_id), payload)
|
236
236
|
end
|
237
237
|
|
238
238
|
# Get a list of content items from the Publishing API.
|
@@ -263,17 +263,9 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
263
263
|
# FIXME: Add documentation
|
264
264
|
#
|
265
265
|
# @see https://github.com/alphagov/publishing-api/blob/master/doc/api.md#get-v2linkables
|
266
|
-
def get_linkables(document_type: nil
|
266
|
+
def get_linkables(document_type: nil)
|
267
267
|
if document_type.nil?
|
268
|
-
|
269
|
-
raise ArgumentError.new("Please provide a `document_type`")
|
270
|
-
else
|
271
|
-
self.class.logger.warn(
|
272
|
-
"Providing `format` to the `get_linkables` method is deprecated and will be removed in a " +
|
273
|
-
"future release. Please use `document_type` instead."
|
274
|
-
)
|
275
|
-
document_type = format
|
276
|
-
end
|
268
|
+
raise ArgumentError.new("Please provide a `document_type`")
|
277
269
|
end
|
278
270
|
|
279
271
|
get_json("#{endpoint}/v2/linkables?document_type=#{document_type}")
|
data/lib/gds_api/response.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
require 'json'
|
2
|
-
require 'ostruct'
|
3
2
|
require 'forwardable'
|
4
3
|
require 'rack/cache'
|
5
|
-
require_relative 'core-ext/openstruct'
|
6
4
|
|
7
5
|
module GdsApi
|
8
|
-
|
9
|
-
# This wraps an HTTP response with a JSON body, and presents this as
|
10
|
-
# an object that has the read behaviour of both a Hash and an OpenStruct
|
6
|
+
# This wraps an HTTP response with a JSON body.
|
11
7
|
#
|
12
8
|
# Responses can be configured to use relative URLs for `web_url` properties.
|
13
9
|
# API endpoints should return absolute URLs so that they make sense outside of the
|
@@ -79,6 +75,7 @@ module GdsApi
|
|
79
75
|
end
|
80
76
|
|
81
77
|
def present?; true; end
|
78
|
+
|
82
79
|
def blank?; false; end
|
83
80
|
|
84
81
|
private
|
data/lib/gds_api/router.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require_relative 'base'
|
2
2
|
|
3
3
|
class GdsApi::Router < GdsApi::Base
|
4
|
-
|
5
4
|
### Backends
|
6
5
|
|
7
6
|
def get_backend(id)
|
@@ -9,11 +8,11 @@ class GdsApi::Router < GdsApi::Base
|
|
9
8
|
end
|
10
9
|
|
11
10
|
def add_backend(id, url)
|
12
|
-
put_json
|
11
|
+
put_json("#{endpoint}/backends/#{CGI.escape(id)}", backend: { backend_url: url })
|
13
12
|
end
|
14
13
|
|
15
14
|
def delete_backend(id)
|
16
|
-
delete_json
|
15
|
+
delete_json("#{endpoint}/backends/#{CGI.escape(id)}")
|
17
16
|
end
|
18
17
|
|
19
18
|
### Routes
|
@@ -26,20 +25,30 @@ class GdsApi::Router < GdsApi::Base
|
|
26
25
|
end
|
27
26
|
|
28
27
|
def add_route(path, type, backend_id, options = {})
|
29
|
-
response = put_json
|
28
|
+
response = put_json("#{endpoint}/routes", route: { incoming_path: path, route_type: type, handler: "backend", backend_id: backend_id })
|
30
29
|
commit_routes if options[:commit]
|
31
30
|
response
|
32
31
|
end
|
33
32
|
|
34
33
|
def add_redirect_route(path, type, destination, redirect_type = "permanent", options = {})
|
35
|
-
response = put_json
|
36
|
-
|
34
|
+
response = put_json(
|
35
|
+
"#{endpoint}/routes",
|
36
|
+
route: {
|
37
|
+
incoming_path: path,
|
38
|
+
route_type: type,
|
39
|
+
handler: "redirect",
|
40
|
+
redirect_to: destination,
|
41
|
+
redirect_type: redirect_type,
|
42
|
+
segments_mode: options[:segments_mode]
|
43
|
+
}
|
44
|
+
)
|
45
|
+
|
37
46
|
commit_routes if options[:commit]
|
38
47
|
response
|
39
48
|
end
|
40
49
|
|
41
50
|
def add_gone_route(path, type, options = {})
|
42
|
-
response = put_json
|
51
|
+
response = put_json("#{endpoint}/routes", route: { incoming_path: path, route_type: type, handler: "gone" })
|
43
52
|
commit_routes if options[:commit]
|
44
53
|
response
|
45
54
|
end
|
@@ -51,12 +60,12 @@ class GdsApi::Router < GdsApi::Base
|
|
51
60
|
else
|
52
61
|
options = options_or_deprecated_type
|
53
62
|
end
|
54
|
-
response = delete_json
|
63
|
+
response = delete_json("#{endpoint}/routes?incoming_path=#{CGI.escape(path)}")
|
55
64
|
commit_routes if options[:commit]
|
56
65
|
response
|
57
66
|
end
|
58
67
|
|
59
68
|
def commit_routes
|
60
|
-
post_json
|
69
|
+
post_json("#{endpoint}/routes/commit", {})
|
61
70
|
end
|
62
71
|
end
|
data/lib/gds_api/rummager.rb
CHANGED
@@ -4,7 +4,6 @@ require 'rack/utils'
|
|
4
4
|
module GdsApi
|
5
5
|
# @api documented
|
6
6
|
class Rummager < Base
|
7
|
-
|
8
7
|
# Perform a search.
|
9
8
|
#
|
10
9
|
# @param args [Hash] A valid search query. See Rummager documentation for options.
|
@@ -12,7 +11,7 @@ module GdsApi
|
|
12
11
|
# @see https://github.com/alphagov/rummager/blob/master/docs/search-api.md
|
13
12
|
def search(args)
|
14
13
|
request_url = "#{base_url}/search.json?#{Rack::Utils.build_nested_query(args)}"
|
15
|
-
get_json
|
14
|
+
get_json(request_url)
|
16
15
|
end
|
17
16
|
|
18
17
|
# Advanced search.
|
@@ -21,7 +20,7 @@ module GdsApi
|
|
21
20
|
def advanced_search(args)
|
22
21
|
raise ArgumentError.new("Args cannot be blank") if args.nil? || args.empty?
|
23
22
|
request_path = "#{base_url}/advanced_search?#{Rack::Utils.build_nested_query(args)}"
|
24
|
-
get_json
|
23
|
+
get_json(request_path)
|
25
24
|
end
|
26
25
|
|
27
26
|
# Add a document to the search index.
|
@@ -33,7 +32,7 @@ module GdsApi
|
|
33
32
|
#
|
34
33
|
# @see https://github.com/alphagov/rummager/blob/master/docs/documents.md
|
35
34
|
def add_document(type, id, document)
|
36
|
-
post_json
|
35
|
+
post_json(
|
37
36
|
documents_url,
|
38
37
|
document.merge(
|
39
38
|
_type: type,
|
@@ -52,7 +51,7 @@ module GdsApi
|
|
52
51
|
# @see https://github.com/alphagov/rummager/blob/master/docs/content-api.md
|
53
52
|
def delete_content(base_path)
|
54
53
|
request_url = "#{base_url}/content?link=#{base_path}"
|
55
|
-
delete_json
|
54
|
+
delete_json(request_url)
|
56
55
|
end
|
57
56
|
|
58
57
|
# @private
|
@@ -70,7 +69,7 @@ module GdsApi
|
|
70
69
|
# @see https://github.com/alphagov/rummager/blob/master/docs/content-api.md
|
71
70
|
def get_content(base_path)
|
72
71
|
request_url = "#{base_url}/content?link=#{base_path}"
|
73
|
-
get_json
|
72
|
+
get_json(request_url)
|
74
73
|
end
|
75
74
|
|
76
75
|
# @private
|
@@ -85,7 +84,7 @@ module GdsApi
|
|
85
84
|
# @param type [String] The rummager/elasticsearch document type.
|
86
85
|
# @param id [String] The rummager/elasticsearch id. Typically the same as the `link` field.
|
87
86
|
def delete_document(type, id)
|
88
|
-
delete_json
|
87
|
+
delete_json(
|
89
88
|
"#{documents_url}/#{id}",
|
90
89
|
_type: type,
|
91
90
|
)
|
data/lib/gds_api/support.rb
CHANGED
@@ -2,30 +2,31 @@ require_relative 'base'
|
|
2
2
|
|
3
3
|
class GdsApi::Support < GdsApi::Base
|
4
4
|
def create_foi_request(request_details)
|
5
|
-
post_json
|
5
|
+
post_json("#{base_url}/foi_requests", foi_request: request_details)
|
6
6
|
end
|
7
7
|
|
8
8
|
def create_problem_report(request_details)
|
9
|
-
post_json
|
9
|
+
post_json("#{base_url}/anonymous_feedback/problem_reports", problem_report: request_details)
|
10
10
|
end
|
11
11
|
|
12
12
|
def create_named_contact(request_details)
|
13
|
-
post_json
|
13
|
+
post_json("#{base_url}/named_contacts", named_contact: request_details)
|
14
14
|
end
|
15
15
|
|
16
16
|
def create_anonymous_long_form_contact(request_details)
|
17
|
-
post_json
|
17
|
+
post_json("#{base_url}/anonymous_feedback/long_form_contacts", long_form_contact: request_details)
|
18
18
|
end
|
19
19
|
|
20
20
|
def create_service_feedback(request_details)
|
21
|
-
post_json
|
21
|
+
post_json("#{base_url}/anonymous_feedback/service_feedback", service_feedback: request_details)
|
22
22
|
end
|
23
23
|
|
24
24
|
def feedback_url(slug)
|
25
25
|
"#{base_url}/anonymous_feedback?path=#{slug}"
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
private
|
29
|
+
|
29
30
|
def base_url
|
30
31
|
endpoint
|
31
32
|
end
|
data/lib/gds_api/support_api.rb
CHANGED
@@ -3,23 +3,23 @@ require_relative 'base'
|
|
3
3
|
# @api documented
|
4
4
|
class GdsApi::SupportApi < GdsApi::Base
|
5
5
|
def create_problem_report(request_details)
|
6
|
-
post_json
|
6
|
+
post_json("#{endpoint}/anonymous-feedback/problem-reports", problem_report: request_details)
|
7
7
|
end
|
8
8
|
|
9
9
|
def create_service_feedback(request_details)
|
10
|
-
post_json
|
10
|
+
post_json("#{endpoint}/anonymous-feedback/service-feedback", service_feedback: request_details)
|
11
11
|
end
|
12
12
|
|
13
13
|
def create_anonymous_long_form_contact(request_details)
|
14
|
-
post_json
|
14
|
+
post_json("#{endpoint}/anonymous-feedback/long-form-contacts", long_form_contact: request_details)
|
15
15
|
end
|
16
16
|
|
17
17
|
def create_feedback_export_request(request_details)
|
18
|
-
post_json
|
18
|
+
post_json("#{endpoint}/anonymous-feedback/export-requests", export_request: request_details)
|
19
19
|
end
|
20
20
|
|
21
21
|
def create_global_export_request(request_details)
|
22
|
-
post_json
|
22
|
+
post_json("#{endpoint}/anonymous-feedback/global-export-requests", global_export_request: request_details)
|
23
23
|
end
|
24
24
|
|
25
25
|
# Create a Page Improvement
|
@@ -39,34 +39,34 @@ class GdsApi::SupportApi < GdsApi::Base
|
|
39
39
|
# path: 'http://gov.uk/service-manual/agile'
|
40
40
|
# )
|
41
41
|
def create_page_improvement(params)
|
42
|
-
post_json
|
42
|
+
post_json("#{endpoint}/page-improvements", params)
|
43
43
|
end
|
44
44
|
|
45
45
|
def problem_report_daily_totals_for(date)
|
46
46
|
date_string = date.strftime("%Y-%m-%d")
|
47
|
-
get_json
|
47
|
+
get_json("#{endpoint}/anonymous-feedback/problem-reports/#{date_string}/totals")
|
48
48
|
end
|
49
49
|
|
50
50
|
def anonymous_feedback(options = {})
|
51
51
|
uri = "#{endpoint}/anonymous-feedback" + query_string(options)
|
52
|
-
get_json
|
52
|
+
get_json(uri)
|
53
53
|
end
|
54
54
|
|
55
55
|
def organisation_summary(organisation_slug, options = {})
|
56
56
|
uri = "#{endpoint}/anonymous-feedback/organisations/#{organisation_slug}" + query_string(options)
|
57
|
-
get_json
|
57
|
+
get_json(uri)
|
58
58
|
end
|
59
59
|
|
60
60
|
def organisations_list
|
61
|
-
get_json
|
61
|
+
get_json("#{endpoint}/organisations")
|
62
62
|
end
|
63
63
|
|
64
64
|
def organisation(organisation_slug)
|
65
|
-
get_json
|
65
|
+
get_json("#{endpoint}/organisations/#{organisation_slug}")
|
66
66
|
end
|
67
67
|
|
68
68
|
def feedback_export_request(id)
|
69
|
-
get_json
|
69
|
+
get_json("#{endpoint}/anonymous-feedback/export-requests/#{id}")
|
70
70
|
end
|
71
71
|
|
72
72
|
# Fetch a list of problem reports.
|
@@ -112,7 +112,7 @@ class GdsApi::SupportApi < GdsApi::Base
|
|
112
112
|
# }
|
113
113
|
def problem_reports(options = {})
|
114
114
|
uri = "#{endpoint}/anonymous-feedback/problem-reports" + query_string(options)
|
115
|
-
get_json
|
115
|
+
get_json(uri)
|
116
116
|
end
|
117
117
|
|
118
118
|
# Update multiple problem reports as reviewed for spam.
|
@@ -137,6 +137,6 @@ class GdsApi::SupportApi < GdsApi::Base
|
|
137
137
|
#
|
138
138
|
# #=> { "success" => false} (status: 400)
|
139
139
|
def mark_reviewed_for_spam(request_details)
|
140
|
-
put_json
|
140
|
+
put_json("#{endpoint}/anonymous-feedback/problem-reports/mark-reviewed-for-spam", reviewed_problem_report_ids: request_details)
|
141
141
|
end
|
142
142
|
end
|
@@ -1,16 +1,13 @@
|
|
1
1
|
module GdsApi
|
2
2
|
module TestHelpers
|
3
3
|
module AssetManager
|
4
|
-
|
5
4
|
ASSET_MANAGER_ENDPOINT = Plek.current.find('asset-manager')
|
6
5
|
|
7
6
|
def asset_manager_has_an_asset(id, atts)
|
8
|
-
response = atts.merge({
|
9
|
-
"_response_info" => { "status" => "ok" }
|
10
|
-
})
|
7
|
+
response = atts.merge("_response_info" => { "status" => "ok" })
|
11
8
|
|
12
9
|
stub_request(:get, "#{ASSET_MANAGER_ENDPOINT}/assets/#{id}")
|
13
|
-
.to_return(:
|
10
|
+
.to_return(body: response.to_json, status: 200)
|
14
11
|
end
|
15
12
|
|
16
13
|
def asset_manager_does_not_have_an_asset(id)
|
@@ -19,7 +16,7 @@ module GdsApi
|
|
19
16
|
}
|
20
17
|
|
21
18
|
stub_request(:get, "#{ASSET_MANAGER_ENDPOINT}/assets/#{id}")
|
22
|
-
.to_return(:
|
19
|
+
.to_return(body: response.to_json, status: 404)
|
23
20
|
end
|
24
21
|
|
25
22
|
def asset_manager_receives_an_asset(response_url)
|