From 75e3fb67ab624f82a24de8c7cc8ed0030b4826fb Mon Sep 17 00:00:00 2001 From: Pete Goddard Date: Mon, 28 Jan 2019 11:34:41 +0000 Subject: [PATCH] Add endpoint for feedback from Eu exit bus. finder We want to collect feedback on what's missing from the EU exit business finder. The commit adds support for posting feedback to the support-api. --- lib/gds_api/support_api.rb | 4 ++++ lib/gds_api/test_helpers/support_api.rb | 6 ++++++ test/support_api_test.rb | 9 +++++++++ 3 files changed, 19 insertions(+) diff --git a/lib/gds_api/support_api.rb b/lib/gds_api/support_api.rb index 47e091d9..a686eb92 100644 --- a/lib/gds_api/support_api.rb +++ b/lib/gds_api/support_api.rb @@ -47,6 +47,10 @@ def problem_report_daily_totals_for(date) get_json("#{endpoint}/anonymous-feedback/problem-reports/#{date_string}/totals") end + def create_business_finder_feedback(params) + post_json("#{endpoint}/anonymous-feedback/business-finder", params) + end + def anonymous_feedback(options = {}) uri = "#{endpoint}/anonymous-feedback" + query_string(options) get_json(uri) diff --git a/lib/gds_api/test_helpers/support_api.rb b/lib/gds_api/test_helpers/support_api.rb index c9969145..945e9e8f 100644 --- a/lib/gds_api/test_helpers/support_api.rb +++ b/lib/gds_api/test_helpers/support_api.rb @@ -48,6 +48,12 @@ def stub_support_api_create_page_improvement(params) post_stub.to_return(status: 201) end + def stub_support_api_create_business_finder_feedback(params) + post_stub = stub_http_request(:post, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/business-finder") + post_stub.with(body: params) + post_stub.to_return(status: 201) + end + def stub_support_api_problem_report_daily_totals_for(date, expected_results = nil) date_string = date.strftime("%Y-%m-%d") get_stub = stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/problem-reports/#{date_string}/totals") diff --git a/test/support_api_test.rb b/test/support_api_test.rb index 04059b81..5e7340d3 100644 --- a/test/support_api_test.rb +++ b/test/support_api_test.rb @@ -40,6 +40,15 @@ assert_requested(stub_post) end + it 'can submit anonymous-contact/business-finder' do + request_details = { description: 'something is missing' } + stub_post = stub_support_api_create_business_finder_feedback(request_details) + + @api.create_business_finder_feedback(request_details) + + assert_requested(stub_post) + end + it "fetches problem report daily totals" do response_body = { "data" => ["results"] } request_date = Date.new(2014, 7, 12)