gds-api-adapters 3.4.0 → 3.4.1

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.
@@ -6,21 +6,25 @@ module GdsApi
6
6
  module ContentApi
7
7
  CONTENT_API_ENDPOINT = 'https://contentapi.test.alphagov.co.uk'
8
8
 
9
- def content_api_has_root_sections(slugs)
9
+ # Takes an array of slugs, or hashes with section details (including a slug).
10
+ # Will stub out content_api calls for tags of type section to return these sections
11
+ def content_api_has_root_sections(slugs_or_sections)
12
+ sections = slugs_or_sections.map {|s| s.is_a?(Hash) ? s : {:slug => s} }
10
13
  body = plural_response_base.merge(
11
- "results" => slugs.map do |slug|
14
+ "results" => sections.map do |section|
12
15
  {
13
- "id" => "#{CONTENT_API_ENDPOINT}/tags/#{CGI.escape(slug)}.json",
16
+ "id" => "#{CONTENT_API_ENDPOINT}/tags/#{CGI.escape(section[:slug])}.json",
14
17
  "web_url" => nil,
15
- "title" => titleize_slug(slug),
18
+ "title" => section[:title] || titleize_slug(section[:slug]),
16
19
  "details" => {
17
20
  "type" => "section",
18
- "description" => "#{slug} description"
21
+ "description" => section[:description] || "#{section[:slug]} description",
22
+ "short_description" => section[:short_description] || "#{section[:slug]} short description",
19
23
  },
20
24
  "parent" => nil,
21
25
  "content_with_tag" => {
22
- "id" => "#{CONTENT_API_ENDPOINT}/with_tag.json?tag=#{CGI.escape(slug)}",
23
- "web_url" => "http://www.test.gov.uk/browse/#{slug}"
26
+ "id" => "#{CONTENT_API_ENDPOINT}/with_tag.json?tag=#{CGI.escape(section[:slug])}",
27
+ "web_url" => "http://www.test.gov.uk/browse/#{section[:slug]}"
24
28
  }
25
29
  }
26
30
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '3.4.0'
2
+ VERSION = '3.4.1'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 3.4.0
5
+ version: 3.4.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Stewart
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-10-26 00:00:00 Z
13
+ date: 2012-11-07 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: plek
@@ -166,43 +166,43 @@ extra_rdoc_files: []
166
166
 
167
167
  files:
168
168
  - lib/gds_api/version.rb
169
- - lib/gds_api/typhoeus_client.rb
170
- - lib/gds_api/base.rb
171
- - lib/gds_api/licence_application.rb
172
- - lib/gds_api/contactotron.rb
169
+ - lib/gds_api/publisher.rb
173
170
  - lib/gds_api/panopticon/registerer.rb
174
- - lib/gds_api/needotron.rb
175
- - lib/gds_api/imminence.rb
176
- - lib/gds_api/rummager.rb
171
+ - lib/gds_api/typhoeus_client.rb
177
172
  - lib/gds_api/content_api.rb
178
- - lib/gds_api/exceptions.rb
179
- - lib/gds_api/json_client.rb
180
- - lib/gds_api/core-ext/openstruct.rb
181
- - lib/gds_api/response.rb
182
- - lib/gds_api/publisher.rb
183
- - lib/gds_api/test_helpers/licence_application.rb
184
- - lib/gds_api/test_helpers/contactotron.rb
185
- - lib/gds_api/test_helpers/imminence.rb
186
- - lib/gds_api/test_helpers/content_api.rb
173
+ - lib/gds_api/imminence.rb
174
+ - lib/gds_api/contactotron.rb
187
175
  - lib/gds_api/test_helpers/publisher.rb
176
+ - lib/gds_api/test_helpers/content_api.rb
177
+ - lib/gds_api/test_helpers/imminence.rb
178
+ - lib/gds_api/test_helpers/contactotron.rb
179
+ - lib/gds_api/test_helpers/licence_application.rb
188
180
  - lib/gds_api/test_helpers/panopticon.rb
189
181
  - lib/gds_api/test_helpers/json_client_helper.rb
190
- - lib/gds_api/part_methods.rb
182
+ - lib/gds_api/licence_application.rb
183
+ - lib/gds_api/base.rb
184
+ - lib/gds_api/json_client.rb
185
+ - lib/gds_api/response.rb
186
+ - lib/gds_api/rummager.rb
191
187
  - lib/gds_api/panopticon.rb
188
+ - lib/gds_api/core-ext/openstruct.rb
189
+ - lib/gds_api/part_methods.rb
190
+ - lib/gds_api/needotron.rb
191
+ - lib/gds_api/exceptions.rb
192
192
  - lib/gds_api/helpers.rb
193
193
  - README.md
194
194
  - Rakefile
195
- - test/rummager_test.rb
196
- - test/publisher_api_test.rb
197
- - test/licence_application_api_test.rb
195
+ - test/contactotron_api_test.rb
198
196
  - test/panopticon_api_test.rb
197
+ - test/publisher_api_test.rb
198
+ - test/rummager_test.rb
199
199
  - test/imminence_api_test.rb
200
+ - test/panopticon_registerer_test.rb
201
+ - test/content_api_test.rb
200
202
  - test/json_client_test.rb
201
- - test/test_helper.rb
202
203
  - test/gds_api_base_test.rb
203
- - test/content_api_test.rb
204
- - test/panopticon_registerer_test.rb
205
- - test/contactotron_api_test.rb
204
+ - test/licence_application_api_test.rb
205
+ - test/test_helper.rb
206
206
  homepage: http://github.com/alphagov/gds-api-adapters
207
207
  licenses: []
208
208
 
@@ -216,7 +216,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
216
216
  requirements:
217
217
  - - ">="
218
218
  - !ruby/object:Gem::Version
219
- hash: 1331475186711709986
219
+ hash: -1606313441068628012
220
220
  segments:
221
221
  - 0
222
222
  version: "0"
@@ -225,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
225
  requirements:
226
226
  - - ">="
227
227
  - !ruby/object:Gem::Version
228
- hash: 1331475186711709986
228
+ hash: -1606313441068628012
229
229
  segments:
230
230
  - 0
231
231
  version: "0"
@@ -237,14 +237,14 @@ signing_key:
237
237
  specification_version: 3
238
238
  summary: Adapters to work with GDS APIs
239
239
  test_files:
240
- - test/rummager_test.rb
241
- - test/publisher_api_test.rb
242
- - test/licence_application_api_test.rb
240
+ - test/contactotron_api_test.rb
243
241
  - test/panopticon_api_test.rb
242
+ - test/publisher_api_test.rb
243
+ - test/rummager_test.rb
244
244
  - test/imminence_api_test.rb
245
+ - test/panopticon_registerer_test.rb
246
+ - test/content_api_test.rb
245
247
  - test/json_client_test.rb
246
- - test/test_helper.rb
247
248
  - test/gds_api_base_test.rb
248
- - test/content_api_test.rb
249
- - test/panopticon_registerer_test.rb
250
- - test/contactotron_api_test.rb
249
+ - test/licence_application_api_test.rb
250
+ - test/test_helper.rb