gds-api-adapters 10.6.3 → 10.6.4

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.
@@ -75,16 +75,11 @@ class GdsApi::ContentApi < GdsApi::Base
75
75
  end
76
76
 
77
77
  def artefact(slug, params={})
78
- url = "#{base_url}/#{CGI.escape(slug)}.json"
79
- query = params.map { |k,v| "#{k}=#{v}" }
80
- if query.any?
81
- url += "?#{query.join("&")}"
82
- end
78
+ get_json(artefact_url(slug, params))
79
+ end
83
80
 
84
- if params[:edition] && ! options.include?(:bearer_token)
85
- raise GdsApi::NoBearerToken
86
- end
87
- get_json(url)
81
+ def artefact!(slug, params={})
82
+ get_json!(artefact_url(slug, params))
88
83
  end
89
84
 
90
85
  def artefacts
@@ -152,4 +147,17 @@ class GdsApi::ContentApi < GdsApi::Base
152
147
  def key_for_tag_type(tag_type)
153
148
  tag_type.nil? ? "tag" : CGI.escape(tag_type)
154
149
  end
150
+
151
+ def artefact_url(slug, params)
152
+ url = "#{base_url}/#{CGI.escape(slug)}.json"
153
+ query = params.map { |k,v| "#{k}=#{v}" }
154
+ if query.any?
155
+ url += "?#{query.join("&")}"
156
+ end
157
+
158
+ if params[:edition] && ! options.include?(:bearer_token)
159
+ raise GdsApi::NoBearerToken
160
+ end
161
+ url
162
+ end
155
163
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '10.6.3'
2
+ VERSION = '10.6.4'
3
3
  end
@@ -190,6 +190,13 @@ describe GdsApi::ContentApi do
190
190
  end
191
191
  end
192
192
 
193
+ it "should raise a 410 if an artefact has been archived" do
194
+ content_api_has_an_archived_artefact("atlantis")
195
+ assert_raises GdsApi::HTTPGone do
196
+ @api.artefact!("atlantis")
197
+ end
198
+ end
199
+
193
200
  it "should be able to fetch artefacts with a '/' in the slug" do
194
201
  content_api_has_an_artefact("foreign-travel-advice/aruba")
195
202
  response = @api.artefact("foreign-travel-advice/aruba")
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.6.3
4
+ version: 10.6.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -376,7 +376,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
376
376
  version: '0'
377
377
  segments:
378
378
  - 0
379
- hash: -3682421441784526579
379
+ hash: -4240733080959165707
380
380
  required_rubygems_version: !ruby/object:Gem::Requirement
381
381
  none: false
382
382
  requirements:
@@ -385,7 +385,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
385
385
  version: '0'
386
386
  segments:
387
387
  - 0
388
- hash: -3682421441784526579
388
+ hash: -4240733080959165707
389
389
  requirements: []
390
390
  rubyforge_project:
391
391
  rubygems_version: 1.8.23