gds-api-adapters 37.2.0 → 37.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ab688fe0f4c7a815626d93141d88d1bf0bda31c
4
- data.tar.gz: 14bb6c214dbce0e1f266834944bbee61e5477343
3
+ metadata.gz: e5492adcd05739ec09f5d1f7fbf4c98b5dcacedf
4
+ data.tar.gz: 14d1377fdad10ef32d6f8e0003d19b04d0ce13fc
5
5
  SHA512:
6
- metadata.gz: 8b4739c6b4c3df39058ed88251aded081463ead11eb1ee417c715f0806d9b8d2b817531967b3992f9cf7dcba3fffba0c5382daeae6cb08d1ddec76cb3acdf022
7
- data.tar.gz: 0ddd803d87e83aebca6c6f12ea2526f2b247cb89c690915c1b5c7c309c38b11653da3db4cad72395e1aee56f7d20df29703dcad2e53afe6a88bcd84224f08cda
6
+ metadata.gz: 93d025200fdba4ecd2efbd5a4f2e74ed13f924a259476b73e54d0b5f5b6684f45d88a51992a58a356739a4d718a6039c686d81dc7fede007501301df3846615a
7
+ data.tar.gz: f0827f0b2a27d02b32b8c530b70b8458346f08b317c36a506cc2536e620893193150e8b50c564a5d610ebaafa7f6b8a3317063e59d731a9ce875f493573a1118
@@ -0,0 +1,48 @@
1
+ require_relative '../base'
2
+
3
+ module GdsApi
4
+ module PerformancePlatform
5
+ class DataOut < GdsApi::Base
6
+ # Fetch all service feedback from the performance platform for a given transaction
7
+ # page slug.
8
+ #
9
+ # Makes a +GET+ request.
10
+ #
11
+ # The results are ordered date ascending.
12
+ #
13
+ # @param transaction_page_slug [String] The slug for which service feedback is
14
+ # needed.
15
+ #
16
+ # # @example
17
+ #
18
+ # performance_platform_data_out.service_feedback('register-to-vote')
19
+ #
20
+ # #=> {
21
+ # "data": [
22
+ # {
23
+ # "_day_start_at": "2014-06-10T00:00:00+00:00",
24
+ # "_hour_start_at": "2014-06-10T00:00:00+00:00",
25
+ # "_id": "20140610_register-to-vote",
26
+ # "_month_start_at": "2014-06-01T00:00:00+00:00",
27
+ # "_quarter_start_at": "2014-04-01T00:00:00+00:00",
28
+ # "_timestamp": "2014-06-10T00:00:00+00:00",
29
+ # "_updated_at": "2014-06-11T00:30:50.901000+00:00",
30
+ # "_week_start_at": "2014-06-09T00:00:00+00:00",
31
+ # "comments": 217,
32
+ # "period": "day",
33
+ # "rating_1": 4,
34
+ # "rating_2": 6,
35
+ # "rating_3": 7,
36
+ # "rating_4": 74,
37
+ # "rating_5": 574,
38
+ # "slug": "register-to-vote",
39
+ # "total": 665
40
+ # },
41
+ # ...
42
+ # }
43
+ def service_feedback(transaction_page_slug)
44
+ get_json!("#{endpoint}/data/#{transaction_page_slug}/customer-satisfaction")
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,23 @@
1
+ module GdsApi
2
+ module TestHelpers
3
+ module PerformancePlatform
4
+ module DataOut
5
+ PP_DATA_OUT_ENDPOINT = "http://www.performance.service.gov.uk".freeze
6
+
7
+ def stub_service_feedback(slug, response_body = {})
8
+ stub_http_request(:get, "#{PP_DATA_OUT_ENDPOINT}/data/#{slug}/customer-satisfaction").
9
+ to_return(status: 200, body: response_body.to_json)
10
+ end
11
+
12
+ def stub_data_set_not_available(slug)
13
+ stub_http_request(:get, "#{PP_DATA_OUT_ENDPOINT}/data/#{slug}/customer-satisfaction").
14
+ to_return(status: 404)
15
+ end
16
+
17
+ def stub_service_not_available
18
+ stub_request(:any, /#{PP_DATA_OUT_ENDPOINT}\/.*/).to_return(status: 503)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '37.2.0'.freeze
2
+ VERSION = '37.3.0'.freeze
3
3
  end
@@ -0,0 +1,24 @@
1
+ require 'test_helper'
2
+ require 'gds_api/performance_platform/data_out'
3
+ require 'gds_api/test_helpers/performance_platform/data_out'
4
+
5
+ describe GdsApi::PerformancePlatform::DataOut do
6
+ include GdsApi::TestHelpers::PerformancePlatform::DataOut
7
+
8
+ before do
9
+ @base_api_url = GdsApi::TestHelpers::PerformancePlatform::DataOut::PP_DATA_OUT_ENDPOINT
10
+ @api = GdsApi::PerformancePlatform::DataOut.new(@base_api_url)
11
+ end
12
+
13
+ let(:transaction_slug) { 'register-to-vote' }
14
+
15
+ it "calls the service feedback endpoint for a particular slug" do
16
+ request_details = { "some" => "data" }
17
+
18
+ stub_post = stub_service_feedback(transaction_slug, request_details)
19
+
20
+ @api.service_feedback(transaction_slug)
21
+
22
+ assert_requested(stub_post)
23
+ end
24
+ 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: 37.2.0
4
+ version: 37.3.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: 2016-10-12 00:00:00.000000000 Z
11
+ date: 2016-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek
@@ -371,6 +371,7 @@ files:
371
371
  - lib/gds_api/panopticon/registerer.rb
372
372
  - lib/gds_api/part_methods.rb
373
373
  - lib/gds_api/performance_platform/data_in.rb
374
+ - lib/gds_api/performance_platform/data_out.rb
374
375
  - lib/gds_api/publisher.rb
375
376
  - lib/gds_api/publishing_api.rb
376
377
  - lib/gds_api/publishing_api/special_route_publisher.rb
@@ -401,6 +402,7 @@ files:
401
402
  - lib/gds_api/test_helpers/organisations.rb
402
403
  - lib/gds_api/test_helpers/panopticon.rb
403
404
  - lib/gds_api/test_helpers/performance_platform/data_in.rb
405
+ - lib/gds_api/test_helpers/performance_platform/data_out.rb
404
406
  - lib/gds_api/test_helpers/publisher.rb
405
407
  - lib/gds_api/test_helpers/publishing_api.rb
406
408
  - lib/gds_api/test_helpers/publishing_api_v2.rb
@@ -443,6 +445,7 @@ files:
443
445
  - test/panopticon_registerer_test.rb
444
446
  - test/panopticon_test.rb
445
447
  - test/pp_data_in_test.rb
448
+ - test/pp_data_out_test.rb
446
449
  - test/publisher_api_test.rb
447
450
  - test/publishing_api/special_route_publisher_test.rb
448
451
  - test/publishing_api_test.rb
@@ -535,6 +538,7 @@ test_files:
535
538
  - test/middleware/govuk_header_sniffer_test.rb
536
539
  - test/content_api_test.rb
537
540
  - test/email_alert_api_test.rb
541
+ - test/pp_data_out_test.rb
538
542
  - test/publishing_api_v2_test.rb
539
543
  - test/rummager_test.rb
540
544
  - test/mapit_test.rb