gds-api-adapters 20.1.2 → 21.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cdc41045197dd66b7831c907eac72e51846e6d7
4
- data.tar.gz: 0d8ab5611c4a35dbd5fd1d18fc63892afa258099
3
+ metadata.gz: 6bcaacb3f37eb313895187dd726c2dce6e09170c
4
+ data.tar.gz: 02f222992af858d36f5ef0f1787e379e77ca88f5
5
5
  SHA512:
6
- metadata.gz: e21e1e5804397b33b96fa4a6d31f7010efdaea5ca62bd5a5d1bed895f3b08b07fbd5e6546e8eb9b898130e2349c339282669a3f3baa9d91f4174e866e9c83540
7
- data.tar.gz: 87025d2a2e9214e58930b1b4331c63c2aa6d07515a4feca204bf02692bc749fce5d7460e1a995a0aca955e0d019c0ad4078cceb7a6555ab8776f5ae21dc87375
6
+ metadata.gz: 1b6ac58a27bc20babe9dc54e00f64298ee2b86ad617955e989a511666ff968317848617ea9ae02ab732fe0b8f5288173e996228f6d31ce64829c7348fd387233
7
+ data.tar.gz: 2a5109ede1a0b00e64f11db81e61c94210783c57090c0692422837160f5318820d81c7a15e55345ccbf5e39890846bf101cc548833df472d6a55b31135408129
@@ -52,13 +52,12 @@ class GdsApi::ContentApi < GdsApi::Base
52
52
  end
53
53
 
54
54
  def tag(tag, tag_type=nil)
55
- url = "#{base_url}/tags"
56
-
57
- if tag_type
58
- url << "/#{CGI.escape(tag_type)}"
55
+ if tag_type.nil?
56
+ raise "Requests for tags without a tag_type are no longer supported. You probably want a tag_type of 'section'. See https://github.com/alphagov/govuk_content_api/blob/f4c0102a1ae4970be6a440707b89798442f768b9/govuk_content_api.rb#L241-L250"
59
57
  end
60
58
 
61
- get_json("#{url}/#{CGI.escape(tag)}.json")
59
+ url = [base_url, "tags", CGI.escape(tag_type), CGI.escape(tag)].join("/") + ".json"
60
+ get_json(url)
62
61
  end
63
62
 
64
63
  def with_tag(tag, tag_type=nil, options={})
@@ -62,10 +62,6 @@ module GdsApi
62
62
 
63
63
  urls = ["#{CONTENT_API_ENDPOINT}/tags/#{CGI.escape(tag_type)}/#{CGI.escape(tag[:slug])}.json"]
64
64
 
65
- if tag_type == "section"
66
- urls << "#{CONTENT_API_ENDPOINT}/tags/#{CGI.escape(tag[:slug])}.json"
67
- end
68
-
69
65
  urls.each do |url|
70
66
  stub_request(:get, url).to_return(status: 200, body: body.to_json, headers: {})
71
67
  end
@@ -80,10 +76,6 @@ module GdsApi
80
76
 
81
77
  urls = ["#{CONTENT_API_ENDPOINT}/tags/#{CGI.escape(tag_type)}/#{CGI.escape(slug)}.json"]
82
78
 
83
- if tag_type == "section"
84
- urls << "#{CONTENT_API_ENDPOINT}/tags/#{CGI.escape(slug)}.json"
85
- end
86
-
87
79
  urls.each do |url|
88
80
  stub_request(:get, url).to_return(status: 404, body: body.to_json, headers: {})
89
81
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '20.1.2'
2
+ VERSION = '21.0.0'
3
3
  end
@@ -364,7 +364,7 @@ describe GdsApi::ContentApi do
364
364
 
365
365
  it "returns tag information for a section" do
366
366
  content_api_has_section("crime-and-justice")
367
- response = @api.tag("crime-and-justice")
367
+ response = @api.tag("crime-and-justice", "section")
368
368
 
369
369
  assert_equal "Crime and justice", response["title"]
370
370
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
- version: 20.1.2
4
+ version: 21.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Stewart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-03 00:00:00.000000000 Z
11
+ date: 2015-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek