gds-api-adapters 2.6.0 → 2.7.0
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.
- data/lib/gds_api/content_api.rb +4 -0
- data/lib/gds_api/version.rb +1 -1
- data/test/content_api_test.rb +12 -0
- metadata +3 -3
data/lib/gds_api/content_api.rb
CHANGED
@@ -8,6 +8,10 @@ class GdsApi::ContentApi < GdsApi::Base
|
|
8
8
|
get_json!("#{base_url}/tags.json?type=section")
|
9
9
|
end
|
10
10
|
|
11
|
+
def tag(tag)
|
12
|
+
get_json("#{base_url}/tags/#{CGI.escape(tag)}.json")
|
13
|
+
end
|
14
|
+
|
11
15
|
def with_tag(tag)
|
12
16
|
get_json!("#{base_url}/with_tag.json?tag=#{CGI.escape(tag)}&include_children=1")
|
13
17
|
end
|
data/lib/gds_api/version.rb
CHANGED
data/test/content_api_test.rb
CHANGED
@@ -31,6 +31,18 @@ describe GdsApi::ContentApi do
|
|
31
31
|
subsection = response["results"][0]
|
32
32
|
assert_equal "Complain about a claims company", subsection["title"]
|
33
33
|
end
|
34
|
+
|
35
|
+
it "should return tag tree for a specific tag" do
|
36
|
+
tag = "crime-and-justice"
|
37
|
+
api_url = "#{@base_api_url}/tags/#{tag}.json"
|
38
|
+
json = {
|
39
|
+
title: "Crime and Justice"
|
40
|
+
}
|
41
|
+
stub_request(:get, api_url).to_return(:status => 200, :body => json.to_json)
|
42
|
+
response = @api.tag(tag)
|
43
|
+
title = response['title']
|
44
|
+
assert_equal json[:title], title
|
45
|
+
end
|
34
46
|
end
|
35
47
|
|
36
48
|
describe "licence" 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: 2.
|
5
|
+
version: 2.7.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- James Stewart
|
@@ -205,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
205
|
requirements:
|
206
206
|
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
hash:
|
208
|
+
hash: 3548980894617052374
|
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:
|
217
|
+
hash: 3548980894617052374
|
218
218
|
segments:
|
219
219
|
- 0
|
220
220
|
version: "0"
|