gds-api-adapters 18.8.0 → 18.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea89fd438cbba6c673809179881a7bdbadd0e3dc
4
- data.tar.gz: 208b3d3b4b5c4d9d9ba3d8bef0628c7c6a39ecff
3
+ metadata.gz: e0e568b7a3e0e220c2e8afb82658ba990a38fc75
4
+ data.tar.gz: 7a5f7b7afc65f730ee352df1b61265e4735a065f
5
5
  SHA512:
6
- metadata.gz: baed69aa1bf51bc65c263f0ced8c377fee6ba2d918b8e415299669f42f434bb3c32e182081396eb10a6cbfb4de9d8edc7411943f2280bea991656da57bea9d1a
7
- data.tar.gz: f3505c6e0d17c9525f017ace7613f4660c64f9d5e10ced0655fe1a2754af3a185e3cf0ce6d638bf8cf31398b1a64a42fb3c9e77df3884759cb034bd91f266191
6
+ metadata.gz: 5f1d1e421d9da081394735ed6dd7101d0812acb22a920b6b98631cc420ba65865968435980da59357c12cb6e42c7d1f6b39777bbaa796e9823af8d8b88335044
7
+ data.tar.gz: 9a6b7a1d95aa39a07a1be6a4833a7d98d91e6ec7885d661354801ee4691fe3a2a4700372fc8bc5009ad01359fe8b0c386e0be68680a2cf23df6befb136e4fb1a
@@ -22,4 +22,13 @@ class GdsApi::SupportApi < GdsApi::Base
22
22
  uri = "#{endpoint}/anonymous-feedback" + query_string(options)
23
23
  get_json!(uri)
24
24
  end
25
+
26
+ def organisation_summary(organisation_slug, options = {})
27
+ uri = "#{endpoint}/anonymous-feedback/organisations/#{organisation_slug}" + query_string(options)
28
+ get_json!(uri)
29
+ end
30
+
31
+ def organisations_list
32
+ get_json!("#{endpoint}/anonymous-feedback/organisations")
33
+ end
25
34
  end
@@ -41,6 +41,26 @@ module GdsApi
41
41
  with(query: params).
42
42
  to_return(status: 200, body: response_body.to_json)
43
43
  end
44
+
45
+ def stub_anonymous_feedback_organisation_summary(slug, ordering = nil, response_body = {})
46
+ uri = "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/organisations/#{slug}"
47
+ uri << "?ordering=#{ordering}" if ordering
48
+ stub_http_request(:get, uri).
49
+ to_return(status: 200, body: response_body.to_json)
50
+ end
51
+
52
+ def stub_anonymous_feedback_organisations_list(response_body = nil)
53
+ response_body ||= [{
54
+ slug: "cabinet-office",
55
+ web_url: "https://www.gov.uk/government/organisations/cabinet-office",
56
+ title: "Cabinet Office",
57
+ acronym: "CO",
58
+ govuk_status: "live"
59
+ }]
60
+
61
+ stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/organisations").
62
+ to_return(status: 200, body: response_body)
63
+ end
44
64
  end
45
65
  end
46
66
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '18.8.0'
2
+ VERSION = '18.9.0'
3
3
  end
@@ -79,4 +79,37 @@ describe GdsApi::SupportApi do
79
79
  assert_requested(stub_get)
80
80
  end
81
81
  end
82
+
83
+ describe "GET /anonymous-feedback/organisations/:organisation_slug" do
84
+ it "fetches organisation summary" do
85
+ slug = "hm-revenue-customs"
86
+
87
+ stub_get = stub_anonymous_feedback_organisation_summary(slug)
88
+
89
+ @api.organisation_summary(slug)
90
+
91
+ assert_requested(stub_get)
92
+ end
93
+
94
+ it "accepts an ordering parameter" do
95
+ slug = "hm-revenue-customs"
96
+ ordering = "last_30_days"
97
+
98
+ stub_get = stub_anonymous_feedback_organisation_summary(slug, ordering)
99
+
100
+ @api.organisation_summary(slug, ordering: ordering)
101
+
102
+ assert_requested(stub_get)
103
+ end
104
+ end
105
+
106
+ describe "GET /anonymous-feedback/organisations" do
107
+ it "fetches a list of organisations" do
108
+ stub_get = stub_anonymous_feedback_organisations_list
109
+
110
+ @api.organisations_list
111
+
112
+ assert_requested(stub_get)
113
+ end
114
+ end
82
115
  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.8.0
4
+ version: 18.9.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-15 00:00:00.000000000 Z
11
+ date: 2015-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek