gds-api-adapters 25.1.0 → 25.2.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: 8afbe2d34bba51917e28dd3f85e89d6e734c35af
4
- data.tar.gz: da4fdfd37ae75f002f6dc163a039856672bd40eb
3
+ metadata.gz: ada01a209e69e96a0d9429e656111fc308e548f5
4
+ data.tar.gz: d1f6eadba826f1c3e96e8db670776dfc2a33b317
5
5
  SHA512:
6
- metadata.gz: 2b31b1493c90363a24080b9d8bb0864ecf400dd52ae23d44b15bc5f59ba539f55bcdfcaf97b7923307dd27510299dd880e79af29b2cfbad6d8820c34219edd10
7
- data.tar.gz: 61cace3dd9782add1a8814776db7643054734766f72f3545954cd87a1356a12836860f489e2589b4cfa744caaa76c6486dd3249bcbc8f1dd6ce416ec7c42673c
6
+ metadata.gz: e5843c224cb8fb8cf1bb448df38dc96d9dcf5c1c3242975e5ed4ada6630468af381b7d57640ac9de80461765aaac52e80f3fb6c54b84d62260f787b473dae31f
7
+ data.tar.gz: 855bb0ad98d8cefe9c616c56a1d542e7af3726db10df33f1efacff897a958b43061e3f66e45c3f826081a9ddc69cb66f098d8ae145db132ed2823ecf03208431
data/lib/gds_api/base.rb CHANGED
@@ -65,7 +65,7 @@ private
65
65
  case value
66
66
  when Array
67
67
  value.map { |v|
68
- "#{CGI.escape(key+'[]')}=#{CGI.escape(v.to_s)}"
68
+ "#{CGI.escape(key.to_s+'[]')}=#{CGI.escape(v.to_s)}"
69
69
  }
70
70
  else
71
71
  "#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}"
@@ -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 = {})
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '25.1.0'
2
+ VERSION = '25.2.0'
3
3
  end
@@ -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.1.0
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-05 00:00:00.000000000 Z
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