vonage 7.36.0 → 7.37.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: 335a760f3d2241f93f26a0a7bfc05a91e6913dfc66311e5f6f5d6c440cbcf63d
4
- data.tar.gz: 324d0c92e4d9c5b458842ebffd555f48f17a97674662fa63f0442989e057060e
3
+ metadata.gz: a07f30eea61e555c314f3dccb86f4e71c2bce196108331cd330d296096aab53a
4
+ data.tar.gz: 5809203571fc5ea2644d6adcf39ebcdf51d883e4dd1a957905ef87ab61bb88ad
5
5
  SHA512:
6
- metadata.gz: 5a8c1e57407a7cd8398073b1112ff6e12821832e8c1efe9a6ea02f73ec6b55e41f25533df7c0ea3d8c3503e17a06458083b227a18d2c7f69bbac134276fba303
7
- data.tar.gz: 991f20b172f058fc50c8e1e3140e8fcb0599ed6d7d1ddbf72938a993bf5960dbb728d1ee32a40ba6c789fef8fb037db328bc519eeebae6b75e38272fc109698b
6
+ metadata.gz: 12f441f5c3df05c1afe3cea7aeb2f35e5c3cdc3279c18dfa10f369df2bdb69952ee9cc1b437be05910ad84bd52aade71eb34131c258974d7fae38e75c20d7dd5
7
+ data.tar.gz: eb2bd822c7709056041083d938f538050e3bf3a1a45581ece8f04557423ff4c2e2a027526cbef76f035f51772f085bfdc6d4f9f7d5a420102835d297595934e9
@@ -0,0 +1,60 @@
1
+ # typed: true
2
+
3
+ module Vonage
4
+ class Messaging::Channels::Email < Messaging::Message
5
+ MESSAGE_TYPES = ['text', 'html', 'content'].freeze
6
+
7
+ attr_reader :data
8
+
9
+ def initialize(attributes = {})
10
+ @to = attributes.fetch(:to, nil)
11
+ @from = attributes.fetch(:from, nil)
12
+ @type = attributes.fetch(:type, nil)
13
+ @message = attributes.fetch(:message, nil)
14
+ @opts = attributes.fetch(:opts, {})
15
+ @data = {}
16
+
17
+ after_initialize!
18
+ end
19
+
20
+ private
21
+
22
+ def after_initialize!
23
+ verify_type
24
+ verify_message
25
+ verify_opts
26
+ build
27
+ end
28
+
29
+ def build
30
+ data[:channel] = 'email'
31
+ super
32
+ end
33
+
34
+ def verify_type
35
+ raise Vonage::ClientError.new("Invalid message type") unless MESSAGE_TYPES.include?(type)
36
+ end
37
+
38
+ def verify_message
39
+ case type
40
+ when 'text'
41
+ raise Vonage::ClientError.new("Invalid parameter type. `:message` must be a String") unless message.is_a? String
42
+ when 'html'
43
+ raise Vonage::ClientError.new("Invalid parameter type. `:message` must be a Hash") unless message.is_a? Hash
44
+ raise Vonage::ClientError.new("Missing parameter. `:message` must contain a `:body` key") unless message[:body]
45
+ when 'content'
46
+ raise Vonage::ClientError.new("Invalid parameter type. `:message` must be an Array") unless message.is_a? Array
47
+ raise Vonage::ClientError.new("Invalid parameter content. `:message` must not be empty") if message.empty?
48
+ raise Vonage::ClientError.new("Invalid array contents. Each element of `:message` must be a Hash") unless message.all? { |m| m.is_a? Hash }
49
+ else
50
+ raise Vonage::ClientError.new("Invalid message type")
51
+ end
52
+ end
53
+
54
+ def verify_opts
55
+ raise Vonage::ClientError.new("Missing required parameter. `:opts` is required") if opts.nil? || opts.empty?
56
+ raise Vonage::ClientError.new("Missing required parameter. `:email` is required in `:opts`") unless opts[:email]
57
+ raise Vonage::ClientError.new("Missing required parameter. `:subject` is required in `:email`") unless opts[:email][:subject]
58
+ end
59
+ end
60
+ end
@@ -8,7 +8,8 @@ module Vonage
8
8
  rcs: Vonage::Messaging::Channels::RCS,
9
9
  whatsapp: Vonage::Messaging::Channels::WhatsApp,
10
10
  messenger: Vonage::Messaging::Channels::Messenger,
11
- viber: Vonage::Messaging::Channels::Viber
11
+ viber: Vonage::Messaging::Channels::Viber,
12
+ email: Vonage::Messaging::Channels::Email
12
13
  }
13
14
 
14
15
  class << self
@@ -1,5 +1,5 @@
1
1
  # typed: strong
2
2
 
3
3
  module Vonage
4
- VERSION = '7.36.0'
4
+ VERSION = '7.37.0'
5
5
  end
data/lib/vonage/voice.rb CHANGED
@@ -66,6 +66,9 @@ module Vonage
66
66
  #
67
67
  # @option params [Integer] :ringing_timer
68
68
  # Set the number of seconds that elapse before Vonage hangs up after the call state changes to `ringing`.
69
+ #
70
+ # @option params [Boolean] :return_cps_on_started
71
+ # Set this to `true` to return CPS information when the call is started.
69
72
  #
70
73
  # @param [Hash] params
71
74
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vonage
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.36.0
4
+ version: 7.37.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vonage
@@ -185,6 +185,7 @@ files:
185
185
  - lib/vonage/meetings/themes/list_response.rb
186
186
  - lib/vonage/messages.rb
187
187
  - lib/vonage/messaging.rb
188
+ - lib/vonage/messaging/channels/email.rb
188
189
  - lib/vonage/messaging/channels/messenger.rb
189
190
  - lib/vonage/messaging/channels/mms.rb
190
191
  - lib/vonage/messaging/channels/rcs.rb