gds-api-adapters 3.3.0 → 3.3.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.
@@ -10,7 +10,7 @@ module GdsApi
10
10
  body = plural_response_base.merge(
11
11
  "results" => slugs.map do |slug|
12
12
  {
13
- "id" => "http://contentapi.test.gov.uk/tags/#{CGI.escape(slug)}.json",
13
+ "id" => "#{CONTENT_API_ENDPOINT}/tags/#{CGI.escape(slug)}.json",
14
14
  "web_url" => nil,
15
15
  "title" => titleize_slug(slug),
16
16
  "details" => {
@@ -19,7 +19,7 @@ module GdsApi
19
19
  },
20
20
  "parent" => nil,
21
21
  "content_with_tag" => {
22
- "id" => "http://contentapi.test.gov.uk/with_tag.json?tag=#{CGI.escape(slug)}",
22
+ "id" => "#{CONTENT_API_ENDPOINT}/with_tag.json?tag=#{CGI.escape(slug)}",
23
23
  "web_url" => "http://www.test.gov.uk/browse/#{slug}"
24
24
  }
25
25
  }
@@ -42,8 +42,11 @@ module GdsApi
42
42
  artefact_for_slug(artefact_slug)
43
43
  end
44
44
  )
45
- url = "https://contentapi.test.alphagov.co.uk/with_tag.json?sort=alphabetical&tag=#{CGI.escape(slug)}"
46
- stub_request(:get, url).to_return(status: 200, body: body.to_json, headers: {})
45
+ sort_orders = ["alphabetical", "curated"]
46
+ sort_orders.each do |order|
47
+ url = "#{CONTENT_API_ENDPOINT}/with_tag.json?sort=#{order}&tag=#{CGI.escape(slug)}"
48
+ stub_request(:get, url).to_return(status: 200, body: body.to_json, headers: {})
49
+ end
47
50
  end
48
51
 
49
52
  def content_api_has_subsections(parent_slug, subsection_slugs)
@@ -51,7 +54,7 @@ module GdsApi
51
54
  body = plural_response_base.merge(
52
55
  "results" => subsection_slugs.map do |slug|
53
56
  {
54
- "id" => "http://contentapi.test.gov.uk/tags/#{CGI.escape(slug)}.json",
57
+ "id" => "#{CONTENT_API_ENDPOINT}/tags/#{CGI.escape(slug)}.json",
55
58
  "web_url" => nil,
56
59
  "title" => titleize_slug(slug),
57
60
  "details" => {
@@ -60,7 +63,7 @@ module GdsApi
60
63
  },
61
64
  "parent" => parent_section,
62
65
  "content_with_tag" => {
63
- "id" => "http://contentapi.test.gov.uk/with_tag.json?tag=#{CGI.escape(slug)}",
66
+ "id" => "#{CONTENT_API_ENDPOINT}/with_tag.json?tag=#{CGI.escape(slug)}",
64
67
  "web_url" => "http://www.test.gov.uk/browse/#{slug}"
65
68
  }
66
69
  }
@@ -117,7 +120,7 @@ module GdsApi
117
120
  singular_response_base.merge(
118
121
  "title" => titleize_slug(slug),
119
122
  "format" => "guide",
120
- "id" => "http://contentapi.test.gov.uk/#{slug}.json",
123
+ "id" => "#{CONTENT_API_ENDPOINT}/#{slug}.json",
121
124
  "web_url" => "http://frontend.test.gov.uk/#{slug}",
122
125
  "details" => {
123
126
  "need_id" => "1234",
@@ -184,7 +187,7 @@ module GdsApi
184
187
  artefact["related"] = related_artefact_slugs.map do |related_slug|
185
188
  {
186
189
  "title" => titleize_slug(related_slug),
187
- "id" => "https://contentapi.test.alphagov.co.uk/#{CGI.escape(related_slug)}.json",
190
+ "id" => "#{CONTENT_API_ENDPOINT}/#{CGI.escape(related_slug)}.json",
188
191
  "web_url" => "https://www.test.gov.uk/#{related_slug}",
189
192
  "details" => {}
190
193
  }
@@ -198,12 +201,12 @@ module GdsApi
198
201
  end
199
202
  {
200
203
  "title" => titleize_slug(slug.split('/').last),
201
- "id" => "https://contentapi.test.alphagov.co.uk/tags/#{CGI.escape(slug)}.json",
204
+ "id" => "#{CONTENT_API_ENDPOINT}/tags/#{CGI.escape(slug)}.json",
202
205
  "details" => {
203
206
  "type" => tag_type
204
207
  },
205
208
  "content_with_tag" => {
206
- "id" => "https://contentapi.test.alphagov.co.uk/with_tag.json?tag=#{CGI.escape(slug)}",
209
+ "id" => "#{CONTENT_API_ENDPOINT}/with_tag.json?tag=#{CGI.escape(slug)}",
207
210
  "web_url" => "https://www.test.gov.uk/browse/#{slug}",
208
211
  },
209
212
  "parent" => parent
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '3.3.0'
2
+ VERSION = '3.3.1'
3
3
  end
@@ -15,7 +15,7 @@ describe GdsApi::ContentApi do
15
15
  content_api_has_root_sections(["crime"])
16
16
  response = @api.sections
17
17
  first_section = response["results"][0]
18
- assert_equal "http://contentapi.test.gov.uk/tags/crime.json", first_section["id"]
18
+ assert_equal "https://contentapi.test.alphagov.co.uk/tags/crime.json", first_section["id"]
19
19
  end
20
20
  end
21
21
 
@@ -23,14 +23,14 @@ describe GdsApi::ContentApi do
23
23
  it "should show the artefact" do
24
24
  content_api_has_an_artefact("devolution-uk")
25
25
  response = @api.artefact("devolution-uk")
26
- assert_equal "http://contentapi.test.gov.uk/devolution-uk.json", response["id"]
26
+ assert_equal "https://contentapi.test.alphagov.co.uk/devolution-uk.json", response["id"]
27
27
  end
28
28
 
29
29
  it "should be able to fetch unpublished editions when authenticated" do
30
30
  api = GdsApi::ContentApi.new('test', { bearer_token: 'MY_BEARER_TOKEN' })
31
31
  content_api_has_unpublished_artefact("devolution-uk", 3)
32
32
  response = api.artefact("devolution-uk", edition: 3)
33
- assert_equal "http://contentapi.test.gov.uk/devolution-uk.json", response["id"]
33
+ assert_equal "https://contentapi.test.alphagov.co.uk/devolution-uk.json", response["id"]
34
34
  end
35
35
 
36
36
  it "should raise an exception if no bearer token is used when fetching unpublished editions" do
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.3.0
5
+ version: 3.3.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-08 00:00:00 Z
13
+ date: 2012-10-11 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: plek
@@ -155,43 +155,43 @@ extra_rdoc_files: []
155
155
 
156
156
  files:
157
157
  - lib/gds_api/version.rb
158
- - lib/gds_api/typhoeus_client.rb
159
- - lib/gds_api/base.rb
160
- - lib/gds_api/licence_application.rb
161
- - lib/gds_api/contactotron.rb
158
+ - lib/gds_api/publisher.rb
162
159
  - lib/gds_api/panopticon/registerer.rb
163
- - lib/gds_api/needotron.rb
164
- - lib/gds_api/imminence.rb
165
- - lib/gds_api/rummager.rb
160
+ - lib/gds_api/typhoeus_client.rb
166
161
  - lib/gds_api/content_api.rb
167
- - lib/gds_api/exceptions.rb
168
- - lib/gds_api/json_client.rb
169
- - lib/gds_api/core-ext/openstruct.rb
170
- - lib/gds_api/response.rb
171
- - lib/gds_api/publisher.rb
172
- - lib/gds_api/test_helpers/licence_application.rb
173
- - lib/gds_api/test_helpers/contactotron.rb
174
- - lib/gds_api/test_helpers/imminence.rb
175
- - lib/gds_api/test_helpers/content_api.rb
162
+ - lib/gds_api/imminence.rb
163
+ - lib/gds_api/contactotron.rb
176
164
  - lib/gds_api/test_helpers/publisher.rb
165
+ - lib/gds_api/test_helpers/content_api.rb
166
+ - lib/gds_api/test_helpers/imminence.rb
167
+ - lib/gds_api/test_helpers/contactotron.rb
168
+ - lib/gds_api/test_helpers/licence_application.rb
177
169
  - lib/gds_api/test_helpers/panopticon.rb
178
170
  - lib/gds_api/test_helpers/json_client_helper.rb
179
- - lib/gds_api/part_methods.rb
171
+ - lib/gds_api/licence_application.rb
172
+ - lib/gds_api/base.rb
173
+ - lib/gds_api/json_client.rb
174
+ - lib/gds_api/response.rb
175
+ - lib/gds_api/rummager.rb
180
176
  - lib/gds_api/panopticon.rb
177
+ - lib/gds_api/core-ext/openstruct.rb
178
+ - lib/gds_api/part_methods.rb
179
+ - lib/gds_api/needotron.rb
180
+ - lib/gds_api/exceptions.rb
181
181
  - lib/gds_api/helpers.rb
182
182
  - README.md
183
183
  - Rakefile
184
- - test/rummager_test.rb
185
- - test/publisher_api_test.rb
186
- - test/licence_application_api_test.rb
184
+ - test/contactotron_api_test.rb
187
185
  - test/panopticon_api_test.rb
186
+ - test/publisher_api_test.rb
187
+ - test/rummager_test.rb
188
188
  - test/imminence_api_test.rb
189
+ - test/panopticon_registerer_test.rb
190
+ - test/content_api_test.rb
189
191
  - test/json_client_test.rb
190
- - test/test_helper.rb
191
192
  - test/gds_api_base_test.rb
192
- - test/content_api_test.rb
193
- - test/panopticon_registerer_test.rb
194
- - test/contactotron_api_test.rb
193
+ - test/licence_application_api_test.rb
194
+ - test/test_helper.rb
195
195
  homepage: http://github.com/alphagov/gds-api-adapters
196
196
  licenses: []
197
197
 
@@ -205,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
- hash: 604582119140206169
208
+ hash: 259809380172045694
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: 604582119140206169
217
+ hash: 259809380172045694
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/rummager_test.rb
230
- - test/publisher_api_test.rb
231
- - test/licence_application_api_test.rb
229
+ - test/contactotron_api_test.rb
232
230
  - test/panopticon_api_test.rb
231
+ - test/publisher_api_test.rb
232
+ - test/rummager_test.rb
233
233
  - test/imminence_api_test.rb
234
+ - test/panopticon_registerer_test.rb
235
+ - test/content_api_test.rb
234
236
  - test/json_client_test.rb
235
- - test/test_helper.rb
236
237
  - test/gds_api_base_test.rb
237
- - test/content_api_test.rb
238
- - test/panopticon_registerer_test.rb
239
- - test/contactotron_api_test.rb
238
+ - test/licence_application_api_test.rb
239
+ - test/test_helper.rb