notifications-ruby-client 5.4.0 → 6.0.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
  SHA256:
3
- metadata.gz: 6827c0db7ff51cabb102005e382e49fb225344a2856b11f85dc4edc799b9d9a9
4
- data.tar.gz: 222318524a806a4ce707cdc3fff989b6d91f28fffa106fe9235584d14b1cd2f1
3
+ metadata.gz: 0b04d33af2550021b9eecec2c063c360f349715c33353be054d9e2f7e4463896
4
+ data.tar.gz: e4d0f5ece925c71a0ecfbc779bf27a94d29c8d7019b75b4b42955498ba58b2fe
5
5
  SHA512:
6
- metadata.gz: ef8a9234c0e8a4730d9ce2561d35261882903090bbaeaaad29540b36a1622c77ff0953d395ed0976093e962cae92cd304f2ace1579ce41d5b3e70553528ee1d5
7
- data.tar.gz: 44f09776241452471cacea7cec73bfa4ab158ed24f5a4a631bcdf747923cd18f66f34b0e8742dcc036dd2f4dd646dbc3a095e24736cac10452d4dc555105b4f9
6
+ metadata.gz: 9158493f4a551508d9b4267fde147f345e0c0c47e5f46319bd92394b7a072d3b2c2543c9df841c0433685a86dd04eb1fb17fb5d6d18eede029ce11e6c798a65e
7
+ data.tar.gz: be9ea47296e25def1236762ab0d3e00d6e72a2e0548b94aaa81cf2770e8d2ac976cfb5b6df8223a7f5db56e57de7f9375c84561b31e9b9af928f5554a97e5720
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 6.0.0
2
+
3
+ * Removes the `is_csv` parameter from `prepare_upload`
4
+ * Adds a `filename` parameter to `prepare_upload` to set the filename of the document upon download. See the documentation for more information.
5
+
1
6
  ## 5.4.0
2
7
 
3
8
  * Add support for new security features when sending a file by email:
data/DOCUMENTATION.md CHANGED
@@ -12,7 +12,7 @@ Run the following in the command line:
12
12
  gem install 'notifications-ruby-client'
13
13
  ```
14
14
 
15
- Refer to the [client changelog](https://github.com/alphagov/notifications-ruby-client/blob/master/CHANGELOG.md) for the version number and the latest updates.
15
+ Refer to the [client changelog](https://github.com/alphagov/notifications-ruby-client/blob/main/CHANGELOG.md) for the version number and the latest updates.
16
16
 
17
17
  ### Create a new instance of the client
18
18
 
@@ -185,7 +185,9 @@ If a template has placeholder fields for personalised information such as name o
185
185
  ```ruby
186
186
  personalisation: {
187
187
  name: "John Smith",
188
- year: "2016"
188
+ year: "2016",
189
+ # pass in an array and it will appear as bullet points in the message:
190
+ required_documents: ["passport", "utility bill", "other id"],
189
191
  }
190
192
  ```
191
193
 
@@ -227,15 +229,13 @@ To send a file by email, add a placeholder to the template then upload a file. T
227
229
 
228
230
  The links are unique and unguessable. GOV.UK Notify cannot access or decrypt your file.
229
231
 
230
- Your file will be available to download for a default period of 78 weeks (18 months). From 29 March 2023 we will reduce this to 26 weeks (6 months) for all new files. Files sent before 29 March will not be affected.
232
+ Your file will be available to download for a default period of 26 weeks (6 months).
231
233
 
232
234
  To help protect your files you can also:
233
235
 
234
236
  * ask recipients to confirm their email address before downloading
235
237
  * choose the length of time that a file is available to download
236
238
 
237
- To turn these features on or off, you will need version 5.4.0 of the Ruby client library or a more recent version.
238
-
239
239
  #### Add contact details to the file download page
240
240
 
241
241
  1. [Sign in to GOV.UK Notify](https://www.notifications.service.gov.uk/sign-in).
@@ -254,7 +254,7 @@ Your email should also tell recipients how long the file will be available to do
254
254
 
255
255
  #### Upload your file
256
256
 
257
- You can upload PDF, CSV, .odt, .txt, .rtf, .xlsx and MS Word Document files. Your file must be smaller than 2MB. [Contact the GOV.UK Notify team](https://www.notifications.service.gov.uk/support/ask-question-give-feedback) if you need to send other file types.
257
+ You can upload PDF, CSV, JSON, .odt, .txt, .rtf, .xlsx and MS Word Document files. Your file must be smaller than 2MB. [Contact the GOV.UK Notify team](https://www.notifications.service.gov.uk/support/ask-question-give-feedback) if you need to send other file types.
258
258
 
259
259
  1. Pass the file object as an argument to the `Notifications.prepare_upload` helper method.
260
260
  1. Pass the result into the personalisation argument.
@@ -272,51 +272,43 @@ File.open("file.pdf", "rb") do |f|
272
272
  end
273
273
  ```
274
274
 
275
- ##### CSV Files
276
-
277
- Uploads for CSV files should use the `is_csv` parameter on the `prepare_upload()` helper method. For example:
278
-
279
- ```ruby
280
- File.open("file.csv", "rb") do |f|
281
- ...
282
- personalisation: {
283
- first_name: "Amala",
284
- application_date: "2018-01-01",
285
- link_to_file: Notifications.prepare_upload(f, is_csv=true),
286
- }
287
- end
288
- ```
289
-
290
- #### Ask recipients to confirm their email address before they can download the file
275
+ #### Set the filename
291
276
 
292
- This new security feature is optional. You should use it if you send files that are sensitive - for example, because they contain personal information about your users.
277
+ To do this you will need version 6.0.0 of the Ruby client library, or a more recent version.
293
278
 
294
- When a recipient clicks the link in the email you’ve sent them, they have to enter their email address. Only someone who knows the recipient’s email address can download the file.
279
+ You should provide a filename when you upload your file.
295
280
 
296
- From 29 March 2023, we will turn this feature on by default for every file you send. Files sent before 29 March will not be affected.
281
+ The filename should tell the recipient what the file contains. A memorable filename can help the recipient to find the file again later.
297
282
 
298
- ##### Turn on email address check
283
+ The filename must end with a file extension. For example, `.csv` for a CSV file. If you include the wrong file extension, recipients may not be able to open your file.
299
284
 
300
- To use this feature before 29 March 2023 you will need version 5.4.0 of the Ruby client library, or a more recent version.
285
+ If you do not provide a filename for your file, Notify will:
301
286
 
302
- To make the recipient confirm their email address before downloading the file, set the `confirm_email_before_download` flag to `true`.
287
+ * generate a random filename
288
+ * try to add the correct file extension
303
289
 
304
- You will not need to do this after 29 March.
290
+ If Notify cannot add the correct file extension, recipients may not be able to open your file.
305
291
 
306
292
  ```ruby
307
- File.open("file.pdf", "rb") do |f|
293
+ File.open("file.csv", "rb") do |f|
308
294
  ...
309
295
  personalisation: {
310
296
  first_name: "Amala",
311
297
  application_date: "2018-01-01",
312
- link_to_file: Notifications.prepare_upload(f, confirm_email_before_download: true),
298
+ link_to_file: Notifications.prepare_upload(f, filename="2023-12-25-daily-report.csv"),
313
299
  }
314
300
  end
315
301
  ```
316
302
 
303
+ #### Ask recipients to confirm their email address before they can download the file
304
+
305
+ When a recipient clicks the link in the email you’ve sent them, they have to enter their email address. Only someone who knows the recipient’s email address can download the file.
306
+
307
+ This security feature is turned on by default.
308
+
317
309
  ##### Turn off email address check (not recommended)
318
310
 
319
- If you do not want to use this feature after 29 March 2023, you can turn it off on a file-by-file basis.
311
+ If you do not want to use this feature, you can turn it off on a file-by-file basis.
320
312
 
321
313
  To do this you will need version 5.4.0 of the Ruby client library, or a more recent version.
322
314
 
@@ -345,11 +337,16 @@ end
345
337
 
346
338
  Set the number of weeks you want the file to be available using the `retention_period` key.
347
339
 
348
- You can choose any value between 1 week and 78 weeks.
349
-
350
340
  To use this feature will need version 5.4.0 of the Ruby client library, or a more recent version.
351
341
 
352
- If you do not choose a value, the file will be available for the default period of 78 weeks (18 months).
342
+ You can choose any value between 1 week and 78 weeks. When deciding this, you should consider:
343
+
344
+ * the need to protect the recipient’s personal information
345
+ * whether the recipient will need to download the file again later
346
+
347
+ If you do not choose a value, the file will be available for the default period of 26 weeks (6 months).
348
+
349
+ Files sent before 12 April 2023 had a longer default period of 78 weeks (18 months).
353
350
 
354
351
  ```ruby
355
352
  File.open("file.pdf", "rb") do |f|
@@ -385,8 +382,8 @@ If the request is not successful, the client raises a `Notifications::Client::Re
385
382
  |`400`|`BadRequestError: Can't send to this recipient using a team-only API key`|`BadRequestError`|Use the correct type of [API key](#api-keys)|
386
383
  |`400`|`BadRequestError: Can't send to this recipient when service is in trial mode - see https://www.notifications.service.gov.uk/trial-mode`|`BadRequestError`|Your service cannot send this notification in [trial mode](https://www.notifications.service.gov.uk/features/using-notify#trial-mode)|
387
384
  |`400`|`BadRequestError: Unsupported file type '(FILE TYPE)'. Supported types are: '(ALLOWED TYPES)'`|`BadRequestError`|Wrong file type. You can only upload .pdf, .csv, .txt, .doc, .docx, .xlsx, .rtf or .odt files|
388
- |`400`|`BadRequestError: Unsupported value for retention_period '(PERIOD)'. Supported periods are from 1 to 78 weeks.`|Choose a period between 1 and 78 weeks|
389
- |`400`|`BadRequestError: Unsupported value for confirm_email_before_download: '(VALUE)'. Use a boolean true or false value.`|Use either true or false|
385
+ |`400`|`BadRequestError: Unsupported value for retention_period '(PERIOD)'. Supported periods are from 1 to 78 weeks.`|`BadRequestError`|Choose a period between 1 and 78 weeks|
386
+ |`400`|`BadRequestError: Unsupported value for confirm_email_before_download: '(VALUE)'. Use a boolean true or false value.`|`BadRequestError`|Use either true or false|
390
387
  |`400`|`BadRequestError: File did not pass the virus scan`|`BadRequestError`|The file contains a virus|
391
388
  |`400`|`BadRequestError: Send files by email has not been set up - add contact details for your service at https://www.notifications.service.gov.uk/services/(SERVICE ID)/service-settings/send-files-by-email`|`BadRequestError`|See how to [add contact details to the file download page](#add-contact-details-to-the-file-download-page)|
392
389
  |`400`|`BadRequestError: Can only send a file by email` | `BadRequestError`|Make sure you are using an email template|
@@ -465,7 +462,9 @@ personalisation: {
465
462
  address_line_2: '123 High Street', # mandatory address field
466
463
  address_line_3: 'SW14 6BH', # mandatory address field
467
464
  name: 'John Smith', # field from template
468
- application_date: '2018-01-01' # field from template
465
+ application_date: '2018-01-01' # field from template,
466
+ # pass in an array and it will appear as bullet points in the letter:
467
+ required_documents: ["passport", "utility bill", "other id"],
469
468
  },
470
469
  ```
471
470
 
@@ -760,7 +759,7 @@ If the request is not successful, the client raises a `Notifications::Client::Re
760
759
  |#`sending`|GOV.UK Notify has sent the message to the provider. The provider will try to deliver the message to the recipient for up to 72 hours. GOV.UK Notify is waiting for delivery information.|
761
760
  |#`pending`|GOV.UK Notify is waiting for more delivery information.<br>GOV.UK Notify received a callback from the provider but the recipient’s device has not yet responded. Another callback from the provider determines the final status of the text message.|
762
761
  |#`sent`|The message was sent to an international number. The mobile networks in some countries do not provide any more delivery information. The GOV.UK Notify website displays this status as 'Sent to an international number'.|
763
- |#`delivered`|The message was successfully delivered.|
762
+ |#`delivered`|The message was successfully delivered. If a recipient blocks your sender name or mobile number, your message will still show as delivered.|
764
763
  |#`permanent-failure`|The provider could not deliver the message. This can happen if the phone number was wrong or if the network operator rejects the message. If you’re sure that these phone numbers are correct, you should [contact GOV.UK Notify support](https://www.notifications.service.gov.uk/support). If not, you should remove them from your database. You’ll still be charged for text messages that cannot be delivered.
765
764
  |#`temporary-failure`|The provider could not deliver the message. This can happen when the recipient’s phone is off, has no signal, or their text message inbox is full. You can try to send the message again. You’ll still be charged for text messages to phones that are not accepting messages.|
766
765
  |#`technical-failure`|Your message was not sent because there was a problem between Notify and the provider.<br>You’ll have to try sending your messages again. You will not be charged for text messages that are affected by a technical failure.|
@@ -1059,7 +1058,10 @@ You can also set up [callbacks](#callbacks) for received text messages.
1059
1058
 
1060
1059
  ### Enable received text messages
1061
1060
 
1062
- Contact the GOV.UK Notify team using the [support page](https://www.notifications.service.gov.uk/support) or [chat to us on Slack](https://ukgovernmentdigital.slack.com/messages/C0E1ADVPC) to request a unique number for text message replies.
1061
+ To receive text messages:
1062
+
1063
+ 1. Go to the **Text message settings** section of the **Settings** page.
1064
+ 1. Select **Change** on the **Receive text messages** row.
1063
1065
 
1064
1066
  ### Get a page of received text messages
1065
1067
 
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)
@@ -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
 
@@ -9,6 +9,6 @@
9
9
 
10
10
  module Notifications
11
11
  class Client
12
- VERSION = "5.4.0".freeze
12
+ VERSION = "6.0.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.0.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-01-04 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