gds-api-adapters 48.0.0 → 49.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 +4 -4
- data/lib/gds_api/publishing_api_v2.rb +26 -0
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -4
- data/lib/gds_api/gov_uk_delivery.rb +0 -60
- data/lib/gds_api/test_helpers/gov_uk_delivery.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e09f9d81831debf492170147be21e3d333acc08b
|
4
|
+
data.tar.gz: 11206083568b5f3d2e904b627dc788e802eb7051
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b41cff30982859838e53379f2df71a8cc1e55dd1b7711fe345d36aac6a1719c70b6c7eead2c3528723f0c5542c13002d4461e3a5633b985512007e9a576f45f4
|
7
|
+
data.tar.gz: 3e826516cdb3cb3f2ae440b9e11343edd13f3126bba49f299d41c3f0522a49a44b9b409653336dfa4385530246fe73c35991ce49221b6a294ecb3d9584b7e4f6
|
@@ -205,6 +205,27 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
205
205
|
get_json(links_url(content_id))
|
206
206
|
end
|
207
207
|
|
208
|
+
# Returns an array of changes to links.
|
209
|
+
#
|
210
|
+
# The link changes can be filtered by link_type, source content_id,
|
211
|
+
# target content_id and user. A maximum of 250 changes will be
|
212
|
+
# returned.
|
213
|
+
#
|
214
|
+
# @param link_types [Array] Array of link_types to filter by.
|
215
|
+
# @param source_content_ids [Array] Array of source content ids to filter by.
|
216
|
+
# @param target_content_ids [Array] Array of target content ids to filter by.
|
217
|
+
# @param users [Array] User UIDs to filter by.
|
218
|
+
# @example
|
219
|
+
#
|
220
|
+
# publishing_api.get_links_changes(
|
221
|
+
# link_types: ['taxons'],
|
222
|
+
# target_content_ids: ['a544d48b-1e9e-47fb-b427-7a987c658c14']
|
223
|
+
# )
|
224
|
+
#
|
225
|
+
def get_links_changes(params)
|
226
|
+
get_json(links_changes_url(params))
|
227
|
+
end
|
228
|
+
|
208
229
|
# Get expanded links
|
209
230
|
#
|
210
231
|
# Return the expanded links of the item.
|
@@ -386,6 +407,11 @@ private
|
|
386
407
|
"#{endpoint}/v2/links/#{content_id}"
|
387
408
|
end
|
388
409
|
|
410
|
+
def links_changes_url(params = {})
|
411
|
+
query = query_string(params)
|
412
|
+
"#{endpoint}/v2/links/changes/#{query}"
|
413
|
+
end
|
414
|
+
|
389
415
|
def publish_url(content_id)
|
390
416
|
validate_content_id(content_id)
|
391
417
|
"#{endpoint}/v2/content/#{content_id}/publish"
|
data/lib/gds_api/version.rb
CHANGED
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:
|
4
|
+
version: 49.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: 2017-09-
|
11
|
+
date: 2017-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|
@@ -362,7 +362,6 @@ files:
|
|
362
362
|
- lib/gds_api/content_store.rb
|
363
363
|
- lib/gds_api/email_alert_api.rb
|
364
364
|
- lib/gds_api/exceptions.rb
|
365
|
-
- lib/gds_api/gov_uk_delivery.rb
|
366
365
|
- lib/gds_api/govuk_headers.rb
|
367
366
|
- lib/gds_api/helpers.rb
|
368
367
|
- lib/gds_api/imminence.rb
|
@@ -394,7 +393,6 @@ files:
|
|
394
393
|
- lib/gds_api/test_helpers/content_item_helpers.rb
|
395
394
|
- lib/gds_api/test_helpers/content_store.rb
|
396
395
|
- lib/gds_api/test_helpers/email_alert_api.rb
|
397
|
-
- lib/gds_api/test_helpers/gov_uk_delivery.rb
|
398
396
|
- lib/gds_api/test_helpers/imminence.rb
|
399
397
|
- lib/gds_api/test_helpers/intent_helpers.rb
|
400
398
|
- lib/gds_api/test_helpers/json_client_helper.rb
|
@@ -1,60 +0,0 @@
|
|
1
|
-
require_relative 'base'
|
2
|
-
require_relative 'exceptions'
|
3
|
-
require 'json'
|
4
|
-
|
5
|
-
class GdsApi::GovUkDelivery < GdsApi::Base
|
6
|
-
def initialize(endpoint_url, options = {})
|
7
|
-
super(endpoint_url, options.merge(timeout: 10))
|
8
|
-
end
|
9
|
-
|
10
|
-
def subscribe(email, feed_urls)
|
11
|
-
data = { email: email, feed_urls: feed_urls }
|
12
|
-
url = "#{base_url}/subscriptions"
|
13
|
-
post_url(url, data)
|
14
|
-
end
|
15
|
-
|
16
|
-
def topic(feed_url, title, description = nil)
|
17
|
-
data = { feed_url: feed_url, title: title, description: description }
|
18
|
-
url = "#{base_url}/lists"
|
19
|
-
post_url(url, data)
|
20
|
-
end
|
21
|
-
|
22
|
-
def signup_url(feed_url)
|
23
|
-
response = get_json("#{base_url}/list-url?feed_url=#{CGI.escape(feed_url)}")
|
24
|
-
if response
|
25
|
-
response['list_url']
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def notify(feed_urls, subject, body, logging_params = {})
|
30
|
-
data = { feed_urls: feed_urls, subject: subject, body: body, logging_params: logging_params }
|
31
|
-
url = "#{base_url}/notifications"
|
32
|
-
post_url(url, data)
|
33
|
-
end
|
34
|
-
|
35
|
-
def enable_list(gov_delivery_id)
|
36
|
-
data = { gov_delivery_id: gov_delivery_id }
|
37
|
-
url = "#{base_url}/lists/enable"
|
38
|
-
post_url(url, data)
|
39
|
-
end
|
40
|
-
|
41
|
-
def disable_list(gov_delivery_id)
|
42
|
-
data = { gov_delivery_id: gov_delivery_id }
|
43
|
-
url = "#{base_url}/lists/disable"
|
44
|
-
post_url(url, data)
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
def base_url
|
50
|
-
endpoint
|
51
|
-
end
|
52
|
-
|
53
|
-
def post_url(url, data)
|
54
|
-
if ! @options[:noop]
|
55
|
-
post_json(url, data)
|
56
|
-
elsif @options[:noop] && @options[:stdout]
|
57
|
-
puts "Would POST #{data.to_json} to #{url}"
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
|
-
module GdsApi
|
4
|
-
module TestHelpers
|
5
|
-
module GovUkDelivery
|
6
|
-
GOVUK_DELIVERY_ENDPOINT = Plek.current.find('govuk-delivery')
|
7
|
-
|
8
|
-
def stub_gov_uk_delivery_post_request(method, params_hash)
|
9
|
-
stub_request(:post, "#{GOVUK_DELIVERY_ENDPOINT}/#{method}").with(body: params_hash.to_json)
|
10
|
-
end
|
11
|
-
|
12
|
-
def stub_gov_uk_delivery_get_request(method, params_hash)
|
13
|
-
stub_request(:get, "#{GOVUK_DELIVERY_ENDPOINT}/#{method}?#{URI.encode_www_form(params_hash)}")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|