Module: Notifications

Defined in:
lib/notifications/client/version.rb,
lib/notifications/client.rb,
lib/notifications/client/speaker.rb,
lib/notifications/client/notification.rb,
lib/notifications/client/received_text.rb,
lib/notifications/client/request_error.rb,
lib/notifications/client/helper_methods.rb,
lib/notifications/client/uuid_validator.rb,
lib/notifications/client/template_preview.rb,
lib/notifications/client/response_template.rb,
lib/notifications/client/template_collection.rb,
lib/notifications/client/response_notification.rb,
lib/notifications/client/notifications_collection.rb,
lib/notifications/client/received_text_collection.rb,
lib/notifications/client/response_precompiled_letter.rb

Overview

Version numbering follows Semantic Versionning:

Given a version number MAJOR.MINOR.PATCH, increment the:

  • MAJOR version when you make incompatible API changes,

  • MINOR version when you add functionality in a backwards-compatible manner, and

  • PATCH version when you make backwards-compatible bug fixes.

semver.org/

Defined Under Namespace

Classes: Client, UuidValidator

Class Method Summary collapse

Class Method Details

.prepare_upload(file, filename: nil, confirm_email_before_download: nil, retention_period: nil) ⇒ Object

Raises:

  • (ArgumentError)


4
5
6
7
8
9
10
11
12
13
14
# File 'lib/notifications/client/helper_methods.rb', line 4

def self.prepare_upload(file, filename: nil, confirm_email_before_download: nil, retention_period: nil)
  raise ArgumentError.new("File is larger than 2MB") if file.size > Client::MAX_FILE_UPLOAD_SIZE

  data = { file: Base64.strict_encode64(file.read) }

  data[:filename] = filename
  data[:confirm_email_before_download] = confirm_email_before_download
  data[:retention_period] = retention_period

  data
end