gds-api-adapters 25.1.0 → 25.2.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.
- checksums.yaml +4 -4
- data/lib/gds_api/base.rb +1 -1
- data/lib/gds_api/publishing_api_v2.rb +5 -0
- data/lib/gds_api/version.rb +1 -1
- data/test/publishing_api_v2_test.rb +34 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ada01a209e69e96a0d9429e656111fc308e548f5
|
4
|
+
data.tar.gz: d1f6eadba826f1c3e96e8db670776dfc2a33b317
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5843c224cb8fb8cf1bb448df38dc96d9dcf5c1c3242975e5ed4ada6630468af381b7d57640ac9de80461765aaac52e80f3fb6c54b84d62260f787b473dae31f
|
7
|
+
data.tar.gz: 855bb0ad98d8cefe9c616c56a1d542e7af3726db10df33f1efacff897a958b43061e3f66e45c3f826081a9ddc69cb66f098d8ae145db132ed2823ecf03208431
|
data/lib/gds_api/base.rb
CHANGED
@@ -42,6 +42,11 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
42
42
|
put_json!(links_url(content_id), params)
|
43
43
|
end
|
44
44
|
|
45
|
+
def get_content_items(params)
|
46
|
+
query = query_string(params)
|
47
|
+
get_json("#{endpoint}/v2/content#{query}")
|
48
|
+
end
|
49
|
+
|
45
50
|
private
|
46
51
|
|
47
52
|
def content_url(content_id, params = {})
|
data/lib/gds_api/version.rb
CHANGED
@@ -892,4 +892,38 @@ describe GdsApi::PublishingApiV2 do
|
|
892
892
|
end
|
893
893
|
end
|
894
894
|
end
|
895
|
+
|
896
|
+
describe "#get_content_items" do
|
897
|
+
it "returns the content items of a certain format" do
|
898
|
+
publishing_api
|
899
|
+
.given("there is content with format 'topic'")
|
900
|
+
.upon_receiving("a get entries request")
|
901
|
+
.with(
|
902
|
+
method: :get,
|
903
|
+
path: "/v2/content",
|
904
|
+
query: "content_format=topic&fields%5B%5D=title&fields%5B%5D=base_path",
|
905
|
+
headers: {
|
906
|
+
"Content-Type" => "application/json",
|
907
|
+
},
|
908
|
+
)
|
909
|
+
.will_respond_with(
|
910
|
+
status: 200,
|
911
|
+
body: [
|
912
|
+
{ title: 'Content Item A', base_path: '/a-base-path' },
|
913
|
+
{ title: 'Content Item B', base_path: '/another-base-path' },
|
914
|
+
]
|
915
|
+
)
|
916
|
+
|
917
|
+
response = @api_client.get_content_items(
|
918
|
+
content_format: 'topic',
|
919
|
+
fields: [:title, :base_path],
|
920
|
+
)
|
921
|
+
|
922
|
+
assert_equal 200, response.code
|
923
|
+
assert_equal [
|
924
|
+
{ 'title' => 'Content Item A', 'base_path' => '/a-base-path' },
|
925
|
+
{ 'title' => 'Content Item B', 'base_path' => '/another-base-path' },
|
926
|
+
], response.to_a
|
927
|
+
end
|
928
|
+
end
|
895
929
|
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: 25.
|
4
|
+
version: 25.2.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-11-
|
11
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 5.0.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: tins
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 1.6.0
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 1.6.0
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: pact
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|