Skip to content

Commit

Permalink
Add endpoint for feedback from Eu exit bus. finder
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
peteglondon committed Jan 28, 2019
1 parent 7831e38 commit 75e3fb6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/gds_api/support_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions lib/gds_api/test_helpers/support_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
9 changes: 9 additions & 0 deletions test/support_api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 75e3fb6

Please sign in to comment.