notifications-ruby-client 5.4.0 → 6.2.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: 6827c0db7ff51cabb102005e382e49fb225344a2856b11f85dc4edc799b9d9a9
4
- data.tar.gz: 222318524a806a4ce707cdc3fff989b6d91f28fffa106fe9235584d14b1cd2f1
3
+ metadata.gz: 3bed01407fc2e19df7f65f9be76877f250bda03e9c7db644bfa86b7d83342f67
4
+ data.tar.gz: cf02533dcabab2d337aac521e338845d587417d25d238d5bc549feccc99b79e2
5
5
  SHA512:
6
- metadata.gz: ef8a9234c0e8a4730d9ce2561d35261882903090bbaeaaad29540b36a1622c77ff0953d395ed0976093e962cae92cd304f2ace1579ce41d5b3e70553528ee1d5
7
- data.tar.gz: 44f09776241452471cacea7cec73bfa4ab158ed24f5a4a631bcdf747923cd18f66f34b0e8742dcc036dd2f4dd646dbc3a095e24736cac10452d4dc555105b4f9
6
+ metadata.gz: a1f891ddcaf3120c3ab90f01b990178e879c0e785fe27734b017bdaa990a04fc430ed25e5d0b27ed3e6eed5b42a9022fa6dac34e3d7d2ecaae1f2112a6051838
7
+ data.tar.gz: ea20265635c620d5ee7873e6cce5dd8983db0a3489b4aecb9f09122a4c49d07a3a90f1a1eca1e29bb4bf5df0634e856c67c631c9fc0e416439ceb5976e769876
@@ -8,5 +8,7 @@
8
8
  <!--- All of the following are normally needed. Don’t worry if you haven’t done them or don’t know how – someone from the Notify team will be able to help. -->
9
9
  - [x] I’ve used the pull request template
10
10
  - [ ] I’ve written unit tests for these changes
11
- - [ ] I’ve updated the documentation (in `DOCUMENTATION.md`)
11
+ - [ ] I’ve updated the documentation in
12
+ - [ ] [notifications-tech-docs repository](https://github.com/alphagov/notifications-tech-docs/blob/main/source/documentation/client_docs/_ruby.md)
13
+ - [ ] `CHANGELOG.md`
12
14
  - [ ] I’ve bumped the version number (in `lib/notifications/client/version.rb`)
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## 6.2.0
2
+ * Added fields related to cost data in response:
3
+ * `is_cost_data_ready`: This field is true if cost data is ready, and false if it isn't (Boolean).
4
+ * `cost_in_pounds`: Cost of the notification in pounds. The cost does not take free allowance into account (Float).
5
+ * `cost_details.billable_sms_fragments`: Number of billable SMS fragments in your text message (SMS only) (Integer).
6
+ * `cost_details.international_rate_multiplier`: For international SMS rate is multiplied by this value (SMS only) (Integer).
7
+ * `cost_details.sms_rate`: Cost of 1 SMS fragment (SMS only) (Float).
8
+ * `cost_details.billable_sheets_of_paper`: Number of sheets of paper in the letter you sent, that you will be charged for (letter only) (Integer).
9
+ * `cost_details.postage`: Postage class of the notification sent (letter only) (String).
10
+
11
+ ## 6.1.0
12
+
13
+ * Adds a `one_click_unsubscribe_url` parameter to `send_email` so services can allow users to easily unsubscribe from distribution lists.
14
+ * Adds a `one_click_unsubscribe_url` attribute to `Notification` class, so responses for get_notification include the unsubscribe link.
15
+
16
+ ## 6.0.0
17
+
18
+ * Removes the `is_csv` parameter from `prepare_upload`
19
+ * Adds a `filename` parameter to `prepare_upload` to set the filename of the document upon download. See the documentation for more information.
20
+
1
21
  ## 5.4.0
2
22
 
3
23
  * Add support for new security features when sending a file by email:
data/README.md CHANGED
@@ -6,5 +6,5 @@ Useful links:
6
6
 
7
7
  - [Documentation](https://docs.notifications.service.gov.uk/ruby.html)
8
8
  - [Ruby gem](https://rubygems.org/gems/notifications-ruby-client)
9
- - [Changelog](https://github.com/alphagov/notifications-ruby-client/blob/master/CHANGELOG.md)
10
- - [Contributing to this client](https://github.com/alphagov/notifications-ruby-client/blob/master/CONTRIBUTING.md)
9
+ - [Changelog](https://github.com/alphagov/notifications-ruby-client/blob/main/CHANGELOG.md)
10
+ - [Contributing to this client](https://github.com/alphagov/notifications-ruby-client/blob/main/CONTRIBUTING.md)
data/bin/test_client.rb CHANGED
@@ -115,11 +115,14 @@ def test_template_preview(response)
115
115
  end
116
116
 
117
117
  def test_send_email_endpoint(client)
118
- email_resp = client.send_email(email_address: ENV['FUNCTIONAL_TEST_EMAIL'],
119
- template_id: ENV['EMAIL_TEMPLATE_ID'],
120
- personalisation: { "name" => "some name" },
121
- reference: "some reference",
122
- email_reply_to_id: ENV['EMAIL_REPLY_TO_ID'])
118
+ email_resp = client.send_email(
119
+ email_address: ENV['FUNCTIONAL_TEST_EMAIL'],
120
+ template_id: ENV['EMAIL_TEMPLATE_ID'],
121
+ personalisation: { "name" => "some name" },
122
+ reference: "some reference",
123
+ email_reply_to_id: ENV['EMAIL_REPLY_TO_ID'],
124
+ one_click_unsubscribe_url: "https://www.clovercouncil.gov.uk/unsubscribe?email_address=faye@example.com"
125
+ )
123
126
  test_notification_response_data_type(email_resp, 'email')
124
127
  email_resp
125
128
  end
@@ -130,7 +133,8 @@ def test_send_email_endpoint_with_document(client)
130
133
  template_id: ENV['EMAIL_TEMPLATE_ID'],
131
134
  personalisation: { name: Notifications.prepare_upload(f) },
132
135
  reference: "some reference",
133
- email_reply_to_id: ENV['EMAIL_REPLY_TO_ID'])
136
+ email_reply_to_id: ENV['EMAIL_REPLY_TO_ID'],
137
+ one_click_unsubscribe_url: "https://www.clovercouncil.gov.uk/unsubscribe?email_address=faye@example.com")
134
138
  end
135
139
 
136
140
  test_notification_response_data_type(email_resp, 'email')
@@ -319,7 +323,8 @@ end
319
323
  def expected_fields_in_email_content
320
324
  %w(from_email
321
325
  body
322
- subject)
326
+ subject
327
+ one_click_unsubscribe_url)
323
328
  end
324
329
 
325
330
  def expected_fields_in_sms_content
@@ -342,7 +347,8 @@ def expected_fields_in_email_notification
342
347
  template
343
348
  body
344
349
  subject
345
- created_at)
350
+ created_at
351
+ one_click_unsubscribe_url)
346
352
  end
347
353
 
348
354
  def expected_fields_in_email_notification_that_are_nil
@@ -381,7 +387,8 @@ def expected_fields_in_sms_notification_that_are_nil
381
387
  postcode
382
388
  subject
383
389
  created_by_name
384
- postage)
390
+ postage
391
+ one_click_unsubscribe_url)
385
392
  end
386
393
 
387
394
  def expected_fields_in_letter_notification
@@ -410,6 +417,7 @@ def expected_fields_in_letter_notification_that_are_nil
410
417
  line_5
411
418
  line_6
412
419
  created_by_name
420
+ one_click_unsubscribe_url
413
421
  )
414
422
  end
415
423
 
@@ -441,6 +449,7 @@ def expected_fields_in_precompiled_letter_notification_that_are_nil
441
449
  phone_number
442
450
  postcode
443
451
  sent_at
452
+ one_click_unsubscribe_url
444
453
  )
445
454
  end
446
455
 
@@ -1,11 +1,12 @@
1
1
  require "base64"
2
2
 
3
3
  module Notifications
4
- def self.prepare_upload(file, is_csv=false, confirm_email_before_download: nil, retention_period: nil)
4
+ def self.prepare_upload(file, filename: nil, confirm_email_before_download: nil, retention_period: nil)
5
5
  raise ArgumentError.new("File is larger than 2MB") if file.size > Client::MAX_FILE_UPLOAD_SIZE
6
6
 
7
- data = { file: Base64.strict_encode64(file.read), is_csv: is_csv }
7
+ data = { file: Base64.strict_encode64(file.read) }
8
8
 
9
+ data[:filename] = filename
9
10
  data[:confirm_email_before_download] = confirm_email_before_download
10
11
  data[:retention_period] = retention_period
11
12
 
@@ -25,6 +25,10 @@ module Notifications
25
25
  created_at
26
26
  completed_at
27
27
  created_by_name
28
+ one_click_unsubscribe_url
29
+ cost_in_pounds
30
+ is_cost_data_ready
31
+ cost_details
28
32
  ).freeze
29
33
 
30
34
  attr_reader(*FIELDS)
@@ -47,6 +47,8 @@ module Notifications
47
47
  # id of the email address that replies to email notifications will be sent to
48
48
  # @option form_data [String] :sms_sender_id
49
49
  # id of the sender to be used for an sms notification
50
+ # @option form_data [String] :one_click_unsubscribe_url
51
+ # link that end user can click to unsubscribe from the distribution list. We will pass this link in the email headers.
50
52
  # @see #perform_request!
51
53
  def post(kind, form_data)
52
54
  request = Net::HTTP::Post.new(
@@ -9,6 +9,6 @@
9
9
 
10
10
  module Notifications
11
11
  class Client
12
- VERSION = "5.4.0".freeze
12
+ VERSION = "6.2.0".freeze
13
13
  end
14
14
  end
@@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "rake", "~> 13.0"
27
27
  spec.add_development_dependency "rspec", "~> 3.7"
28
28
  spec.add_development_dependency "webmock", "~> 3.4"
29
- spec.add_development_dependency "factory_bot", "~> 6.1"
29
+ spec.add_development_dependency "factory_bot", "~> 6.1", "<6.4.5"
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notifications-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Government Digital Service
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-06 00:00:00.000000000 Z
11
+ date: 2024-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -93,6 +93,9 @@ dependencies:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
95
  version: '6.1'
96
+ - - "<"
97
+ - !ruby/object:Gem::Version
98
+ version: 6.4.5
96
99
  type: :development
97
100
  prerelease: false
98
101
  version_requirements: !ruby/object:Gem::Requirement
@@ -100,6 +103,9 @@ dependencies:
100
103
  - - "~>"
101
104
  - !ruby/object:Gem::Version
102
105
  version: '6.1'
106
+ - - "<"
107
+ - !ruby/object:Gem::Version
108
+ version: 6.4.5
103
109
  description:
104
110
  email:
105
111
  - notify@digital.cabinet-office.gov.uk
@@ -114,7 +120,6 @@ files:
114
120
  - ".rubocop.yml"
115
121
  - CHANGELOG.md
116
122
  - CONTRIBUTING.md
117
- - DOCUMENTATION.md
118
123
  - Dockerfile
119
124
  - Gemfile
120
125
  - LICENSE