gds-api-adapters 17.6.0 → 18.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4765fe1a71706fba9d3dac03b7da25cbd8b75f94
4
- data.tar.gz: 3ae561726bc965a18f442980dc6eed98e0e6ec2c
3
+ metadata.gz: e5572c84c14ef2a674d49ea2764082151e0b9a1f
4
+ data.tar.gz: 58d04feea3ce45b03967e1d26650965ae16ea0d0
5
5
  SHA512:
6
- metadata.gz: 6830b420c8366e96184ffc8890c11ab486afb549838f749eebf54dd78a1df9f9dc1549b3d4273420a6a388f8f5765d963ce7f92535cf250fb1a8caedd8498c00
7
- data.tar.gz: 0a7bc9e5bc72bee32faa1bf0290cbb8ba9e6c0f65b941b038a64d740b7fba09e179423953cd559f21abfcaf9d12454107c59091c1354156525955bd446be78a9
6
+ metadata.gz: be6a135928bd903ef4db52a918e7a4368956fc792166e2dd7a9b07a9a5fa95ee9e7f0d693d2a21de8168d655dc451e37eb653b88f6f2f8d95769d645a3ec9542
7
+ data.tar.gz: 0885ee5a74170251ec8309ec84247b0ba40e2715cfff6cb02651fd9c1e40656670aae1f99c31eee007de614fd23bad73d1ebf9f2bb24c3669af2724254d1d634
@@ -0,0 +1,15 @@
1
+ require_relative 'base'
2
+ require_relative 'exceptions'
3
+
4
+ class GdsApi::ContentRegister < GdsApi::Base
5
+
6
+ def entries(format)
7
+ get_json!(entries_url(format))
8
+ end
9
+
10
+ private
11
+
12
+ def entries_url(format)
13
+ "#{endpoint}/entries?format=#{format}"
14
+ end
15
+ end
@@ -2,6 +2,7 @@ require 'gds_api/asset_manager'
2
2
  require 'gds_api/business_support_api'
3
3
  require 'gds_api/collections_api'
4
4
  require 'gds_api/content_api'
5
+ require 'gds_api/content_register'
5
6
  require 'gds_api/content_store'
6
7
  require 'gds_api/fact_cave'
7
8
  require 'gds_api/imminence'
@@ -31,6 +32,10 @@ module GdsApi
31
32
  @content_api ||= GdsApi::ContentApi.new(Plek.current.find("contentapi"), options)
32
33
  end
33
34
 
35
+ def content_register(options = {})
36
+ @content_register ||= GdsApi::ContentRegister.new(Plek.current.find("content-register"), options)
37
+ end
38
+
34
39
  def content_store(options = {})
35
40
  @content_store ||= GdsApi::ContentStore.new(Plek.current.find("content-store"), options)
36
41
  end
@@ -1,6 +1,7 @@
1
1
  require 'gds_api/test_helpers/json_client_helper'
2
2
  require 'gds_api/test_helpers/common_responses'
3
3
  require 'plek'
4
+ require 'securerandom'
4
5
 
5
6
  module GdsApi
6
7
  module TestHelpers
@@ -85,6 +86,7 @@ module GdsApi
85
86
  "organisation_logo_type_class_name" => (slug =~ /ministry/ ? "single-identity" : "eo"),
86
87
  "closed_at" => nil,
87
88
  "govuk_status" => (slug =~ /ministry/ ? "live" : "joining"),
89
+ "content_id" => SecureRandom.uuid,
88
90
  },
89
91
  "parent_organisations" => [
90
92
  {
@@ -17,20 +17,18 @@ module GdsApi
17
17
 
18
18
  def stub_publishing_api_put_item(base_path, body = content_item_for_base_path(base_path), resource_path = '/content')
19
19
  url = PUBLISHING_API_ENDPOINT + resource_path + base_path
20
- body = body.to_json unless body.is_a?(String)
21
- stub_request(:put, url).with(body: body).to_return(status: 201, body: body, headers: {})
20
+ stub_request(:put, url).with(body: body).to_return(status: 201, body: '{}', headers: {})
22
21
  end
23
22
 
24
23
  def stub_publishing_api_put_intent(base_path, body = intent_for_base_path(base_path))
25
24
  url = PUBLISHING_API_ENDPOINT + "/publish-intent" + base_path
26
25
  body = body.to_json unless body.is_a?(String)
27
- stub_request(:put, url).with(body: body).to_return(status: 201, body: body, headers: {})
26
+ stub_request(:put, url).with(body: body).to_return(status: 201, body: '{}', headers: {})
28
27
  end
29
28
 
30
29
  def stub_publishing_api_destroy_intent(base_path)
31
30
  url = PUBLISHING_API_ENDPOINT + "/publish-intent" + base_path
32
- response_body = {base_path: base_path}.to_json
33
- stub_request(:delete, url).to_return(status: 201, body: response_body)
31
+ stub_request(:delete, url).to_return(status: 201, body: '{}')
34
32
  end
35
33
 
36
34
  def stub_default_publishing_api_put()
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '17.6.0'
2
+ VERSION = '18.0.0'
3
3
  end
@@ -15,7 +15,7 @@ describe GdsApi::PublishingApi do
15
15
  base_path = "/test-content-item"
16
16
  stub_publishing_api_put_item(base_path)
17
17
  response = @api.put_content_item(base_path, content_item_for_base_path(base_path))
18
- assert_equal base_path, response["base_path"]
18
+ assert_equal 201, response.code
19
19
  end
20
20
  end
21
21
 
@@ -25,7 +25,7 @@ describe GdsApi::PublishingApi do
25
25
  stub_publishing_api_put_draft_item(base_path)
26
26
 
27
27
  response = @api.put_draft_content_item(base_path, content_item_for_base_path(base_path))
28
- assert_equal base_path, response["base_path"]
28
+ assert_equal 201, response.code
29
29
  end
30
30
  end
31
31
 
@@ -34,14 +34,14 @@ describe GdsApi::PublishingApi do
34
34
  base_path = "/test-intent"
35
35
  stub_publishing_api_put_intent(base_path)
36
36
  response = @api.put_intent(base_path, intent_for_base_path(base_path))
37
- assert_equal base_path, response["base_path"]
37
+ assert_equal 201, response.code
38
38
  end
39
39
 
40
40
  it "should delete an intent" do
41
41
  base_path = "/test-intent"
42
42
  stub_publishing_api_destroy_intent(base_path)
43
43
  response = @api.destroy_intent(base_path)
44
- assert_equal base_path, response["base_path"]
44
+ assert_equal 201, response.code
45
45
  end
46
46
  end
47
47
  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: 17.6.0
4
+ version: 18.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-02-26 00:00:00.000000000 Z
11
+ date: 2015-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.6.3
75
+ version: 1.7.3
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.6.3
82
+ version: 1.7.3
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rack-cache
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -277,6 +277,7 @@ files:
277
277
  - lib/gds_api/business_support_api.rb
278
278
  - lib/gds_api/collections_api.rb
279
279
  - lib/gds_api/content_api.rb
280
+ - lib/gds_api/content_register.rb
280
281
  - lib/gds_api/content_store.rb
281
282
  - lib/gds_api/core-ext/openstruct.rb
282
283
  - lib/gds_api/email_alert_api.rb