vonage 7.30.2 → 7.32.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 +4 -4
- data/lib/vonage/client.rb +3 -3
- data/lib/vonage/keys.rb +4 -1
- data/lib/vonage/messaging/channels/mms.rb +11 -3
- data/lib/vonage/messaging/channels/rcs.rb +2 -2
- data/lib/vonage/number_insight.rb +1 -0
- data/lib/vonage/number_insight_2.rb +2 -17
- data/lib/vonage/sms.rb +3 -0
- data/lib/vonage/version.rb +1 -1
- data/lib/vonage/video/archives.rb +11 -1
- data/lib/vonage/video/connections/list_response.rb +11 -0
- data/lib/vonage/video/connections.rb +29 -0
- data/lib/vonage/video/web_socket.rb +1 -0
- data/lib/vonage/video.rb +6 -0
- data/lib/vonage/voice/actions/connect.rb +8 -4
- data/lib/vonage/voice/actions/stream.rb +1 -41
- data/lib/vonage/voice/actions/talk.rb +1 -41
- data/lib/vonage/voice/actions/transfer.rb +83 -0
- data/lib/vonage/voice/actions/wait.rb +43 -0
- data/lib/vonage/voice/ncco.rb +3 -1
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 767237040504d75ff4f4e7966e2de52d44eb7b1be47470bb238cde32702892f7
|
|
4
|
+
data.tar.gz: 197f6d40f803f60acc37ea8a58dd96fae47666d86eb2b1c7eb1d17f9602b24bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 07a15f1ae2b57f93ecd509a7d162594cd2e134ee79783ae21855d13c93f85886a3c78b797854c71640e10003275e669101e1cbc0c20e9cc39f031df7c01365b7
|
|
7
|
+
data.tar.gz: 8152d4eedc3109a26556fb8249fc192737624532b3b7906305b82587abd9be229dc23b797f05b4cf035cb2283a0f009f10db7227943fd58c62ac72c6d0ed71b9
|
data/lib/vonage/client.rb
CHANGED
|
@@ -71,7 +71,7 @@ module Vonage
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
# @return [Meetings]
|
|
74
|
-
#
|
|
74
|
+
# @deprecated
|
|
75
75
|
sig { returns(T.nilable(Vonage::Meetings)) }
|
|
76
76
|
def meetings
|
|
77
77
|
@meetings ||= T.let(Meetings.new(config), T.nilable(Vonage::Meetings))
|
|
@@ -113,7 +113,7 @@ module Vonage
|
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
# @return [NumberInsight2]
|
|
116
|
-
#
|
|
116
|
+
# @deprecated
|
|
117
117
|
sig { returns(T.nilable(Vonage::NumberInsight2)) }
|
|
118
118
|
def number_insight_2
|
|
119
119
|
@number_insight_2 ||= T.let(NumberInsight2.new(config), T.nilable(Vonage::NumberInsight2))
|
|
@@ -134,7 +134,7 @@ module Vonage
|
|
|
134
134
|
end
|
|
135
135
|
|
|
136
136
|
# @return [ProactiveConnect]
|
|
137
|
-
#
|
|
137
|
+
# @deprecated
|
|
138
138
|
sig { returns(T.nilable(Vonage::ProactiveConnect)) }
|
|
139
139
|
def proactive_connect
|
|
140
140
|
@proactive_connect ||= T.let(ProactiveConnect.new(config), T.nilable(Vonage::ProactiveConnect))
|
data/lib/vonage/keys.rb
CHANGED
|
@@ -40,7 +40,10 @@ module Vonage
|
|
|
40
40
|
'phone_number',
|
|
41
41
|
'hashed_phone_number',
|
|
42
42
|
'max_age',
|
|
43
|
-
'max_bitrate'
|
|
43
|
+
'max_bitrate',
|
|
44
|
+
'quantization_parameter',
|
|
45
|
+
'has_transcription',
|
|
46
|
+
'transcription_properties'
|
|
44
47
|
]
|
|
45
48
|
hash.transform_keys do |k|
|
|
46
49
|
if exceptions.include?(k.to_s)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Vonage
|
|
4
4
|
class Messaging::Channels::MMS < Messaging::Message
|
|
5
|
-
MESSAGE_TYPES = ['image', 'vcard', 'audio', 'video']
|
|
5
|
+
MESSAGE_TYPES = ['text', 'image', 'vcard', 'audio', 'video', 'file', 'content'].freeze
|
|
6
6
|
|
|
7
7
|
attr_reader :data
|
|
8
8
|
|
|
@@ -29,8 +29,16 @@ module Vonage
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def verify_message
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
case type
|
|
33
|
+
when 'text'
|
|
34
|
+
raise Vonage::ClientError.new("Invalid parameter type. `:message` must be a String") unless message.is_a? String
|
|
35
|
+
when 'content'
|
|
36
|
+
raise Vonage::ClientError.new("Invalid parameter type. `:message` must be an Array") unless message.is_a? Array
|
|
37
|
+
raise Vonage::ClientError.new("Invalid parameter content. `:message` must not be empty") if message.empty?
|
|
38
|
+
else
|
|
39
|
+
raise Vonage::ClientError.new("Invalid parameter type. `:message` must be a Hash") unless message.is_a? Hash
|
|
40
|
+
raise Vonage::ClientError.new("Missing parameter. `:message` must contain a `:url` key") unless message[:url]
|
|
41
|
+
end
|
|
34
42
|
end
|
|
35
43
|
end
|
|
36
44
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Vonage
|
|
4
4
|
class Messaging::Channels::RCS < Messaging::Message
|
|
5
|
-
MESSAGE_TYPES = ['text', 'image', 'video', 'file', 'custom']
|
|
5
|
+
MESSAGE_TYPES = ['text', 'image', 'video', 'file', 'card', 'carousel', 'custom']
|
|
6
6
|
|
|
7
7
|
attr_reader :data
|
|
8
8
|
|
|
@@ -32,7 +32,7 @@ module Vonage
|
|
|
32
32
|
case type
|
|
33
33
|
when 'text'
|
|
34
34
|
raise Vonage::ClientError.new("Invalid parameter type. `:message` must be a String") unless message.is_a? String
|
|
35
|
-
when 'custom'
|
|
35
|
+
when 'card', 'carousel', 'custom'
|
|
36
36
|
raise Vonage::ClientError.new("Invalid parameter type. `:message` must be a Hash") unless message.is_a? Hash
|
|
37
37
|
raise Vonage::ClientError.new("Invalid parameter content. `:message` must not be empty") if message.empty?
|
|
38
38
|
else
|
|
@@ -9,25 +9,10 @@ module Vonage
|
|
|
9
9
|
|
|
10
10
|
self.request_body = JSON
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
#
|
|
14
|
-
# @example
|
|
15
|
-
# response = client.number_insight_2.fraud_check(type: 'phone', phone: '447900000000', insights: ['fraud_score'])
|
|
16
|
-
#
|
|
17
|
-
# @param [required, String] :type The type of number to check.
|
|
18
|
-
# Accepted value is “phone” when a phone number is provided.
|
|
19
|
-
#
|
|
20
|
-
# @param [required, String] :phone A single phone number that you need insight about in the E.164 format.
|
|
21
|
-
#
|
|
22
|
-
# @param [required, Array] :insights An array of strings indicating the fraud check insights required for the number.
|
|
23
|
-
# Must be least one of: `fraud_score`, `sim_swap`
|
|
24
|
-
#
|
|
25
|
-
# @return [Response]
|
|
26
|
-
#
|
|
27
|
-
# @see https://developer.vonage.com/en/api/number-insight.v2#fraud_check
|
|
28
|
-
#
|
|
12
|
+
# @deprecated
|
|
29
13
|
sig { params(type: String, phone: String, insights: T::Array[String]).returns(Vonage::Response) }
|
|
30
14
|
def fraud_check(type:, phone:, insights:)
|
|
15
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
|
31
16
|
raise ArgumentError.new("`insights` must not be an empty") if insights.empty?
|
|
32
17
|
|
|
33
18
|
request('/v2/ni', params: {type: type, phone: phone, insights: insights}, type: Post)
|
data/lib/vonage/sms.rb
CHANGED
|
@@ -66,6 +66,9 @@ module Vonage
|
|
|
66
66
|
# An optional string used to identify separate accounts using the SMS endpoint for billing purposes.
|
|
67
67
|
# To use this feature, please email [support@nexmo.com](mailto:support@nexmo.com).
|
|
68
68
|
#
|
|
69
|
+
# @option params [String] :trusted_number
|
|
70
|
+
# Setting this parameter to true overrides, on a per-message basis, any protections set up via Fraud Defender (Traffic Rules, SMS Burst Protection, AIT Protection).
|
|
71
|
+
#
|
|
69
72
|
# @param [Hash] params
|
|
70
73
|
#
|
|
71
74
|
# @return [Response]
|
data/lib/vonage/version.rb
CHANGED
|
@@ -59,7 +59,9 @@ module Vonage
|
|
|
59
59
|
#
|
|
60
60
|
# @param [optional, String] :multi_archive_tag
|
|
61
61
|
#
|
|
62
|
-
# @param [optional,
|
|
62
|
+
# @param [optional, Number] :max_bitrate
|
|
63
|
+
#
|
|
64
|
+
# @param [optional, Number] :quantization_parameter
|
|
63
65
|
#
|
|
64
66
|
# @param [optional, Hash] :layout
|
|
65
67
|
#
|
|
@@ -69,6 +71,14 @@ module Vonage
|
|
|
69
71
|
#
|
|
70
72
|
# @option layout [optional, String] :screenshareType
|
|
71
73
|
#
|
|
74
|
+
# @param [optional, Boolean] :has_transcription
|
|
75
|
+
#
|
|
76
|
+
# @param [optional, Hash] :transcription_properties
|
|
77
|
+
#
|
|
78
|
+
# @option transcription_properties [optional, String] :primaryLanguageCode
|
|
79
|
+
#
|
|
80
|
+
# @option transcription_properties [optional, Boolean] :hasSummary
|
|
81
|
+
#
|
|
72
82
|
# @return [Response]
|
|
73
83
|
#
|
|
74
84
|
# @see TODO: add docs link
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Vonage
|
|
5
|
+
class Video::Connections < Namespace
|
|
6
|
+
|
|
7
|
+
self.authentication = BearerToken
|
|
8
|
+
|
|
9
|
+
self.request_body = JSON
|
|
10
|
+
|
|
11
|
+
self.host = :video_host
|
|
12
|
+
|
|
13
|
+
# Get a list of connections for a specified session.
|
|
14
|
+
#
|
|
15
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
|
16
|
+
#
|
|
17
|
+
# @param [required, String] :session_id
|
|
18
|
+
#
|
|
19
|
+
# TODO: add auto_advance option
|
|
20
|
+
#
|
|
21
|
+
# @return [ListResponse]
|
|
22
|
+
#
|
|
23
|
+
# @see TODO: add docs link
|
|
24
|
+
#
|
|
25
|
+
def list(session_id:)
|
|
26
|
+
request('/v2/project/' + @config.application_id + '/session/' + session_id + '/connection', response_class: ListResponse)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -38,6 +38,7 @@ module Vonage
|
|
|
38
38
|
# @option websocket [optional, Hash] :headers An object of key-value pairs of headers to be sent to your WebSocket server with each message, with a maximum length of 512 bytes.
|
|
39
39
|
# @option websocket [optional, Integer] :audio_rate A number representing the audio sampling rate in Hz
|
|
40
40
|
# - Must be one of: 8000, 16000
|
|
41
|
+
# @option websocket [optional, Boolean] :bidirectional Whether to send audio data from the WebSocket connection to a stream published in the session.
|
|
41
42
|
#
|
|
42
43
|
# @return [Response]
|
|
43
44
|
#
|
data/lib/vonage/video.rb
CHANGED
|
@@ -65,9 +65,11 @@ module Vonage
|
|
|
65
65
|
raise ClientError.new("'user' must be defined") unless endpoint[:user]
|
|
66
66
|
when 'websocket'
|
|
67
67
|
raise ClientError.new("Expected 'uri' value to be a valid URI") unless URI.parse(endpoint[:uri]).kind_of?(URI::Generic)
|
|
68
|
-
raise ClientError.new("Expected 'content-type' parameter to be either 'audio/
|
|
68
|
+
raise ClientError.new("Expected 'content-type' parameter to be either 'audio/l16;rate=16000', 'audio/l16;rate=8000', or 'audio/l16;rate=24000'") unless ['audio/l16;rate=16000', 'audio/l16;rate=8000', 'audio/l16;rate=24000'].include?(endpoint[:'content-type'])
|
|
69
69
|
when 'sip'
|
|
70
|
-
raise ClientError.new("Expected 'uri' value to be a valid URI") unless URI.parse(endpoint[:uri]).kind_of?(URI::Generic)
|
|
70
|
+
raise ClientError.new("Expected 'uri' value to be a valid URI") unless URI.parse(endpoint[:uri]).kind_of?(URI::Generic) if endpoint[:uri]
|
|
71
|
+
raise ClientError.new("`uri` must not be combined with `user` and `domain`") if endpoint[:uri] && (endpoint[:user] || endpoint[:domain])
|
|
72
|
+
raise ClientError.new("You must provide both `user` and `domain`") if (endpoint[:user] && !endpoint[:domain]) || (endpoint[:domain] && !endpoint[:user])
|
|
71
73
|
end
|
|
72
74
|
end
|
|
73
75
|
|
|
@@ -208,10 +210,12 @@ module Vonage
|
|
|
208
210
|
|
|
209
211
|
def sip_endpoint(endpoint_attrs)
|
|
210
212
|
hash = {
|
|
211
|
-
type: 'sip'
|
|
212
|
-
uri: endpoint_attrs[:uri]
|
|
213
|
+
type: 'sip'
|
|
213
214
|
}
|
|
214
215
|
|
|
216
|
+
hash.merge!(uri: endpoint_attrs[:uri]) if endpoint_attrs[:uri]
|
|
217
|
+
hash.merge!(user: endpoint_attrs[:user]) if endpoint_attrs[:user]
|
|
218
|
+
hash.merge!(domain: endpoint_attrs[:domain]) if endpoint_attrs[:domain]
|
|
215
219
|
hash.merge!(headers: endpoint_attrs[:headers]) if endpoint_attrs[:headers]
|
|
216
220
|
hash.merge!(standardHeaders: endpoint_attrs[:standardHeaders]) if endpoint_attrs[:standardHeaders]
|
|
217
221
|
|
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
module Vonage
|
|
5
5
|
class Voice::Actions::Stream
|
|
6
|
-
attr_accessor :streamUrl, :level, :bargeIn, :loop
|
|
6
|
+
attr_accessor :streamUrl, :level, :bargeIn, :loop
|
|
7
7
|
|
|
8
8
|
def initialize(attributes = {})
|
|
9
9
|
@streamUrl = attributes.fetch(:streamUrl)
|
|
10
10
|
@level = attributes.fetch(:level, nil)
|
|
11
11
|
@bargeIn = attributes.fetch(:bargeIn, nil)
|
|
12
12
|
@loop = attributes.fetch(:loop, nil)
|
|
13
|
-
@eventOnCompletion = attributes.fetch(:eventOnCompletion, nil)
|
|
14
|
-
@eventUrl = attributes.fetch(:eventUrl, nil)
|
|
15
|
-
@eventMethod = attributes.fetch(:eventMethod, nil)
|
|
16
13
|
|
|
17
14
|
after_initialize!
|
|
18
15
|
end
|
|
@@ -31,18 +28,6 @@ module Vonage
|
|
|
31
28
|
if self.loop
|
|
32
29
|
verify_loop
|
|
33
30
|
end
|
|
34
|
-
|
|
35
|
-
if self.eventOnCompletion || self.eventOnCompletion == false
|
|
36
|
-
verify_event_on_completion
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
if self.eventUrl
|
|
40
|
-
verify_event_url
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
if self.eventMethod
|
|
44
|
-
verify_event_method
|
|
45
|
-
end
|
|
46
31
|
end
|
|
47
32
|
|
|
48
33
|
def verify_stream_url
|
|
@@ -69,28 +54,6 @@ module Vonage
|
|
|
69
54
|
raise ClientError.new("Expected 'loop' value to be either 0 or a positive integer") unless self.loop >= 0
|
|
70
55
|
end
|
|
71
56
|
|
|
72
|
-
def verify_event_on_completion
|
|
73
|
-
raise ClientError.new("Expected 'eventOnCompletion' value to be a Boolean") unless self.eventOnCompletion == true || self.eventOnCompletion == false
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def verify_event_url
|
|
77
|
-
unless self.eventUrl.is_a?(Array) && self.eventUrl.length == 1 && self.eventUrl[0].is_a?(String)
|
|
78
|
-
raise ClientError.new("Expected 'eventUrl' parameter to be an Array containing a single string item")
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
uri = URI.parse(self.eventUrl[0])
|
|
82
|
-
|
|
83
|
-
raise ClientError.new("Invalid 'eventUrl' value, array must contain a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
|
|
84
|
-
|
|
85
|
-
self.eventUrl
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def verify_event_method
|
|
89
|
-
valid_methods = ['GET', 'POST']
|
|
90
|
-
|
|
91
|
-
raise ClientError.new("Invalid 'eventMethod' value. must be either: 'GET' or 'POST'") unless valid_methods.include?(self.eventMethod.upcase)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
57
|
def action
|
|
95
58
|
create_stream!(self)
|
|
96
59
|
end
|
|
@@ -106,9 +69,6 @@ module Vonage
|
|
|
106
69
|
ncco[0].merge!(level: builder.level) if builder.level
|
|
107
70
|
ncco[0].merge!(bargeIn: builder.bargeIn) if (builder.bargeIn || builder.bargeIn == false)
|
|
108
71
|
ncco[0].merge!(loop: builder.loop) if builder.loop
|
|
109
|
-
ncco[0].merge!(eventOnCompletion: builder.eventOnCompletion) if (builder.eventOnCompletion || builder.eventOnCompletion == false)
|
|
110
|
-
ncco[0].merge!(eventUrl: builder.eventUrl) if builder.eventUrl
|
|
111
|
-
ncco[0].merge!(eventMethod: builder.eventMethod) if builder.eventMethod
|
|
112
72
|
|
|
113
73
|
ncco
|
|
114
74
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
module Vonage
|
|
4
4
|
class Voice::Actions::Talk
|
|
5
|
-
attr_accessor :text, :bargeIn, :loop, :level, :language, :style, :premium
|
|
5
|
+
attr_accessor :text, :bargeIn, :loop, :level, :language, :style, :premium
|
|
6
6
|
|
|
7
7
|
def initialize(attributes= {})
|
|
8
8
|
@text = attributes.fetch(:text)
|
|
@@ -12,9 +12,6 @@ module Vonage
|
|
|
12
12
|
@language = attributes.fetch(:language, nil)
|
|
13
13
|
@style = attributes.fetch(:style, nil)
|
|
14
14
|
@premium = attributes.fetch(:premium, nil)
|
|
15
|
-
@eventOnCompletion = attributes.fetch(:eventOnCompletion, nil)
|
|
16
|
-
@eventUrl = attributes.fetch(:eventUrl, nil)
|
|
17
|
-
@eventMethod = attributes.fetch(:eventMethod, nil)
|
|
18
15
|
|
|
19
16
|
after_initialize!
|
|
20
17
|
end
|
|
@@ -39,18 +36,6 @@ module Vonage
|
|
|
39
36
|
if self.premium || self.premium == false
|
|
40
37
|
verify_premium
|
|
41
38
|
end
|
|
42
|
-
|
|
43
|
-
if self.eventOnCompletion || self.eventOnCompletion == false
|
|
44
|
-
verify_event_on_completion
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
if self.eventUrl
|
|
48
|
-
verify_event_url
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
if self.eventMethod
|
|
52
|
-
verify_event_method
|
|
53
|
-
end
|
|
54
39
|
end
|
|
55
40
|
|
|
56
41
|
def verify_barge_in
|
|
@@ -73,28 +58,6 @@ module Vonage
|
|
|
73
58
|
raise ClientError.new("Expected 'premium' value to be a Boolean") unless self.premium == true || self.premium == false
|
|
74
59
|
end
|
|
75
60
|
|
|
76
|
-
def verify_event_on_completion
|
|
77
|
-
raise ClientError.new("Expected 'eventOnCompletion' value to be a Boolean") unless self.eventOnCompletion == true || self.eventOnCompletion == false
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def verify_event_url
|
|
81
|
-
unless self.eventUrl.is_a?(Array) && self.eventUrl.length == 1 && self.eventUrl[0].is_a?(String)
|
|
82
|
-
raise ClientError.new("Expected 'eventUrl' parameter to be an Array containing a single string item")
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
uri = URI.parse(self.eventUrl[0])
|
|
86
|
-
|
|
87
|
-
raise ClientError.new("Invalid 'eventUrl' value, array must contain a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
|
|
88
|
-
|
|
89
|
-
self.eventUrl
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def verify_event_method
|
|
93
|
-
valid_methods = ['GET', 'POST']
|
|
94
|
-
|
|
95
|
-
raise ClientError.new("Invalid 'eventMethod' value. must be either: 'GET' or 'POST'") unless valid_methods.include?(self.eventMethod.upcase)
|
|
96
|
-
end
|
|
97
|
-
|
|
98
61
|
def action
|
|
99
62
|
create_talk!(self)
|
|
100
63
|
end
|
|
@@ -113,9 +76,6 @@ module Vonage
|
|
|
113
76
|
ncco[0].merge!(language: builder.language) if builder.language
|
|
114
77
|
ncco[0].merge!(style: builder.style) if builder.style
|
|
115
78
|
ncco[0].merge!(premium: builder.premium) if (builder.bargeIn || builder.bargeIn == false)
|
|
116
|
-
ncco[0].merge!(eventOnCompletion: builder.eventOnCompletion) if (builder.eventOnCompletion || builder.eventOnCompletion == false)
|
|
117
|
-
ncco[0].merge!(eventUrl: builder.eventUrl) if builder.eventUrl
|
|
118
|
-
ncco[0].merge!(eventMethod: builder.eventMethod) if builder.eventMethod
|
|
119
79
|
|
|
120
80
|
ncco
|
|
121
81
|
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# typed: true
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
|
|
5
|
+
module Vonage
|
|
6
|
+
class Voice::Actions::Transfer
|
|
7
|
+
attr_accessor :conversation_id, :can_hear, :can_speak, :mute
|
|
8
|
+
|
|
9
|
+
def initialize(attributes = {})
|
|
10
|
+
@conversation_id = attributes.fetch(:conversation_id)
|
|
11
|
+
@can_hear = attributes.fetch(:can_hear, nil)
|
|
12
|
+
@can_speak = attributes.fetch(:can_speak, nil)
|
|
13
|
+
@mute = attributes.fetch(:mute, nil)
|
|
14
|
+
|
|
15
|
+
after_initialize!
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def after_initialize!
|
|
19
|
+
validate_conversation_id
|
|
20
|
+
validate_can_hear if self.can_hear
|
|
21
|
+
validate_can_speak if self.can_speak
|
|
22
|
+
validate_mute if self.mute != nil
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def validate_conversation_id
|
|
26
|
+
conversation_id = self.conversation_id
|
|
27
|
+
|
|
28
|
+
raise ClientError.new("Expected 'conversation_id' parameter to be a string") unless conversation_id.is_a?(String)
|
|
29
|
+
|
|
30
|
+
self.conversation_id
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def validate_can_hear
|
|
34
|
+
can_hear = self.can_hear
|
|
35
|
+
unless can_hear.is_a?(Array) && can_hear.all? { |item| item.is_a?(String) }
|
|
36
|
+
raise ClientError.new("Expected 'can_hear' parameter to be an array of strings")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
self.can_hear
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def validate_can_speak
|
|
43
|
+
can_speak = self.can_speak
|
|
44
|
+
unless can_speak.is_a?(Array) && can_speak.all? { |item| item.is_a?(String) }
|
|
45
|
+
raise ClientError.new("Expected 'can_speak' parameter to be an array of strings")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
self.can_speak
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def validate_mute
|
|
52
|
+
mute = self.mute
|
|
53
|
+
unless [true, false].include?(mute)
|
|
54
|
+
raise ClientError.new("Expected 'mute' parameter to be a boolean")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
if self.mute && self.can_speak
|
|
58
|
+
raise ClientError.new("The 'mute' parameter is not supported if 'can_speak' is also set")
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
self.mute
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def action
|
|
65
|
+
create_transfer!(self)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def create_transfer!(builder)
|
|
69
|
+
ncco = [
|
|
70
|
+
{
|
|
71
|
+
action: 'transfer',
|
|
72
|
+
conversation_id: builder.conversation_id,
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
ncco[0].merge!(canHear: builder.can_hear) if builder.can_hear
|
|
77
|
+
ncco[0].merge!(canSpeak: builder.can_speak) if builder.can_speak
|
|
78
|
+
ncco[0].merge!(mute: builder.mute) if builder.mute != nil
|
|
79
|
+
|
|
80
|
+
ncco
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# typed: true
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
|
|
5
|
+
module Vonage
|
|
6
|
+
class Voice::Actions::Wait
|
|
7
|
+
attr_accessor :timeout
|
|
8
|
+
|
|
9
|
+
def initialize(attributes = {})
|
|
10
|
+
@timeout = attributes.fetch(:timeout, nil)
|
|
11
|
+
|
|
12
|
+
after_initialize!
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def after_initialize!
|
|
16
|
+
validate_timeout if self.timeout
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def validate_timeout
|
|
20
|
+
timeout = self.timeout
|
|
21
|
+
|
|
22
|
+
raise ClientError.new("Expected 'timeout' parameter to be a number") unless timeout.is_a?(Numeric)
|
|
23
|
+
|
|
24
|
+
self.timeout
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def action
|
|
28
|
+
create_wait!(self)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def create_wait!(builder)
|
|
32
|
+
ncco = [
|
|
33
|
+
{
|
|
34
|
+
action: 'wait'
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
ncco[0].merge!(timeout: builder.timeout) if builder.timeout
|
|
39
|
+
|
|
40
|
+
ncco
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
data/lib/vonage/voice/ncco.rb
CHANGED
|
@@ -10,7 +10,9 @@ module Vonage
|
|
|
10
10
|
notify: Vonage::Voice::Actions::Notify,
|
|
11
11
|
record: Vonage::Voice::Actions::Record,
|
|
12
12
|
stream: Vonage::Voice::Actions::Stream,
|
|
13
|
-
talk: Vonage::Voice::Actions::Talk
|
|
13
|
+
talk: Vonage::Voice::Actions::Talk,
|
|
14
|
+
wait: Vonage::Voice::Actions::Wait,
|
|
15
|
+
transfer: Vonage::Voice::Actions::Transfer
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
class << self
|
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.
|
|
4
|
+
version: 7.32.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vonage
|
|
@@ -250,6 +250,8 @@ files:
|
|
|
250
250
|
- lib/vonage/video/broadcasts.rb
|
|
251
251
|
- lib/vonage/video/broadcasts/list_response.rb
|
|
252
252
|
- lib/vonage/video/captions.rb
|
|
253
|
+
- lib/vonage/video/connections.rb
|
|
254
|
+
- lib/vonage/video/connections/list_response.rb
|
|
253
255
|
- lib/vonage/video/moderation.rb
|
|
254
256
|
- lib/vonage/video/renders.rb
|
|
255
257
|
- lib/vonage/video/renders/list_response.rb
|
|
@@ -266,6 +268,8 @@ files:
|
|
|
266
268
|
- lib/vonage/voice/actions/record.rb
|
|
267
269
|
- lib/vonage/voice/actions/stream.rb
|
|
268
270
|
- lib/vonage/voice/actions/talk.rb
|
|
271
|
+
- lib/vonage/voice/actions/transfer.rb
|
|
272
|
+
- lib/vonage/voice/actions/wait.rb
|
|
269
273
|
- lib/vonage/voice/dtmf.rb
|
|
270
274
|
- lib/vonage/voice/list_response.rb
|
|
271
275
|
- lib/vonage/voice/ncco.rb
|