gds-api-adapters 63.6.0 → 67.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/Rakefile +3 -4
- data/lib/gds_api.rb +0 -14
- data/lib/gds_api/base.rb +4 -3
- data/lib/gds_api/imminence.rb +2 -2
- data/lib/gds_api/json_client.rb +6 -6
- data/lib/gds_api/list_response.rb +6 -6
- data/lib/gds_api/performance_platform/data_out.rb +21 -21
- data/lib/gds_api/publishing_api.rb +2 -2
- data/lib/gds_api/response.rb +8 -4
- data/lib/gds_api/test_helpers/asset_manager.rb +0 -17
- data/lib/gds_api/test_helpers/calendars.rb +0 -9
- data/lib/gds_api/test_helpers/content_store.rb +0 -9
- data/lib/gds_api/test_helpers/email_alert_api.rb +8 -32
- data/lib/gds_api/test_helpers/imminence.rb +11 -14
- data/lib/gds_api/test_helpers/licence_application.rb +8 -16
- data/lib/gds_api/test_helpers/link_checker_api.rb +0 -8
- data/lib/gds_api/test_helpers/local_links_manager.rb +0 -13
- data/lib/gds_api/test_helpers/mapit.rb +15 -26
- data/lib/gds_api/test_helpers/organisations.rb +13 -18
- data/lib/gds_api/test_helpers/performance_platform/data_out.rb +34 -34
- data/lib/gds_api/test_helpers/publishing_api.rb +28 -49
- data/lib/gds_api/test_helpers/support.rb +0 -5
- data/lib/gds_api/test_helpers/support_api.rb +16 -20
- data/lib/gds_api/test_helpers/worldwide.rb +51 -31
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -5
- data/lib/gds_api/publishing_api_v2.rb +0 -14
- data/lib/gds_api/test_helpers/alias_deprecated.rb +0 -13
- data/lib/gds_api/test_helpers/publishing_api_v2.rb +0 -13
@@ -1,9 +1,6 @@
|
|
1
|
-
require "gds_api/test_helpers/alias_deprecated"
|
2
|
-
|
3
1
|
module GdsApi
|
4
2
|
module TestHelpers
|
5
3
|
module Support
|
6
|
-
extend AliasDeprecated
|
7
4
|
SUPPORT_ENDPOINT = Plek.current.find("support")
|
8
5
|
|
9
6
|
def stub_support_foi_request_creation(request_details = nil)
|
@@ -21,8 +18,6 @@ module GdsApi
|
|
21
18
|
def stub_support_isnt_available
|
22
19
|
stub_request(:post, /#{SUPPORT_ENDPOINT}\/.*/).to_return(status: 503)
|
23
20
|
end
|
24
|
-
|
25
|
-
alias_deprecated :support_isnt_available, :stub_support_isnt_available
|
26
21
|
end
|
27
22
|
end
|
28
23
|
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
require "gds_api/test_helpers/alias_deprecated"
|
2
1
|
require "cgi"
|
3
2
|
require "plek"
|
4
3
|
|
5
4
|
module GdsApi
|
6
5
|
module TestHelpers
|
7
6
|
module SupportApi
|
8
|
-
extend AliasDeprecated
|
9
7
|
SUPPORT_API_ENDPOINT = Plek.current.find("support-api")
|
10
8
|
|
11
9
|
def stub_support_api_problem_report_creation(request_details = nil)
|
@@ -65,9 +63,9 @@ module GdsApi
|
|
65
63
|
end
|
66
64
|
|
67
65
|
def stub_support_api_problem_reports(params, response_body = {})
|
68
|
-
stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/problem-reports")
|
69
|
-
with(query: params)
|
70
|
-
to_return(status: 200, body: response_body.to_json)
|
66
|
+
stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/problem-reports")
|
67
|
+
.with(query: params)
|
68
|
+
.to_return(status: 200, body: response_body.to_json)
|
71
69
|
end
|
72
70
|
|
73
71
|
def stub_support_api_mark_reviewed_for_spam(request_details = nil, response_body = {})
|
@@ -89,8 +87,8 @@ module GdsApi
|
|
89
87
|
def stub_support_api_anonymous_feedback_organisation_summary(slug, ordering = nil, response_body = {})
|
90
88
|
uri = "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/organisations/#{slug}"
|
91
89
|
uri << "?ordering=#{ordering}" if ordering
|
92
|
-
stub_http_request(:get, uri)
|
93
|
-
to_return(status: 200, body: response_body.to_json)
|
90
|
+
stub_http_request(:get, uri)
|
91
|
+
.to_return(status: 200, body: response_body.to_json)
|
94
92
|
end
|
95
93
|
|
96
94
|
def stub_support_api_organisations_list(response_body = nil)
|
@@ -111,8 +109,8 @@ module GdsApi
|
|
111
109
|
},
|
112
110
|
]
|
113
111
|
|
114
|
-
stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/organisations")
|
115
|
-
to_return(status: 200, body: response_body.to_json)
|
112
|
+
stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/organisations")
|
113
|
+
.to_return(status: 200, body: response_body.to_json)
|
116
114
|
end
|
117
115
|
|
118
116
|
def stub_support_api_organisation(slug = "cabinet-office", response_body = nil)
|
@@ -124,22 +122,22 @@ module GdsApi
|
|
124
122
|
govuk_status: "live",
|
125
123
|
}
|
126
124
|
|
127
|
-
stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/organisations/#{slug}")
|
128
|
-
to_return(status: 200, body: response_body.to_json)
|
125
|
+
stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/organisations/#{slug}")
|
126
|
+
.to_return(status: 200, body: response_body.to_json)
|
129
127
|
end
|
130
128
|
|
131
129
|
def stub_support_api_document_type_list(response_body = nil)
|
132
|
-
response_body ||= %w
|
130
|
+
response_body ||= %w[case_study detailed_guide smart_answer]
|
133
131
|
|
134
|
-
stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/document-types")
|
135
|
-
to_return(status: 200, body: response_body.to_json)
|
132
|
+
stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/document-types")
|
133
|
+
.to_return(status: 200, body: response_body.to_json)
|
136
134
|
end
|
137
135
|
|
138
136
|
def stub_support_api_anonymous_feedback_doc_type_summary(document_type, ordering = nil, response_body = nil)
|
139
137
|
uri = "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/document-types/#{document_type}"
|
140
138
|
uri << "?ordering=#{ordering}" if ordering
|
141
|
-
stub_http_request(:get, uri)
|
142
|
-
to_return(status: 200, body: response_body.to_json)
|
139
|
+
stub_http_request(:get, uri)
|
140
|
+
.to_return(status: 200, body: response_body.to_json)
|
143
141
|
end
|
144
142
|
|
145
143
|
def stub_support_api_feedback_export_request(id, response_body = nil)
|
@@ -148,15 +146,13 @@ module GdsApi
|
|
148
146
|
ready: true,
|
149
147
|
}
|
150
148
|
|
151
|
-
stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/export-requests/#{id}")
|
152
|
-
to_return(status: 200, body: response_body.to_json)
|
149
|
+
stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/export-requests/#{id}")
|
150
|
+
.to_return(status: 200, body: response_body.to_json)
|
153
151
|
end
|
154
152
|
|
155
153
|
def stub_any_support_api_call
|
156
154
|
stub_request(:any, %r{\A#{SUPPORT_API_ENDPOINT}})
|
157
155
|
end
|
158
|
-
|
159
|
-
alias_deprecated :support_api_isnt_available, :stub_support_api_isnt_available
|
160
156
|
end
|
161
157
|
end
|
162
158
|
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
require "gds_api/test_helpers/alias_deprecated"
|
2
1
|
require "gds_api/test_helpers/json_client_helper"
|
3
2
|
require "gds_api/test_helpers/common_responses"
|
4
3
|
|
5
4
|
module GdsApi
|
6
5
|
module TestHelpers
|
7
6
|
module Worldwide
|
8
|
-
extend AliasDeprecated
|
9
7
|
include GdsApi::TestHelpers::CommonResponses
|
10
8
|
|
11
9
|
WORLDWIDE_API_ENDPOINT = Plek.new.website_root
|
@@ -23,12 +21,14 @@ module GdsApi
|
|
23
21
|
end
|
24
22
|
|
25
23
|
pages.each_with_index do |page, i|
|
26
|
-
page_details = plural_response_base.merge(
|
24
|
+
page_details = plural_response_base.merge(
|
25
|
+
"results" => page,
|
27
26
|
"total" => location_slugs.size,
|
28
27
|
"pages" => pages.size,
|
29
28
|
"current_page" => i + 1,
|
30
29
|
"page_size" => 20,
|
31
|
-
"start_index" => i * 20 + 1
|
30
|
+
"start_index" => i * 20 + 1,
|
31
|
+
)
|
32
32
|
|
33
33
|
links = { self: "#{WORLDWIDE_API_ENDPOINT}/api/world-locations?page=#{i + 1}" }
|
34
34
|
links[:next] = "#{WORLDWIDE_API_ENDPOINT}/api/world-locations?page=#{i + 2}" if pages[i + 1]
|
@@ -40,32 +40,59 @@ module GdsApi
|
|
40
40
|
link_headers << "<#{href}>; rel=\"#{rel}\""
|
41
41
|
end
|
42
42
|
|
43
|
-
stub_request(:get, links[:self])
|
44
|
-
to_return(status: 200, body: page_details.to_json, headers: { "Link" => link_headers.join(", ") })
|
43
|
+
stub_request(:get, links[:self])
|
44
|
+
.to_return(status: 200, body: page_details.to_json, headers: { "Link" => link_headers.join(", ") })
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
next unless i.zero?
|
47
|
+
|
48
|
+
# First page exists at URL with and without page param
|
49
|
+
stub_request(:get, links[:self].sub(/\?page=1/, ""))
|
50
|
+
.to_return(status: 200, body: page_details.to_json, headers: { "Link" => link_headers.join(", ") })
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
def stub_worldwide_api_has_selection_of_locations
|
55
|
-
stub_worldwide_api_has_locations %w
|
56
|
-
afghanistan
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
stub_worldwide_api_has_locations %w[
|
56
|
+
afghanistan
|
57
|
+
angola
|
58
|
+
australia
|
59
|
+
bahamas
|
60
|
+
belarus
|
61
|
+
brazil
|
62
|
+
brunei
|
63
|
+
cambodia
|
64
|
+
chad
|
65
|
+
croatia
|
66
|
+
denmark
|
67
|
+
eritrea
|
68
|
+
france
|
69
|
+
ghana
|
70
|
+
iceland
|
71
|
+
japan
|
72
|
+
laos
|
73
|
+
luxembourg
|
74
|
+
malta
|
75
|
+
micronesia
|
76
|
+
mozambique
|
77
|
+
nicaragua
|
78
|
+
panama
|
79
|
+
portugal
|
80
|
+
sao-tome-and-principe
|
81
|
+
singapore
|
82
|
+
south-korea
|
83
|
+
sri-lanka
|
84
|
+
uk-delegation-to-council-of-europe
|
60
85
|
uk-delegation-to-organization-for-security-and-co-operation-in-europe
|
61
|
-
united-kingdom
|
62
|
-
|
86
|
+
united-kingdom
|
87
|
+
venezuela
|
88
|
+
vietnam
|
89
|
+
]
|
63
90
|
end
|
64
91
|
|
65
92
|
def stub_worldwide_api_has_location(location_slug, details = nil)
|
66
93
|
details ||= world_location_for_slug(location_slug)
|
67
|
-
stub_request(:get, "#{WORLDWIDE_API_ENDPOINT}/api/world-locations/#{location_slug}")
|
68
|
-
to_return(status: 200, body: details.to_json)
|
94
|
+
stub_request(:get, "#{WORLDWIDE_API_ENDPOINT}/api/world-locations/#{location_slug}")
|
95
|
+
.to_return(status: 200, body: details.to_json)
|
69
96
|
end
|
70
97
|
|
71
98
|
def stub_worldwide_api_does_not_have_location(location_slug)
|
@@ -75,15 +102,15 @@ module GdsApi
|
|
75
102
|
def stub_worldwide_api_has_organisations_for_location(location_slug, json_or_hash)
|
76
103
|
json = json_or_hash.is_a?(Hash) ? json_or_hash.to_json : json_or_hash
|
77
104
|
url = "#{WORLDWIDE_API_ENDPOINT}/api/world-locations/#{location_slug}/organisations"
|
78
|
-
stub_request(:get, url)
|
79
|
-
to_return(status: 200, body: json, headers: { "Link" => "<#{url}; rel\"self\"" })
|
105
|
+
stub_request(:get, url)
|
106
|
+
.to_return(status: 200, body: json, headers: { "Link" => "<#{url}; rel\"self\"" })
|
80
107
|
end
|
81
108
|
|
82
109
|
def stub_worldwide_api_has_no_organisations_for_location(location_slug)
|
83
110
|
details = { "results" => [], "total" => 0, "_response_info" => { "status" => "ok" } }
|
84
111
|
url = "#{WORLDWIDE_API_ENDPOINT}/api/world-locations/#{location_slug}/organisations"
|
85
|
-
stub_request(:get, url)
|
86
|
-
to_return(status: 200, body: details.to_json, headers: { "Link" => "<#{url}; rel\"self\"" })
|
112
|
+
stub_request(:get, url)
|
113
|
+
.to_return(status: 200, body: details.to_json, headers: { "Link" => "<#{url}; rel\"self\"" })
|
87
114
|
end
|
88
115
|
|
89
116
|
def world_location_for_slug(slug)
|
@@ -112,13 +139,6 @@ module GdsApi
|
|
112
139
|
"content_id" => "content_id_for_#{slug}",
|
113
140
|
}
|
114
141
|
end
|
115
|
-
|
116
|
-
alias_deprecated :worldwide_api_has_locations, :stub_worldwide_api_has_locations
|
117
|
-
alias_deprecated :worldwide_api_has_selection_of_locations, :stub_worldwide_api_has_selection_of_locations
|
118
|
-
alias_deprecated :worldwide_api_has_location, :stub_worldwide_api_has_location
|
119
|
-
alias_deprecated :worldwide_api_has_does_not_have_location, :stub_worldwide_api_does_not_have_location
|
120
|
-
alias_deprecated :worldwide_api_has_organisations_for_location, :stub_worldwide_api_has_organisations_for_location
|
121
|
-
alias_deprecated :worldwide_api_has_no_organisations_for_location, :stub_worldwide_api_has_no_organisations_for_location
|
122
142
|
end
|
123
143
|
end
|
124
144
|
end
|
data/lib/gds_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-api-adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 67.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -406,14 +406,12 @@ files:
|
|
406
406
|
- lib/gds_api/performance_platform/data_out.rb
|
407
407
|
- lib/gds_api/publishing_api.rb
|
408
408
|
- lib/gds_api/publishing_api/special_route_publisher.rb
|
409
|
-
- lib/gds_api/publishing_api_v2.rb
|
410
409
|
- lib/gds_api/railtie.rb
|
411
410
|
- lib/gds_api/response.rb
|
412
411
|
- lib/gds_api/router.rb
|
413
412
|
- lib/gds_api/search.rb
|
414
413
|
- lib/gds_api/support.rb
|
415
414
|
- lib/gds_api/support_api.rb
|
416
|
-
- lib/gds_api/test_helpers/alias_deprecated.rb
|
417
415
|
- lib/gds_api/test_helpers/asset_manager.rb
|
418
416
|
- lib/gds_api/test_helpers/calendars.rb
|
419
417
|
- lib/gds_api/test_helpers/common_responses.rb
|
@@ -430,7 +428,6 @@ files:
|
|
430
428
|
- lib/gds_api/test_helpers/performance_platform/data_in.rb
|
431
429
|
- lib/gds_api/test_helpers/performance_platform/data_out.rb
|
432
430
|
- lib/gds_api/test_helpers/publishing_api.rb
|
433
|
-
- lib/gds_api/test_helpers/publishing_api_v2.rb
|
434
431
|
- lib/gds_api/test_helpers/router.rb
|
435
432
|
- lib/gds_api/test_helpers/search.rb
|
436
433
|
- lib/gds_api/test_helpers/support.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require_relative "publishing_api"
|
2
|
-
|
3
|
-
# Adapter for the Publishing API.
|
4
|
-
#
|
5
|
-
# @see https://github.com/alphagov/publishing-api
|
6
|
-
# @see https://github.com/alphagov/publishing-api/blob/master/doc/publishing-application-examples.md
|
7
|
-
# @see https://github.com/alphagov/publishing-api/blob/master/doc/model.md
|
8
|
-
# @api documented
|
9
|
-
class GdsApi::PublishingApiV2 < GdsApi::PublishingApi
|
10
|
-
def initialize(*args)
|
11
|
-
warn "GdsApi::PublishingApiV2 is deprecated. Use GdsApi::PublishingApi instead."
|
12
|
-
super
|
13
|
-
end
|
14
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module GdsApi
|
2
|
-
module TestHelpers
|
3
|
-
module AliasDeprecated
|
4
|
-
def alias_deprecated(deprecated_method, replacement_method)
|
5
|
-
class_name = self.name
|
6
|
-
define_method(deprecated_method) do |*args, &block|
|
7
|
-
warn "##{deprecated_method} is deprecated on #{class_name} and will be removed in a future version. Use ##{replacement_method} instead"
|
8
|
-
public_send(replacement_method, *args, &block)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require "gds_api/test_helpers/publishing_api"
|
2
|
-
|
3
|
-
module GdsApi
|
4
|
-
module TestHelpers
|
5
|
-
module PublishingApiV2
|
6
|
-
include PublishingApi
|
7
|
-
|
8
|
-
def self.included(_base)
|
9
|
-
warn "GdsApi::TestHelpers::PublishingApiV2 is deprecated. Use GdsApi::TestHelpers::PublishingApi instead."
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|