gds-api-adapters 2.7.0 → 2.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -98,9 +98,27 @@ module GdsApi
98
98
 
99
99
  def artefact_for_slug_in_a_subsection(slug, subsection_slug)
100
100
  artefact = artefact_for_slug(slug)
101
- base_section = tag_for_slug(subsection_slug.split('/').first, "section")
102
- section = tag_for_slug(subsection_slug, "section").merge("parent" => base_section)
103
- artefact["tags"] << section
101
+
102
+ # for each "part" of the path, we want to reduce across the
103
+ # list and build up a tree of nested tags.
104
+ # This will turn "thing1/thing2" into:
105
+ # Tag{ thing2, parent: Tag{ thing1 } }
106
+
107
+ tag_tree = nil
108
+ subsection_slug.split('/').inject(nil) do |last_section, subsection|
109
+ subsection = [last_section, subsection].join('/') if last_section
110
+ section = tag_for_slug(subsection, "section")
111
+ if tag_tree
112
+ # Because tags are nested within one another, this makes
113
+ # the current part the top, and the rest we've seen the
114
+ # ancestors
115
+ tag_tree = section.merge("parent" => tag_tree)
116
+ else
117
+ tag_tree = section
118
+ end
119
+ subsection
120
+ end
121
+ artefact["tags"] << tag_tree
104
122
  artefact
105
123
  end
106
124
 
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '2.7.0'
2
+ VERSION = '2.7.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: 2.7.0
5
+ version: 2.7.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-09-21 00:00:00 Z
13
+ date: 2012-09-24 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: plek
@@ -154,43 +154,43 @@ extensions: []
154
154
  extra_rdoc_files: []
155
155
 
156
156
  files:
157
- - lib/gds_api/content_api.rb
158
- - lib/gds_api/licence_application.rb
159
- - lib/gds_api/test_helpers/content_api.rb
160
- - lib/gds_api/test_helpers/licence_application.rb
161
- - lib/gds_api/test_helpers/contactotron.rb
162
- - lib/gds_api/test_helpers/json_client_helper.rb
163
- - lib/gds_api/test_helpers/publisher.rb
164
- - lib/gds_api/test_helpers/panopticon.rb
165
- - lib/gds_api/test_helpers/imminence.rb
157
+ - lib/gds_api/helpers.rb
158
+ - lib/gds_api/base.rb
166
159
  - lib/gds_api/part_methods.rb
167
- - lib/gds_api/needotron.rb
160
+ - lib/gds_api/exceptions.rb
168
161
  - lib/gds_api/rummager.rb
169
162
  - lib/gds_api/typhoeus_client.rb
170
- - lib/gds_api/json_client.rb
163
+ - lib/gds_api/imminence.rb
164
+ - lib/gds_api/publisher.rb
171
165
  - lib/gds_api/contactotron.rb
166
+ - lib/gds_api/panopticon.rb
167
+ - lib/gds_api/version.rb
168
+ - lib/gds_api/test_helpers/imminence.rb
169
+ - lib/gds_api/test_helpers/publisher.rb
170
+ - lib/gds_api/test_helpers/contactotron.rb
171
+ - lib/gds_api/test_helpers/panopticon.rb
172
+ - lib/gds_api/test_helpers/json_client_helper.rb
173
+ - lib/gds_api/test_helpers/licence_application.rb
174
+ - lib/gds_api/test_helpers/content_api.rb
172
175
  - lib/gds_api/response.rb
173
176
  - lib/gds_api/panopticon/registerer.rb
174
- - lib/gds_api/publisher.rb
175
- - lib/gds_api/exceptions.rb
176
- - lib/gds_api/version.rb
177
- - lib/gds_api/helpers.rb
178
- - lib/gds_api/base.rb
179
- - lib/gds_api/panopticon.rb
177
+ - lib/gds_api/needotron.rb
178
+ - lib/gds_api/json_client.rb
179
+ - lib/gds_api/licence_application.rb
180
180
  - lib/gds_api/core-ext/openstruct.rb
181
- - lib/gds_api/imminence.rb
181
+ - lib/gds_api/content_api.rb
182
182
  - README.md
183
183
  - Rakefile
184
- - test/imminence_api_test.rb
185
- - test/contactotron_api_test.rb
186
- - test/rummager_test.rb
187
- - test/licence_application_api_test.rb
184
+ - test/panopticon_registerer_test.rb
185
+ - test/gds_api_base_test.rb
188
186
  - test/json_client_test.rb
187
+ - test/test_helper.rb
188
+ - test/licence_application_api_test.rb
189
189
  - test/publisher_api_test.rb
190
- - test/panopticon_registerer_test.rb
190
+ - test/imminence_api_test.rb
191
191
  - test/panopticon_api_test.rb
192
- - test/test_helper.rb
193
- - test/gds_api_base_test.rb
192
+ - test/contactotron_api_test.rb
193
+ - test/rummager_test.rb
194
194
  - test/content_api_test.rb
195
195
  homepage: http://github.com/alphagov/gds-api-adapters
196
196
  licenses: []
@@ -205,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
- hash: 3548980894617052374
208
+ hash: -2659915344647541393
209
209
  segments:
210
210
  - 0
211
211
  version: "0"
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  requirements:
215
215
  - - ">="
216
216
  - !ruby/object:Gem::Version
217
- hash: 3548980894617052374
217
+ hash: -2659915344647541393
218
218
  segments:
219
219
  - 0
220
220
  version: "0"
@@ -226,14 +226,14 @@ signing_key:
226
226
  specification_version: 3
227
227
  summary: Adapters to work with GDS APIs
228
228
  test_files:
229
- - test/imminence_api_test.rb
230
- - test/contactotron_api_test.rb
231
- - test/rummager_test.rb
232
- - test/licence_application_api_test.rb
229
+ - test/panopticon_registerer_test.rb
230
+ - test/gds_api_base_test.rb
233
231
  - test/json_client_test.rb
232
+ - test/test_helper.rb
233
+ - test/licence_application_api_test.rb
234
234
  - test/publisher_api_test.rb
235
- - test/panopticon_registerer_test.rb
235
+ - test/imminence_api_test.rb
236
236
  - test/panopticon_api_test.rb
237
- - test/test_helper.rb
238
- - test/gds_api_base_test.rb
237
+ - test/contactotron_api_test.rb
238
+ - test/rummager_test.rb
239
239
  - test/content_api_test.rb