gds-api-adapters 59.6.0 → 60.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/email_alert_api.rb +18 -4
- data/lib/gds_api/test_helpers/email_alert_api.rb +22 -25
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a761a4156a0af6763014d9994f5543a23c6c33ea6ff2745ba5bddb28eb1965c
|
4
|
+
data.tar.gz: 5a3946e67f7de853cc33d204050263b3127890baf511585579b23acdec5a8e0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfb3c6776af3f5a8da321b023b0019d44cba7a5a62d22411430c805fae76fc13ab015b5293fbe72f6e4a73f0b20905b4d06398d9fcd4a016ac8f4c87cc208131
|
7
|
+
data.tar.gz: eb4891111d7024a646b57ea991ec8f46445ca4859a16853492a0887ef6e1eb881723c98abf724831fd61777061363e5e0dba8c698c77cc5079218ab1396bc66f
|
@@ -52,11 +52,25 @@ class GdsApi::EmailAlertApi < GdsApi::Base
|
|
52
52
|
post_json("#{endpoint}/subscriber-lists", attributes)
|
53
53
|
end
|
54
54
|
|
55
|
-
# Post
|
55
|
+
# Post a content change
|
56
56
|
#
|
57
|
-
# @param
|
58
|
-
def
|
59
|
-
post_json("#{endpoint}/
|
57
|
+
# @param content_change [Hash] Valid content change attributes
|
58
|
+
def create_content_change(content_change, headers = {})
|
59
|
+
post_json("#{endpoint}/content-changes", content_change, headers)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Post a message
|
63
|
+
#
|
64
|
+
# @param message [Hash] Valid message attributes
|
65
|
+
def create_message(message, headers = {})
|
66
|
+
post_json("#{endpoint}/messages", message, headers)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Send email
|
70
|
+
#
|
71
|
+
# @param email_params [Hash] address, subject, body
|
72
|
+
def create_email(email_params)
|
73
|
+
post_json("#{endpoint}/emails", email_params)
|
60
74
|
end
|
61
75
|
|
62
76
|
# Unpublishing alert
|
@@ -148,8 +148,18 @@ module GdsApi
|
|
148
148
|
.to_return(status: 202, body: {}.to_json)
|
149
149
|
end
|
150
150
|
|
151
|
-
def
|
152
|
-
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/
|
151
|
+
def stub_email_alert_api_accepts_content_change
|
152
|
+
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/content-changes")
|
153
|
+
.to_return(status: 202, body: {}.to_json)
|
154
|
+
end
|
155
|
+
|
156
|
+
def stub_email_alert_api_accepts_message
|
157
|
+
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/messages")
|
158
|
+
.to_return(status: 202, body: {}.to_json)
|
159
|
+
end
|
160
|
+
|
161
|
+
def stub_email_alert_api_accepts_email
|
162
|
+
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/emails")
|
153
163
|
.to_return(status: 202, body: {}.to_json)
|
154
164
|
end
|
155
165
|
|
@@ -157,7 +167,7 @@ module GdsApi
|
|
157
167
|
stub_request(:any, %r{\A#{EMAIL_ALERT_API_ENDPOINT}})
|
158
168
|
end
|
159
169
|
|
160
|
-
def
|
170
|
+
def assert_email_alert_api_content_change_created(attributes = nil)
|
161
171
|
if attributes
|
162
172
|
matcher = ->(request) do
|
163
173
|
payload = JSON.parse(request.body)
|
@@ -165,28 +175,18 @@ module GdsApi
|
|
165
175
|
end
|
166
176
|
end
|
167
177
|
|
168
|
-
assert_requested(:post, "#{EMAIL_ALERT_API_ENDPOINT}/
|
178
|
+
assert_requested(:post, "#{EMAIL_ALERT_API_ENDPOINT}/content-changes", times: 1, &matcher)
|
169
179
|
end
|
170
180
|
|
171
|
-
def
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
status: 200,
|
179
|
-
body: notifications.to_json
|
180
|
-
)
|
181
|
-
end
|
182
|
-
|
183
|
-
def stub_email_alert_api_has_notification(notification)
|
184
|
-
url = "#{EMAIL_ALERT_API_ENDPOINT}/notifications/#{notification['web_service_bulletin']['to_param']}"
|
181
|
+
def assert_email_alert_api_message_created(attributes = nil)
|
182
|
+
if attributes
|
183
|
+
matcher = ->(request) do
|
184
|
+
payload = JSON.parse(request.body)
|
185
|
+
payload.select { |k, _| attributes.key?(k) } == attributes
|
186
|
+
end
|
187
|
+
end
|
185
188
|
|
186
|
-
|
187
|
-
status: 200,
|
188
|
-
body: notification.to_json
|
189
|
-
)
|
189
|
+
assert_requested(:post, "#{EMAIL_ALERT_API_ENDPOINT}/messages", times: 1, &matcher)
|
190
190
|
end
|
191
191
|
|
192
192
|
def stub_email_alert_api_unsubscribes_a_subscription(uuid)
|
@@ -283,9 +283,6 @@ module GdsApi
|
|
283
283
|
alias_method :email_alert_api_creates_subscriber_list, :stub_email_alert_api_creates_subscriber_list
|
284
284
|
alias_method :email_alert_api_refuses_to_create_subscriber_list, :stub_email_alert_api_refuses_to_create_subscriber_list
|
285
285
|
alias_method :email_alert_api_accepts_unpublishing_message, :stub_email_alert_api_accepts_unpublishing_message
|
286
|
-
alias_method :email_alert_api_accepts_alert, :stub_email_alert_api_accepts_alert
|
287
|
-
alias_method :email_alert_api_has_notifications, :stub_email_alert_api_has_notifications
|
288
|
-
alias_method :email_alert_api_has_notification, :stub_email_alert_api_has_notification
|
289
286
|
alias_method :email_alert_api_unsubscribes_a_subscription, :stub_email_alert_api_unsubscribes_a_subscription
|
290
287
|
alias_method :email_alert_api_has_no_subscription_for_uuid, :stub_email_alert_api_has_no_subscription_for_uuid
|
291
288
|
alias_method :email_alert_api_unsubscribes_a_subscriber, :stub_email_alert_api_unsubscribes_a_subscriber
|
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: 60.0.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-
|
11
|
+
date: 2019-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|