gds-api-adapters 10.1.0 → 10.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -250,30 +250,37 @@ module GdsApi
250
250
  end
251
251
 
252
252
  def artefact_for_slug_with_a_child_tag(tag_type, slug, child_tag_id)
253
+ artefact_for_slug_with_a_child_tags(tag_type, slug, [child_tag_id])
254
+ end
255
+
256
+ def artefact_for_slug_with_a_child_tags(tag_type, slug, child_tag_ids)
253
257
  artefact = artefact_for_slug(slug)
254
258
 
255
- # for each "part" of the path, we want to reduce across the
256
- # list and build up a tree of nested tags.
257
- # This will turn "thing1/thing2" into:
258
- # Tag{ thing2, parent: Tag{ thing1 } }
259
-
260
- tag_tree = nil
261
- child_tag_id.split('/').inject(nil) do |parent_tag, child_tag|
262
- child_tag = [parent_tag, child_tag].join('/') if parent_tag
263
- next_level_tag = tag_for_slug(child_tag, tag_type)
264
- if tag_tree
265
- # Because tags are nested within one another, this makes
266
- # the current part the top, and the rest we've seen the
267
- # ancestors
268
- tag_tree = next_level_tag.merge("parent" => tag_tree)
269
- else
270
- tag_tree = next_level_tag
259
+ child_tag_ids.each do |child_tag_id|
260
+ # for each "part" of the path, we want to reduce across the
261
+ # list and build up a tree of nested tags.
262
+ # This will turn "thing1/thing2" into:
263
+ # Tag{ thing2, parent: Tag{ thing1 } }
264
+
265
+ tag_tree = nil
266
+ child_tag_id.split('/').inject(nil) do |parent_tag, child_tag|
267
+ child_tag = [parent_tag, child_tag].join('/') if parent_tag
268
+ next_level_tag = tag_for_slug(child_tag, tag_type)
269
+ if tag_tree
270
+ # Because tags are nested within one another, this makes
271
+ # the current part the top, and the rest we've seen the
272
+ # ancestors
273
+ tag_tree = next_level_tag.merge("parent" => tag_tree)
274
+ else
275
+ tag_tree = next_level_tag
276
+ end
277
+
278
+ # This becomes the parent tag in the next iteration of the block
279
+ child_tag
271
280
  end
272
-
273
- # This becomes the parent tag in the next iteration of the block
274
- child_tag
281
+ artefact["tags"] << tag_tree
275
282
  end
276
- artefact["tags"] << tag_tree
283
+
277
284
  artefact
278
285
  end
279
286
 
@@ -315,7 +322,8 @@ module GdsApi
315
322
 
316
323
  {
317
324
  "id" => "#{CONTENT_API_ENDPOINT}/tags/#{CGI.escape(pluralized_tag_type)}/#{CGI.escape(tag[:slug])}.json",
318
- "web_url" => nil,
325
+ "slug" => tag[:slug],
326
+ "web_url" => "http://www.test.gov.uk/browse/#{tag[:slug]}",
319
327
  "title" => tag[:title] || titleize_slug(tag[:slug].split("/").last),
320
328
  "details" => {
321
329
  "type" => tag[:type],
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '10.1.0'
2
+ VERSION = '10.2.0'
3
3
  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: 10.1.0
4
+ version: 10.2.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-03-12 00:00:00.000000000 Z
12
+ date: 2014-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: plek
@@ -370,7 +370,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
370
370
  version: '0'
371
371
  segments:
372
372
  - 0
373
- hash: 1572270055243404070
373
+ hash: 1657316963344805388
374
374
  required_rubygems_version: !ruby/object:Gem::Requirement
375
375
  none: false
376
376
  requirements:
@@ -379,7 +379,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
379
379
  version: '0'
380
380
  segments:
381
381
  - 0
382
- hash: 1572270055243404070
382
+ hash: 1657316963344805388
383
383
  requirements: []
384
384
  rubyforge_project:
385
385
  rubygems_version: 1.8.23