gds-api-adapters 50.0.0 → 50.1.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: 46a41a00cacd79a4c408b3c597b139d651257bdd
4
- data.tar.gz: f3b857e23608ba7bce531856288d01d808438e27
3
+ metadata.gz: 98ec915f6369ff655de325f9034f06daf1d2570e
4
+ data.tar.gz: 24ca88c29d87f9f9652e796c78cbd77fc86169f5
5
5
  SHA512:
6
- metadata.gz: 1fb13e953ff52783dd4cde9e95db5b8fae4a649fd0d5f7649628605d7744d15665642ff9ab4d1b48acdf5cac7b8ecbaa02bf6ecaee68e90ae56204429dfe3c6f
7
- data.tar.gz: '048ce4c05a7677cc8011f99be2bdc4b244b446ed3494c28b49c530691f3909ea812057d51591f0f48ac9f417b82bdf1d786b360f8a3e8a9779805262d810f27d'
6
+ metadata.gz: 2ea06116f28db8c79be9c77be92fbacaf5b8272974a0edace5f13c99acef21308991f7495f94ff6f2569656c1fb831e72dd6afce49843a11cf4af7a5194ad393
7
+ data.tar.gz: b6e238e353b4c4b29a14fafbccdbc27a6991ff290dd148eea73582ee65b31f070a1a780757ed600ab97667dab7228b9b6b147c334eb4e0deb0182915a3c3e325
data/Rakefile CHANGED
@@ -40,4 +40,3 @@ desc "Run the linter against changed files"
40
40
  task :lint do
41
41
  sh "bundle exec govuk-lint-ruby --diff --cached --format clang"
42
42
  end
43
-
@@ -88,6 +88,15 @@ class GdsApi::EmailAlertApi < GdsApi::Base
88
88
  get_json("#{endpoint}/topic-matches.json?#{query_string}")
89
89
  end
90
90
 
91
+ # Unsubscribe
92
+ # #
93
+ # @param uuid Subscription uuid
94
+ #
95
+ # @return [Hash] deleted
96
+ def unsubscribe(uuid)
97
+ post_json("#{endpoint}/unsubscribe/#{uuid}")
98
+ end
99
+
91
100
  private
92
101
 
93
102
  def nested_query_string(params)
@@ -93,6 +93,22 @@ module GdsApi
93
93
  )
94
94
  end
95
95
 
96
+ def email_alert_api_unsubscribes_a_subscription(uuid)
97
+ stub_request(:post, unsubscribe_url(uuid))
98
+ .with(body: "{}")
99
+ .to_return(status: 204)
100
+ end
101
+
102
+ def email_alert_api_has_no_subscription_for_uuid(uuid)
103
+ stub_request(:post, unsubscribe_url(uuid))
104
+ .with(body: "{}")
105
+ .to_return(status: 404)
106
+ end
107
+
108
+ def assert_unsubscribed(uuid)
109
+ assert_requested(:post, unsubscribe_url(uuid), times: 1)
110
+ end
111
+
96
112
  private
97
113
 
98
114
  def subscriber_lists_url(attributes = nil)
@@ -122,6 +138,10 @@ module GdsApi
122
138
  def notifications_url
123
139
  EMAIL_ALERT_API_ENDPOINT + "/notifications"
124
140
  end
141
+
142
+ def unsubscribe_url(uuid)
143
+ EMAIL_ALERT_API_ENDPOINT + "/unsubscribe/#{uuid}"
144
+ end
125
145
  end
126
146
  end
127
147
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '50.0.0'.freeze
2
+ VERSION = '50.1.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: 50.0.0
4
+ version: 50.1.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-11-27 00:00:00.000000000 Z
11
+ date: 2017-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek