gds-api-adapters 45.0.0 → 46.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gds_api/content_api.rb +0 -5
- data/lib/gds_api/support.rb +0 -16
- data/lib/gds_api/test_helpers/content_api.rb +0 -54
- data/lib/gds_api/test_helpers/support.rb +0 -18
- data/lib/gds_api/test_helpers/support_api.rb +12 -12
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 161ffa498afd13048d7be1e30938b3ad067f3acb
|
4
|
+
data.tar.gz: b8f8ae98f0f20ef2cf53631fef4ced003453ffdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9e1596dd63611d1928818f2ad3106831909346915252f449f35c2ff0c8df8368eefce31d91c01567595012cfd51efe51f82cffe4dbed8c4955f6f1d5ffcda90
|
7
|
+
data.tar.gz: cf34fcefdbb3e5666c0e66949cb5058f70d9b6e919d8cf94803ea696301d97a436054b2e1115c5d648f0b8e05e201388cf11cfea0cd92d8402ecb245088a1f1b
|
data/lib/gds_api/content_api.rb
CHANGED
@@ -87,11 +87,6 @@ class GdsApi::ContentApi < GdsApi::Base
|
|
87
87
|
get_json("#{base_url}/local_authorities.json?snac_code=#{CGI.escape(snac_code)}")
|
88
88
|
end
|
89
89
|
|
90
|
-
def licences_for_ids(ids)
|
91
|
-
ids = ids.map(&:to_s).sort.join(',')
|
92
|
-
get_json("#{@endpoint}/licences.json?ids=#{ids}")
|
93
|
-
end
|
94
|
-
|
95
90
|
def get_list(url)
|
96
91
|
get_json(url) { |r|
|
97
92
|
GdsApi::ListResponse.new(r, self, web_urls_relative_to: @web_urls_relative_to)
|
data/lib/gds_api/support.rb
CHANGED
@@ -5,26 +5,10 @@ class GdsApi::Support < GdsApi::Base
|
|
5
5
|
post_json("#{base_url}/foi_requests", foi_request: request_details)
|
6
6
|
end
|
7
7
|
|
8
|
-
def create_problem_report(request_details)
|
9
|
-
post_json("#{base_url}/anonymous_feedback/problem_reports", problem_report: request_details)
|
10
|
-
end
|
11
|
-
|
12
8
|
def create_named_contact(request_details)
|
13
9
|
post_json("#{base_url}/named_contacts", named_contact: request_details)
|
14
10
|
end
|
15
11
|
|
16
|
-
def create_anonymous_long_form_contact(request_details)
|
17
|
-
post_json("#{base_url}/anonymous_feedback/long_form_contacts", long_form_contact: request_details)
|
18
|
-
end
|
19
|
-
|
20
|
-
def create_service_feedback(request_details)
|
21
|
-
post_json("#{base_url}/anonymous_feedback/service_feedback", service_feedback: request_details)
|
22
|
-
end
|
23
|
-
|
24
|
-
def feedback_url(slug)
|
25
|
-
"#{base_url}/anonymous_feedback?path=#{slug}"
|
26
|
-
end
|
27
|
-
|
28
12
|
private
|
29
13
|
|
30
14
|
def base_url
|
@@ -341,60 +341,6 @@ module GdsApi
|
|
341
341
|
end
|
342
342
|
end
|
343
343
|
|
344
|
-
def content_api_licence_hash(licence_identifier, options = {})
|
345
|
-
details = {
|
346
|
-
title: "Publisher title",
|
347
|
-
slug: 'licence-slug',
|
348
|
-
licence_short_description: "Short description of licence"
|
349
|
-
}
|
350
|
-
details.merge!(options)
|
351
|
-
|
352
|
-
{
|
353
|
-
"title" => details[:title],
|
354
|
-
"id" => "http://example.org/#{details[:slug]}.json",
|
355
|
-
"web_url" => "http://www.test.gov.uk/#{details[:slug]}",
|
356
|
-
"format" => "licence",
|
357
|
-
"details" => {
|
358
|
-
"need_ids" => [],
|
359
|
-
"business_proposition" => false,
|
360
|
-
"alternative_title" => nil,
|
361
|
-
"overview" => nil,
|
362
|
-
"will_continue_on" => nil,
|
363
|
-
"continuation_link" => nil,
|
364
|
-
"licence_identifier" => licence_identifier,
|
365
|
-
"licence_short_description" => details[:licence_short_description],
|
366
|
-
"licence_overview" => nil,
|
367
|
-
"updated_at" => "2012-10-06T12:00:05+01:00"
|
368
|
-
},
|
369
|
-
"tags" => [],
|
370
|
-
"related" => []
|
371
|
-
}
|
372
|
-
end
|
373
|
-
|
374
|
-
def setup_content_api_licences_stubs
|
375
|
-
@stubbed_content_api_licences = []
|
376
|
-
stub_request(:get, %r{\A#{CONTENT_API_ENDPOINT}/licences}).to_return do |request|
|
377
|
-
if request.uri.query_values && request.uri.query_values["ids"]
|
378
|
-
ids = request.uri.query_values["ids"].split(',')
|
379
|
-
valid_licences = @stubbed_content_api_licences.select { |l| ids.include? l[:licence_identifier] }
|
380
|
-
{
|
381
|
-
body: {
|
382
|
-
'results' => valid_licences.map { |licence|
|
383
|
-
content_api_licence_hash(licence[:licence_identifier], licence)
|
384
|
-
}
|
385
|
-
}.to_json
|
386
|
-
}
|
387
|
-
else
|
388
|
-
{ body: { 'results' => [] }.to_json }
|
389
|
-
end
|
390
|
-
end
|
391
|
-
end
|
392
|
-
|
393
|
-
def content_api_has_licence(details)
|
394
|
-
raise "Need a licence identifier" if details[:licence_identifier].nil?
|
395
|
-
@stubbed_content_api_licences << details
|
396
|
-
end
|
397
|
-
|
398
344
|
def content_api_has_artefacts_for_need_id(need_id, artefacts)
|
399
345
|
url = "#{CONTENT_API_ENDPOINT}/for_need/#{CGI.escape(need_id.to_s)}.json"
|
400
346
|
body = plural_response_base.merge(
|
@@ -9,30 +9,12 @@ module GdsApi
|
|
9
9
|
post_stub.to_return(status: 201)
|
10
10
|
end
|
11
11
|
|
12
|
-
def stub_support_problem_report_creation(request_details = nil)
|
13
|
-
post_stub = stub_http_request(:post, "#{SUPPORT_ENDPOINT}/anonymous_feedback/problem_reports")
|
14
|
-
post_stub.with(body: { problem_report: request_details }) unless request_details.nil?
|
15
|
-
post_stub.to_return(status: 201)
|
16
|
-
end
|
17
|
-
|
18
12
|
def stub_support_named_contact_creation(request_details = nil)
|
19
13
|
post_stub = stub_http_request(:post, "#{SUPPORT_ENDPOINT}/named_contacts")
|
20
14
|
post_stub.with(body: { named_contact: request_details }) unless request_details.nil?
|
21
15
|
post_stub.to_return(status: 201)
|
22
16
|
end
|
23
17
|
|
24
|
-
def stub_support_long_form_anonymous_contact_creation(request_details = nil)
|
25
|
-
post_stub = stub_http_request(:post, "#{SUPPORT_ENDPOINT}/anonymous_feedback/long_form_contacts")
|
26
|
-
post_stub.with(body: { long_form_contact: request_details }) unless request_details.nil?
|
27
|
-
post_stub.to_return(status: 201)
|
28
|
-
end
|
29
|
-
|
30
|
-
def stub_support_service_feedback_creation(feedback_details = nil)
|
31
|
-
post_stub = stub_http_request(:post, "#{SUPPORT_ENDPOINT}/anonymous_feedback/service_feedback")
|
32
|
-
post_stub.with(body: { service_feedback: feedback_details }) unless feedback_details.nil?
|
33
|
-
post_stub.to_return(status: 201)
|
34
|
-
end
|
35
|
-
|
36
18
|
def support_isnt_available
|
37
19
|
stub_request(:post, /#{SUPPORT_ENDPOINT}\/.*/).to_return(status: 503)
|
38
20
|
end
|
@@ -18,31 +18,31 @@ module GdsApi
|
|
18
18
|
post_stub.to_return(status: 201)
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
21
|
+
def stub_support_api_long_form_anonymous_contact_creation(request_details = nil)
|
22
22
|
post_stub = stub_http_request(:post, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/long-form-contacts")
|
23
23
|
post_stub.with(body: { long_form_contact: request_details }) unless request_details.nil?
|
24
24
|
post_stub.to_return(status: 202)
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def stub_support_api_feedback_export_request_creation(request_details = nil)
|
28
28
|
post_stub = stub_http_request(:post, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/export-requests")
|
29
29
|
post_stub.with(body: { export_request: request_details }) unless request_details.nil?
|
30
30
|
post_stub.to_return(status: 202)
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def stub_support_api_global_export_request_creation(request_details = nil)
|
34
34
|
post_stub = stub_http_request(:post, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/global-export-requests")
|
35
35
|
post_stub.with(body: { global_export_request: request_details }) unless request_details.nil?
|
36
36
|
post_stub.to_return(status: 202)
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
39
|
+
def stub_support_api_create_page_improvement(params)
|
40
40
|
post_stub = stub_http_request(:post, "#{SUPPORT_API_ENDPOINT}/page-improvements")
|
41
41
|
post_stub.with(body: params)
|
42
42
|
post_stub.to_return(status: 201)
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
45
|
+
def stub_support_api_problem_report_daily_totals_for(date, expected_results = nil)
|
46
46
|
date_string = date.strftime("%Y-%m-%d")
|
47
47
|
get_stub = stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/problem-reports/#{date_string}/totals")
|
48
48
|
response = { status: 200 }
|
@@ -50,13 +50,13 @@ module GdsApi
|
|
50
50
|
get_stub.to_return(response)
|
51
51
|
end
|
52
52
|
|
53
|
-
def
|
53
|
+
def stub_support_api_problem_reports(params, response_body = {})
|
54
54
|
stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/problem-reports").
|
55
55
|
with(query: params).
|
56
56
|
to_return(status: 200, body: response_body.to_json)
|
57
57
|
end
|
58
58
|
|
59
|
-
def
|
59
|
+
def stub_support_api_mark_reviewed_for_spam(request_details = nil, response_body = {})
|
60
60
|
post_stub = stub_http_request(:put, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/problem-reports/mark-reviewed-for-spam")
|
61
61
|
post_stub.with(body: { reviewed_problem_report_ids: request_details }) unless request_details.nil?
|
62
62
|
post_stub.to_return(status: 200, body: response_body.to_json)
|
@@ -66,20 +66,20 @@ module GdsApi
|
|
66
66
|
stub_request(:post, /#{SUPPORT_API_ENDPOINT}\/.*/).to_return(status: 503)
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
69
|
+
def stub_support_api_anonymous_feedback(params, response_body = {})
|
70
70
|
stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback").
|
71
71
|
with(query: params).
|
72
72
|
to_return(status: 200, body: response_body.to_json)
|
73
73
|
end
|
74
74
|
|
75
|
-
def
|
75
|
+
def stub_support_api_anonymous_feedback_organisation_summary(slug, ordering = nil, response_body = {})
|
76
76
|
uri = "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/organisations/#{slug}"
|
77
77
|
uri << "?ordering=#{ordering}" if ordering
|
78
78
|
stub_http_request(:get, uri).
|
79
79
|
to_return(status: 200, body: response_body.to_json)
|
80
80
|
end
|
81
81
|
|
82
|
-
def
|
82
|
+
def stub_support_api_organisations_list(response_body = nil)
|
83
83
|
response_body ||= [{
|
84
84
|
slug: "cabinet-office",
|
85
85
|
web_url: "https://www.gov.uk/government/organisations/cabinet-office",
|
@@ -92,7 +92,7 @@ module GdsApi
|
|
92
92
|
to_return(status: 200, body: response_body.to_json)
|
93
93
|
end
|
94
94
|
|
95
|
-
def
|
95
|
+
def stub_support_api_organisation(slug = "cabinet-office", response_body = nil)
|
96
96
|
response_body ||= {
|
97
97
|
slug: slug,
|
98
98
|
web_url: "https://www.gov.uk/government/organisations/#{slug}",
|
@@ -105,7 +105,7 @@ module GdsApi
|
|
105
105
|
to_return(status: 200, body: response_body.to_json)
|
106
106
|
end
|
107
107
|
|
108
|
-
def
|
108
|
+
def stub_support_api_feedback_export_request(id, response_body = nil)
|
109
109
|
response_body ||= {
|
110
110
|
filename: "feedex_0000-00-00_2015-01-01.csv",
|
111
111
|
ready: true
|
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: 46.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Stewart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|