gds-api-adapters 8.2.3 → 8.3.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.
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative '../base'
|
2
|
+
|
3
|
+
module GdsApi
|
4
|
+
module PerformancePlatform
|
5
|
+
class DataIn < GdsApi::Base
|
6
|
+
def submit_service_feedback_day_aggregate(slug, request_details)
|
7
|
+
post_json!("#{endpoint}/#{slug}_customer_satisfaction", request_details)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module GdsApi
|
2
|
+
module TestHelpers
|
3
|
+
module PerformancePlatform
|
4
|
+
module DataIn
|
5
|
+
PP_DATA_IN_ENDPOINT = "http://www.performance.dev.gov.uk"
|
6
|
+
|
7
|
+
def stub_service_feedback_day_aggregate_submission(slug, request_body = nil)
|
8
|
+
post_stub = stub_http_request(:post, "#{PP_DATA_IN_ENDPOINT}/#{slug}_customer_satisfaction")
|
9
|
+
post_stub.with(body: request_body) unless request_body.nil?
|
10
|
+
post_stub.to_return(:status => 200)
|
11
|
+
end
|
12
|
+
|
13
|
+
def stub_service_feedback_bucket_unavailable_for(slug)
|
14
|
+
stub_request(:post, "#{PP_DATA_IN_ENDPOINT}/#{slug}_customer_satisfaction").to_return(:status => 404)
|
15
|
+
end
|
16
|
+
|
17
|
+
def stub_pp_isnt_available
|
18
|
+
stub_request(:post, /#{PP_DATA_IN_ENDPOINT}\/.*/).to_return(:status => 503)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/gds_api/version.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'gds_api/performance_platform/data_in'
|
3
|
+
require 'gds_api/test_helpers/performance_platform/data_in'
|
4
|
+
|
5
|
+
describe GdsApi::PerformancePlatform::DataIn do
|
6
|
+
include GdsApi::TestHelpers::PerformancePlatform::DataIn
|
7
|
+
|
8
|
+
before do
|
9
|
+
@base_api_url = GdsApi::TestHelpers::PerformancePlatform::DataIn::PP_DATA_IN_ENDPOINT
|
10
|
+
@api = GdsApi::PerformancePlatform::DataIn.new(@base_api_url)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "can submit a day aggregate for service feedback for a particular slug" do
|
14
|
+
request_details = {"some"=> "data"}
|
15
|
+
|
16
|
+
stub_post = stub_service_feedback_day_aggregate_submission("some_slug", request_details)
|
17
|
+
|
18
|
+
@api.submit_service_feedback_day_aggregate("some_slug", request_details)
|
19
|
+
|
20
|
+
assert_requested(stub_post)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "throws an exception when the support app isn't available" do
|
24
|
+
stub_pp_isnt_available
|
25
|
+
assert_raises(GdsApi::HTTPErrorResponse) { @api.submit_service_feedback_day_aggregate("doesnt_matter", {}) }
|
26
|
+
end
|
27
|
+
|
28
|
+
it "throws an exception when the the bucket for that slug hasn't been defined" do
|
29
|
+
stub_service_feedback_bucket_unavailable_for("some_transaction")
|
30
|
+
assert_raises(GdsApi::HTTPNotFound) { @api.submit_service_feedback_day_aggregate("some_transaction", {}) }
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-api-adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: plek
|
@@ -281,6 +281,7 @@ files:
|
|
281
281
|
- lib/gds_api/need_api.rb
|
282
282
|
- lib/gds_api/railtie.rb
|
283
283
|
- lib/gds_api/exceptions.rb
|
284
|
+
- lib/gds_api/performance_platform/data_in.rb
|
284
285
|
- lib/gds_api/json_client.rb
|
285
286
|
- lib/gds_api/base.rb
|
286
287
|
- lib/gds_api/licence_application.rb
|
@@ -290,6 +291,7 @@ files:
|
|
290
291
|
- lib/gds_api/test_helpers/support.rb
|
291
292
|
- lib/gds_api/test_helpers/need_api.rb
|
292
293
|
- lib/gds_api/test_helpers/content_api/artefact_stub.rb
|
294
|
+
- lib/gds_api/test_helpers/performance_platform/data_in.rb
|
293
295
|
- lib/gds_api/test_helpers/licence_application.rb
|
294
296
|
- lib/gds_api/test_helpers/organisations.rb
|
295
297
|
- lib/gds_api/test_helpers/imminence.rb
|
@@ -327,6 +329,7 @@ files:
|
|
327
329
|
- Rakefile
|
328
330
|
- test/support_api_test.rb
|
329
331
|
- test/mapit_test.rb
|
332
|
+
- test/pp_data_in_test.rb
|
330
333
|
- test/need_api_test.rb
|
331
334
|
- test/publisher_api_test.rb
|
332
335
|
- test/fact_cave_test.rb
|
@@ -364,7 +367,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
364
367
|
version: '0'
|
365
368
|
segments:
|
366
369
|
- 0
|
367
|
-
hash:
|
370
|
+
hash: -354225401793444453
|
368
371
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
369
372
|
none: false
|
370
373
|
requirements:
|
@@ -373,7 +376,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
373
376
|
version: '0'
|
374
377
|
segments:
|
375
378
|
- 0
|
376
|
-
hash:
|
379
|
+
hash: -354225401793444453
|
377
380
|
requirements: []
|
378
381
|
rubyforge_project:
|
379
382
|
rubygems_version: 1.8.23
|
@@ -383,6 +386,7 @@ summary: Adapters to work with GDS APIs
|
|
383
386
|
test_files:
|
384
387
|
- test/support_api_test.rb
|
385
388
|
- test/mapit_test.rb
|
389
|
+
- test/pp_data_in_test.rb
|
386
390
|
- test/need_api_test.rb
|
387
391
|
- test/publisher_api_test.rb
|
388
392
|
- test/fact_cave_test.rb
|