gds-api-adapters 18.9.1 → 18.10.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/support_api.rb +8 -0
- data/lib/gds_api/test_helpers/support_api.rb +16 -0
- data/lib/gds_api/version.rb +1 -1
- data/test/support_api_test.rb +20 -0
- 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: a1f261e1042cf8b7b363041571b71bf855f78519
|
4
|
+
data.tar.gz: 2cb8d51f57520459ca9c1fe01914c153cc5502d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acd1dccd956fb40d4af0193c12beb5bb1663c96bae349efa66bd9b2bc187e62cb0b43d836b2c41a842c9b514da01b32a121ece1ee40836d1b58e234b08dacf8f
|
7
|
+
data.tar.gz: f882bcf37b5d501bbedcf1c4272c67aef50ee50454c5736c1d5809b8a5fb6080704fd0bf882c80b90439c8219b75f5bf41dd24fd948a3e28be8ea65a3f198b1b
|
data/lib/gds_api/support_api.rb
CHANGED
@@ -13,6 +13,10 @@ class GdsApi::SupportApi < GdsApi::Base
|
|
13
13
|
post_json!("#{endpoint}/anonymous-feedback/long-form-contacts", { :long_form_contact => request_details })
|
14
14
|
end
|
15
15
|
|
16
|
+
def create_feedback_export_request(request_details)
|
17
|
+
post_json!("#{endpoint}/anonymous-feedback/export-requests", export_request: request_details)
|
18
|
+
end
|
19
|
+
|
16
20
|
def problem_report_daily_totals_for(date)
|
17
21
|
date_string = date.strftime("%Y-%m-%d")
|
18
22
|
get_json!("#{endpoint}/anonymous-feedback/problem-reports/#{date_string}/totals")
|
@@ -31,4 +35,8 @@ class GdsApi::SupportApi < GdsApi::Base
|
|
31
35
|
def organisations_list
|
32
36
|
get_json!("#{endpoint}/anonymous-feedback/organisations")
|
33
37
|
end
|
38
|
+
|
39
|
+
def feedback_export_request(id)
|
40
|
+
get_json!("#{endpoint}/anonymous-feedback/export-requests/#{id}")
|
41
|
+
end
|
34
42
|
end
|
@@ -24,6 +24,12 @@ module GdsApi
|
|
24
24
|
post_stub.to_return(:status => 202)
|
25
25
|
end
|
26
26
|
|
27
|
+
def stub_support_feedback_export_request_creation(request_details = nil)
|
28
|
+
post_stub = stub_http_request(:post, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/export-requests")
|
29
|
+
post_stub.with(:body => { export_request: request_details }) unless request_details.nil?
|
30
|
+
post_stub.to_return(:status => 202)
|
31
|
+
end
|
32
|
+
|
27
33
|
def stub_problem_report_daily_totals_for(date, expected_results = nil)
|
28
34
|
date_string = date.strftime("%Y-%m-%d")
|
29
35
|
get_stub = stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/problem-reports/#{date_string}/totals")
|
@@ -61,6 +67,16 @@ module GdsApi
|
|
61
67
|
stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/organisations").
|
62
68
|
to_return(status: 200, body: response_body.to_json)
|
63
69
|
end
|
70
|
+
|
71
|
+
def stub_support_feedback_export_request(id, response_body = nil)
|
72
|
+
response_body ||= {
|
73
|
+
filename: "feedex_0000-00-00_2015-01-01.csv",
|
74
|
+
ready: true
|
75
|
+
}
|
76
|
+
|
77
|
+
stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/export-requests/#{id}").
|
78
|
+
to_return(status: 200, body: response_body.to_json)
|
79
|
+
end
|
64
80
|
end
|
65
81
|
end
|
66
82
|
end
|
data/lib/gds_api/version.rb
CHANGED
data/test/support_api_test.rb
CHANGED
@@ -112,4 +112,24 @@ describe GdsApi::SupportApi do
|
|
112
112
|
assert_requested(stub_get)
|
113
113
|
end
|
114
114
|
end
|
115
|
+
|
116
|
+
describe "POST /anonymous-feedback/export-requests" do
|
117
|
+
it "makes a POST request to the support api" do
|
118
|
+
stub_post = stub_support_feedback_export_request_creation(notification_email: "foo@example.com")
|
119
|
+
|
120
|
+
@api.create_feedback_export_request(notification_email: "foo@example.com")
|
121
|
+
|
122
|
+
assert_requested(stub_post)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "GET /anonymous-feedback/export-requests/:id" do
|
127
|
+
it "fetches the export request details from the API" do
|
128
|
+
stub_get = stub_support_feedback_export_request(123)
|
129
|
+
|
130
|
+
@api.feedback_export_request(123)
|
131
|
+
|
132
|
+
assert_requested(stub_get)
|
133
|
+
end
|
134
|
+
end
|
115
135
|
end
|
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: 18.
|
4
|
+
version: 18.10.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: 2015-
|
11
|
+
date: 2015-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|