gds-api-adapters 57.4.2 → 57.5.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
  SHA256:
3
- metadata.gz: 176cd69c8f0105f3946d1ca1e22a88e09679f2e43e747942039f92ad58fa9960
4
- data.tar.gz: f49d631e617d368153dfcad5a67ef4fa27a1e397d6deb6d1add70ba87d6fc7ff
3
+ metadata.gz: d790bf7e187109ce1f31d1ca428cd65493698bc72bbb5ebbf33eb60f38f0b66f
4
+ data.tar.gz: ff50c34b2405d4f1286df944e243857da924ef91a541b514810a2f7b41f38b33
5
5
  SHA512:
6
- metadata.gz: 3835a509a30d7a29b25c6bee6ef56ee12bd10561956110d1f4b98ca91bcd5e648f09d86c54c58e11ba03f249e5ec938fb90dd5cdf7a649ae157432e5bd2c3e55
7
- data.tar.gz: 900a8f7cfa7b6440edd0fcea3264f007ae8b64d756f0892c82dc213689f9683be447eb3260158119f913d5c149ad4ef69a20e318e9166004e029fb5d1827b93e
6
+ metadata.gz: 11ecc5a522a057ecb122889c5a7e88ecef23b4242784bc08e6ef7be94d7f1ce6611b238ace87b0e2449b9c6847377358f1bed66474e3d2cb010f6b3ec0cc55c2
7
+ data.tar.gz: 7f98a8869d10d02c99b20d1cc867285b82fbcd3320ef1ddfd46883a0d5b2736e26f2bf2a38445b569af635d19049213f4728364ec2d1a804cf7d07b015858eef
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ end
11
11
  Rake::TestTask.new("test") do |t|
12
12
  t.libs << "test"
13
13
  t.test_files = FileList["test/**/*_test.rb"]
14
- t.verbose = true
14
+ t.warning = false
15
15
  end
16
16
  task default: :test
17
17
 
data/lib/gds_api/base.rb CHANGED
@@ -23,7 +23,6 @@ class GdsApi::Base
23
23
  :put_json,
24
24
  :patch_json,
25
25
  :delete_json,
26
- :delete_json_with_params!,
27
26
  :get_raw, :get_raw!,
28
27
  :put_multipart,
29
28
  :post_multipart
@@ -26,7 +26,6 @@ class GdsApi::EmailAlertApi < GdsApi::Base
26
26
  government_document_supertype = attributes["government_document_supertype"]
27
27
  gov_delivery_id = attributes["gov_delivery_id"]
28
28
  content_purpose_supergroup = attributes["content_purpose_supergroup"]
29
- reject_content_purpose_supergroup = attributes["reject_content_purpose_supergroup"]
30
29
 
31
30
  if tags && links
32
31
  message = "please provide either tags or links (or neither), but not both"
@@ -41,7 +40,6 @@ class GdsApi::EmailAlertApi < GdsApi::Base
41
40
  params[:government_document_supertype] = government_document_supertype if government_document_supertype
42
41
  params[:gov_delivery_id] = gov_delivery_id if gov_delivery_id
43
42
  params[:content_purpose_supergroup] = content_purpose_supergroup if content_purpose_supergroup
44
- params[:reject_content_purpose_supergroup] = reject_content_purpose_supergroup if reject_content_purpose_supergroup
45
43
 
46
44
  query_string = nested_query_string(params)
47
45
  get_json("#{endpoint}/subscriber-lists?" + query_string)
@@ -64,19 +64,7 @@ module GdsApi
64
64
  do_json_request(:patch, url, params, additional_headers)
65
65
  end
66
66
 
67
- def delete_json(url, additional_headers = {})
68
- do_json_request(:delete, url, nil, additional_headers)
69
- end
70
-
71
- def delete_json_with_params!(url, params, additional_headers = {})
72
- warn <<-doc
73
- DEPRECATION NOTICE: Delete requests should not include parameters.
74
-
75
- Do not use this method as the ability to do this will be removed.
76
-
77
- Called from: #{caller[2]}
78
- doc
79
-
67
+ def delete_json(url, params = {}, additional_headers = {})
80
68
  do_json_request(:delete, url, params, additional_headers)
81
69
  end
82
70
 
@@ -12,8 +12,17 @@ class GdsApi::PublishingApi < GdsApi::Base
12
12
  e
13
13
  end
14
14
 
15
+ def unreserve_path(base_path, publishing_app)
16
+ payload = { publishing_app: publishing_app }
17
+ delete_json(unreserve_url(base_path), payload)
18
+ end
19
+
15
20
  private
16
21
 
22
+ def unreserve_url(base_path)
23
+ "#{endpoint}/paths#{base_path}"
24
+ end
25
+
17
26
  def intent_url(base_path)
18
27
  "#{endpoint}/publish-intent#{base_path}"
19
28
  end
@@ -19,6 +19,7 @@ module GdsApi
19
19
  def delete_document(type, id)
20
20
  delete_json(
21
21
  "#{documents_url}/#{id}",
22
+ nil,
22
23
  _type: type,
23
24
  )
24
25
  end
@@ -329,7 +329,6 @@ module GdsApi
329
329
  government_document_supertype = attributes["government_document_supertype"]
330
330
  gov_delivery_id = attributes["gov_delivery_id"]
331
331
  content_purpose_supergroup = attributes["content_purpose_supergroup"]
332
- reject_content_purpose_supergroup = attributes["reject_content_purpose_supergroup"]
333
332
 
334
333
  params = {}
335
334
  params[:tags] = tags if tags
@@ -339,7 +338,6 @@ module GdsApi
339
338
  params[:government_document_supertype] = government_document_supertype if government_document_supertype
340
339
  params[:gov_delivery_id] = gov_delivery_id if gov_delivery_id
341
340
  params[:content_purpose_supergroup] = content_purpose_supergroup if content_purpose_supergroup
342
- params[:reject_content_purpose_supergroup] = reject_content_purpose_supergroup if reject_content_purpose_supergroup
343
341
 
344
342
  query = Rack::Utils.build_nested_query(params)
345
343
  end
@@ -11,6 +11,18 @@ module GdsApi
11
11
 
12
12
  PUBLISHING_API_ENDPOINT = Plek.current.find('publishing-api')
13
13
 
14
+ def stub_publishing_api_unreserve_path(base_path, publishing_app = /.*/)
15
+ stub_publishing_api_unreserve_path_with_code(base_path, publishing_app, 200)
16
+ end
17
+
18
+ def stub_publishing_api_unreserve_path_not_found(base_path, publishing_app = /.*/)
19
+ stub_publishing_api_unreserve_path_with_code(base_path, publishing_app, 404)
20
+ end
21
+
22
+ def stub_publishing_api_unreserve_path_invalid(base_path, publishing_app = /.*/)
23
+ stub_publishing_api_unreserve_path_with_code(base_path, publishing_app, 422)
24
+ end
25
+
14
26
  def stub_publishing_api_put_intent(base_path, body = intent_for_publishing_api(base_path))
15
27
  url = PUBLISHING_API_ENDPOINT + "/publish-intent" + base_path
16
28
  body = body.to_json unless body.is_a?(String)
@@ -101,6 +113,12 @@ module GdsApi
101
113
 
102
114
  private
103
115
 
116
+ def stub_publishing_api_unreserve_path_with_code(base_path, publishing_app, code)
117
+ url = PUBLISHING_API_ENDPOINT + "/paths" + base_path
118
+ body = { publishing_app: publishing_app }
119
+ stub_request(:delete, url).with(body: body).to_return(status: code, body: '{}', headers: { "Content-Type" => "application/json; charset=utf-8" })
120
+ end
121
+
104
122
  def values_match_recursively(expected_value, actual_value)
105
123
  case expected_value
106
124
  when Hash
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '57.4.2'.freeze
2
+ VERSION = '57.5.0'.freeze
3
3
  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: 57.4.2
4
+ version: 57.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-04 00:00:00.000000000 Z
11
+ date: 2019-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -338,14 +338,14 @@ dependencies:
338
338
  requirements:
339
339
  - - "~>"
340
340
  - !ruby/object:Gem::Version
341
- version: '3.3'
341
+ version: '3.5'
342
342
  type: :development
343
343
  prerelease: false
344
344
  version_requirements: !ruby/object:Gem::Requirement
345
345
  requirements:
346
346
  - - "~>"
347
347
  - !ruby/object:Gem::Version
348
- version: '3.3'
348
+ version: '3.5'
349
349
  - !ruby/object:Gem::Dependency
350
350
  name: webrick
351
351
  requirement: !ruby/object:Gem::Requirement