gds-api-adapters 18.9.1 → 18.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2570557c31979d1af5d5ee2907c1f06252ca43c1
4
- data.tar.gz: 734d9c8514a1c88abdafe842a86e889af0bdec0e
3
+ metadata.gz: a1f261e1042cf8b7b363041571b71bf855f78519
4
+ data.tar.gz: 2cb8d51f57520459ca9c1fe01914c153cc5502d5
5
5
  SHA512:
6
- metadata.gz: f861829db2cd582124f8b94311321d8ae8bfa0b278beccbb08695f967f79ac01f4b9b9ba319f941d0a096a89691b91fb880513778fc17fbe2843c971a098f79a
7
- data.tar.gz: 39e05c3a75f366c6398c465af7338c7e3dab70456c9027b031664fd7343ae9b37d96a44bfac915116be5fdfaae01228f7490b2c53825a74866e2beec35e5a5bf
6
+ metadata.gz: acd1dccd956fb40d4af0193c12beb5bb1663c96bae349efa66bd9b2bc187e62cb0b43d836b2c41a842c9b514da01b32a121ece1ee40836d1b58e234b08dacf8f
7
+ data.tar.gz: f882bcf37b5d501bbedcf1c4272c67aef50ee50454c5736c1d5809b8a5fb6080704fd0bf882c80b90439c8219b75f5bf41dd24fd948a3e28be8ea65a3f198b1b
@@ -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
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '18.9.1'
2
+ VERSION = '18.10.0'
3
3
  end
@@ -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.9.1
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-05-22 00:00:00.000000000 Z
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek