gds-api-adapters 18.10.0 → 18.11.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: a1f261e1042cf8b7b363041571b71bf855f78519
4
- data.tar.gz: 2cb8d51f57520459ca9c1fe01914c153cc5502d5
3
+ metadata.gz: 9d5b0b0637486d62f69c0a5e6771ad5cfeec9ba0
4
+ data.tar.gz: 060cf1da1734eb2e625019b0e3ad0aeff5498baf
5
5
  SHA512:
6
- metadata.gz: acd1dccd956fb40d4af0193c12beb5bb1663c96bae349efa66bd9b2bc187e62cb0b43d836b2c41a842c9b514da01b32a121ece1ee40836d1b58e234b08dacf8f
7
- data.tar.gz: f882bcf37b5d501bbedcf1c4272c67aef50ee50454c5736c1d5809b8a5fb6080704fd0bf882c80b90439c8219b75f5bf41dd24fd948a3e28be8ea65a3f198b1b
6
+ metadata.gz: db0e76255b3703c6a09b70c1edddbe6e8b56f2f1123859e8aaa3f58df34cf3dbc1ef0d58e92163b68915a21d04d8a266929013eb8f02ec216d3a53425153b03f
7
+ data.tar.gz: 67dcfaaabc039878a97aab433e3882ee361fccde1e1aefb3f4ea6903c90bbeef00c09bf15486860c627c8dcad6361c3bdb5f4d160c4a528921f887e12c238a36
@@ -33,7 +33,11 @@ class GdsApi::SupportApi < GdsApi::Base
33
33
  end
34
34
 
35
35
  def organisations_list
36
- get_json!("#{endpoint}/anonymous-feedback/organisations")
36
+ get_json!("#{endpoint}/organisations")
37
+ end
38
+
39
+ def organisation(organisation_slug)
40
+ get_json!("#{endpoint}/organisations/#{organisation_slug}")
37
41
  end
38
42
 
39
43
  def feedback_export_request(id)
@@ -55,7 +55,7 @@ module GdsApi
55
55
  to_return(status: 200, body: response_body.to_json)
56
56
  end
57
57
 
58
- def stub_anonymous_feedback_organisations_list(response_body = nil)
58
+ def stub_organisations_list(response_body = nil)
59
59
  response_body ||= [{
60
60
  slug: "cabinet-office",
61
61
  web_url: "https://www.gov.uk/government/organisations/cabinet-office",
@@ -64,7 +64,20 @@ module GdsApi
64
64
  govuk_status: "live"
65
65
  }]
66
66
 
67
- stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/organisations").
67
+ stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/organisations").
68
+ to_return(status: 200, body: response_body.to_json)
69
+ end
70
+
71
+ def stub_organisation(slug = "cabinet-office", response_body = nil)
72
+ response_body ||= {
73
+ slug: slug,
74
+ web_url: "https://www.gov.uk/government/organisations/#{slug}",
75
+ title: "Cabinet Office",
76
+ acronym: "CO",
77
+ govuk_status: "live"
78
+ }
79
+
80
+ stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/organisations/#{slug}").
68
81
  to_return(status: 200, body: response_body.to_json)
69
82
  end
70
83
 
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '18.10.0'
2
+ VERSION = '18.11.0'
3
3
  end
@@ -103,16 +103,6 @@ describe GdsApi::SupportApi do
103
103
  end
104
104
  end
105
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
115
-
116
106
  describe "POST /anonymous-feedback/export-requests" do
117
107
  it "makes a POST request to the support api" do
118
108
  stub_post = stub_support_feedback_export_request_creation(notification_email: "foo@example.com")
@@ -132,4 +122,24 @@ describe GdsApi::SupportApi do
132
122
  assert_requested(stub_get)
133
123
  end
134
124
  end
125
+
126
+ describe "GET /organisations" do
127
+ it "fetches a list of organisations" do
128
+ stub_get = stub_organisations_list
129
+
130
+ @api.organisations_list
131
+
132
+ assert_requested(stub_get)
133
+ end
134
+ end
135
+
136
+ describe "GET /organisations/:slug" do
137
+ it "fetches a list of organisations" do
138
+ stub_get = stub_organisation("foo")
139
+
140
+ @api.organisation("foo")
141
+
142
+ assert_requested(stub_get)
143
+ end
144
+ end
135
145
  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.10.0
4
+ version: 18.11.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-06-02 00:00:00.000000000 Z
11
+ date: 2015-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek