vonage 7.35.0 → 8.0.0.beta
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/README.md +87 -880
- data/lib/vonage/account.rb +0 -2
- data/lib/vonage/applications.rb +4 -12
- data/lib/vonage/basic.rb +1 -1
- data/lib/vonage/bearer_token.rb +1 -1
- data/lib/vonage/client.rb +0 -72
- data/lib/vonage/client_error.rb +1 -1
- data/lib/vonage/config.rb +1 -7
- data/lib/vonage/conversations/events.rb +0 -12
- data/lib/vonage/conversations/legs.rb +0 -6
- data/lib/vonage/conversations/members.rb +0 -15
- data/lib/vonage/conversations/users.rb +0 -15
- data/lib/vonage/conversations.rb +0 -30
- data/lib/vonage/conversions.rb +0 -2
- data/lib/vonage/errors.rb +20 -37
- data/lib/vonage/gsm7.rb +1 -1
- data/lib/vonage/http.rb +3 -3
- data/lib/vonage/jwt.rb +0 -17
- data/lib/vonage/key_secret_params.rb +2 -3
- data/lib/vonage/keys.rb +1 -17
- data/lib/vonage/logger.rb +3 -0
- data/lib/vonage/messaging/channels/messenger.rb +0 -2
- data/lib/vonage/messaging/channels/mms.rb +3 -13
- data/lib/vonage/messaging/channels/sms.rb +0 -2
- data/lib/vonage/messaging/channels/viber.rb +2 -11
- data/lib/vonage/messaging/channels/whats_app.rb +1 -5
- data/lib/vonage/messaging/message.rb +1 -4
- data/lib/vonage/messaging.rb +4 -43
- data/lib/vonage/namespace.rb +68 -137
- data/lib/vonage/number_insight.rb +0 -1
- data/lib/vonage/numbers.rb +17 -40
- data/lib/vonage/server_error.rb +1 -1
- data/lib/vonage/signature.rb +6 -29
- data/lib/vonage/sms.rb +20 -25
- data/lib/vonage/verify.rb +0 -2
- data/lib/vonage/version.rb +1 -1
- data/lib/vonage/video/archives.rb +58 -35
- data/lib/vonage/video/list_response.rb +11 -0
- data/lib/vonage/video/moderation.rb +22 -7
- data/lib/vonage/video/signals.rb +9 -4
- data/lib/vonage/video/streams.rb +12 -6
- data/lib/vonage/video.rb +13 -56
- data/lib/vonage/voice/actions/connect.rb +9 -45
- data/lib/vonage/voice/actions/conversation.rb +4 -10
- data/lib/vonage/voice/actions/input.rb +3 -26
- data/lib/vonage/voice/actions/notify.rb +3 -8
- data/lib/vonage/voice/actions/pay.rb +107 -0
- data/lib/vonage/voice/actions/record.rb +4 -52
- data/lib/vonage/voice/actions/stream.rb +3 -7
- data/lib/vonage/voice/actions/talk.rb +4 -29
- data/lib/vonage/voice/ncco.rb +1 -3
- data/lib/vonage/voice/talk.rb +1 -11
- data/lib/vonage/voice.rb +0 -24
- data/lib/vonage.rb +0 -4
- data/vonage.gemspec +1 -3
- metadata +12 -116
- data/lib/vonage/api_error.rb +0 -33
- data/lib/vonage/basic_and_bearer_token.rb +0 -18
- data/lib/vonage/basic_and_signature.rb +0 -22
- data/lib/vonage/conversation/event/list_response.rb +0 -11
- data/lib/vonage/conversation/event.rb +0 -108
- data/lib/vonage/conversation/list_response.rb +0 -11
- data/lib/vonage/conversation/member/list_response.rb +0 -11
- data/lib/vonage/conversation/member.rb +0 -134
- data/lib/vonage/conversation/user/conversations_list_response.rb +0 -11
- data/lib/vonage/conversation/user/sessions_list_response.rb +0 -11
- data/lib/vonage/conversation/user.rb +0 -67
- data/lib/vonage/conversation.rb +0 -164
- data/lib/vonage/identity_insights/insights_builder.rb +0 -75
- data/lib/vonage/identity_insights.rb +0 -75
- data/lib/vonage/meetings/applications.rb +0 -28
- data/lib/vonage/meetings/dial_in_numbers/list_response.rb +0 -11
- data/lib/vonage/meetings/dial_in_numbers.rb +0 -26
- data/lib/vonage/meetings/recordings.rb +0 -42
- data/lib/vonage/meetings/rooms/list_response.rb +0 -11
- data/lib/vonage/meetings/rooms.rb +0 -167
- data/lib/vonage/meetings/sessions/list_response.rb +0 -11
- data/lib/vonage/meetings/sessions.rb +0 -31
- data/lib/vonage/meetings/themes/list_response.rb +0 -11
- data/lib/vonage/meetings/themes.rb +0 -239
- data/lib/vonage/meetings.rb +0 -50
- data/lib/vonage/messaging/channels/rcs.rb +0 -44
- data/lib/vonage/network_authentication/client_authentication.rb +0 -39
- data/lib/vonage/network_authentication/server_authentication.rb +0 -47
- data/lib/vonage/network_authentication.rb +0 -22
- data/lib/vonage/network_number_verification.rb +0 -92
- data/lib/vonage/network_sim_swap.rb +0 -84
- data/lib/vonage/number_insight_2.rb +0 -21
- data/lib/vonage/proactive_connect/events/list_response.rb +0 -11
- data/lib/vonage/proactive_connect/events.rb +0 -71
- data/lib/vonage/proactive_connect/item.rb +0 -116
- data/lib/vonage/proactive_connect/items/file_response.rb +0 -32
- data/lib/vonage/proactive_connect/items/list_response.rb +0 -11
- data/lib/vonage/proactive_connect/items.rb +0 -116
- data/lib/vonage/proactive_connect/list.rb +0 -186
- data/lib/vonage/proactive_connect/lists/list_response.rb +0 -11
- data/lib/vonage/proactive_connect/lists.rb +0 -38
- data/lib/vonage/proactive_connect.rb +0 -43
- data/lib/vonage/subaccounts/balance_transfers/list_response.rb +0 -11
- data/lib/vonage/subaccounts/credit_transfers/list_response.rb +0 -11
- data/lib/vonage/subaccounts/list_response.rb +0 -15
- data/lib/vonage/subaccounts.rb +0 -203
- data/lib/vonage/users/list_response.rb +0 -11
- data/lib/vonage/users.rb +0 -156
- data/lib/vonage/verify2/channels/email.rb +0 -36
- data/lib/vonage/verify2/channels/silent_auth.rb +0 -46
- data/lib/vonage/verify2/channels/sms.rb +0 -63
- data/lib/vonage/verify2/channels/voice.rb +0 -32
- data/lib/vonage/verify2/channels/whats_app.rb +0 -45
- data/lib/vonage/verify2/channels/whats_app_interactive.rb +0 -32
- data/lib/vonage/verify2/start_verification_options.rb +0 -63
- data/lib/vonage/verify2/template_fragments/list_response.rb +0 -11
- data/lib/vonage/verify2/template_fragments.rb +0 -125
- data/lib/vonage/verify2/templates/list_response.rb +0 -11
- data/lib/vonage/verify2/templates.rb +0 -86
- data/lib/vonage/verify2/workflow.rb +0 -39
- data/lib/vonage/verify2/workflow_builder.rb +0 -25
- data/lib/vonage/verify2.rb +0 -112
- data/lib/vonage/video/archives/list_response.rb +0 -11
- data/lib/vonage/video/broadcasts/list_response.rb +0 -11
- data/lib/vonage/video/broadcasts.rb +0 -75
- data/lib/vonage/video/captions.rb +0 -67
- data/lib/vonage/video/connections/list_response.rb +0 -11
- data/lib/vonage/video/connections.rb +0 -29
- data/lib/vonage/video/renders/list_response.rb +0 -11
- data/lib/vonage/video/renders.rb +0 -107
- data/lib/vonage/video/sip.rb +0 -48
- data/lib/vonage/video/streams/list_response.rb +0 -11
- data/lib/vonage/video/web_socket.rb +0 -62
- data/lib/vonage/voice/actions/transfer.rb +0 -83
- data/lib/vonage/voice/actions/wait.rb +0 -43
|
@@ -13,6 +13,8 @@ module Vonage
|
|
|
13
13
|
|
|
14
14
|
# Get a list of archives for a specified Vonage application.
|
|
15
15
|
#
|
|
16
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
|
17
|
+
#
|
|
16
18
|
# @param [optional, Integer] :offset
|
|
17
19
|
#
|
|
18
20
|
# @param [optional, Integer] :count
|
|
@@ -25,43 +27,47 @@ module Vonage
|
|
|
25
27
|
#
|
|
26
28
|
# @see TODO: add docs link
|
|
27
29
|
#
|
|
28
|
-
def list(**params)
|
|
29
|
-
|
|
30
|
+
def list(application_id: @config.application_id, **params)
|
|
31
|
+
# TODO: raise error if application_id is nil
|
|
32
|
+
|
|
33
|
+
request('/v2/project/' + application_id + '/archive', params: params, response_class: Video::ListResponse)
|
|
30
34
|
end
|
|
31
35
|
|
|
32
36
|
# Return information for specified archive.
|
|
33
37
|
#
|
|
38
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
|
39
|
+
#
|
|
34
40
|
# @param [required, String] archive_id
|
|
35
41
|
#
|
|
36
42
|
# @return [Response]
|
|
37
43
|
#
|
|
38
44
|
# @see TODO: add docs link
|
|
39
45
|
#
|
|
40
|
-
def info(archive_id:)
|
|
41
|
-
|
|
46
|
+
def info(application_id: @config.application_id, archive_id:)
|
|
47
|
+
# TODO: raise error if application_id is nil
|
|
48
|
+
|
|
49
|
+
request('/v2/project/' + application_id + '/archive/' + archive_id)
|
|
42
50
|
end
|
|
43
51
|
|
|
44
52
|
# Create a new archive.
|
|
45
53
|
#
|
|
54
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
|
55
|
+
#
|
|
46
56
|
# @param [required, String] :session_id
|
|
47
57
|
#
|
|
48
|
-
# @param [optional, String] :
|
|
58
|
+
# @param [optional, String] :hasAudio
|
|
49
59
|
#
|
|
50
|
-
# @param [optional, String] :
|
|
60
|
+
# @param [optional, String] :hasVideo
|
|
51
61
|
#
|
|
52
62
|
# @param [optional, String] :name
|
|
53
63
|
#
|
|
54
|
-
# @param [optional, String] :
|
|
64
|
+
# @param [optional, String] :outputMode
|
|
55
65
|
#
|
|
56
66
|
# @param [optional, String] :resolution
|
|
57
67
|
#
|
|
58
|
-
# @param [optional, String] :
|
|
59
|
-
#
|
|
60
|
-
# @param [optional, String] :multi_archive_tag
|
|
68
|
+
# @param [optional, String] :streamMode
|
|
61
69
|
#
|
|
62
|
-
# @param [optional,
|
|
63
|
-
#
|
|
64
|
-
# @param [optional, Number] :quantization_parameter
|
|
70
|
+
# @param [optional, String] :multiArchiveTag
|
|
65
71
|
#
|
|
66
72
|
# @param [optional, Hash] :layout
|
|
67
73
|
#
|
|
@@ -71,51 +77,56 @@ module Vonage
|
|
|
71
77
|
#
|
|
72
78
|
# @option layout [optional, String] :screenshareType
|
|
73
79
|
#
|
|
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
|
-
#
|
|
82
80
|
# @return [Response]
|
|
83
81
|
#
|
|
84
82
|
# @see TODO: add docs link
|
|
85
83
|
#
|
|
86
|
-
def start(
|
|
87
|
-
|
|
84
|
+
def start(application_id: @config.application_id, **params)
|
|
85
|
+
# TODO: raise error if application_id is nil
|
|
86
|
+
# TODO: raise error if session_id is nil
|
|
87
|
+
|
|
88
|
+
request('/v2/project/' + application_id + '/archive', params: params, type: Post)
|
|
88
89
|
end
|
|
89
90
|
|
|
90
91
|
# Stop recording a specified archive.
|
|
91
92
|
#
|
|
93
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
|
94
|
+
#
|
|
92
95
|
# @param [required, String] archive_id
|
|
93
96
|
#
|
|
94
97
|
# @return [Response]
|
|
95
98
|
#
|
|
96
99
|
# @see TODO: add docs link
|
|
97
100
|
#
|
|
98
|
-
def stop(archive_id:)
|
|
99
|
-
|
|
101
|
+
def stop(application_id: @config.application_id, archive_id:)
|
|
102
|
+
# TODO: raise error if application_id is nil
|
|
103
|
+
|
|
104
|
+
request('/v2/project/' + application_id + '/archive/' + archive_id + '/stop', type: Post)
|
|
100
105
|
end
|
|
101
106
|
|
|
102
107
|
# Delete a specified archive.
|
|
103
108
|
#
|
|
109
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
|
110
|
+
#
|
|
104
111
|
# @param [required, String] archive_id
|
|
105
112
|
#
|
|
106
113
|
# @return [Response]
|
|
107
114
|
#
|
|
108
115
|
# @see TODO: add docs link
|
|
109
116
|
#
|
|
110
|
-
def delete(archive_id:)
|
|
111
|
-
|
|
117
|
+
def delete(application_id: @config.application_id, archive_id:)
|
|
118
|
+
# TODO: raise error if application_id is nil
|
|
119
|
+
|
|
120
|
+
request('/v2/project/' + application_id + '/archive/' + archive_id, type: Delete)
|
|
112
121
|
end
|
|
113
122
|
|
|
114
123
|
# Add a stream to a composed archive that was started with the streamMode set to "manual".
|
|
115
124
|
#
|
|
125
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
|
126
|
+
#
|
|
116
127
|
# @param [required, String] archive_id
|
|
117
128
|
#
|
|
118
|
-
# @param [required, String]
|
|
129
|
+
# @param [required, String] add_stream The ID of the stream to be added
|
|
119
130
|
#
|
|
120
131
|
# @param [optional, Boolean] has_audio
|
|
121
132
|
#
|
|
@@ -125,26 +136,36 @@ module Vonage
|
|
|
125
136
|
#
|
|
126
137
|
# @see TODO: add docs link
|
|
127
138
|
#
|
|
128
|
-
def add_stream(archive_id:,
|
|
129
|
-
|
|
139
|
+
def add_stream(application_id: @config.application_id, archive_id:, **params)
|
|
140
|
+
# TODO: raise error if application_id is nil
|
|
141
|
+
# TODO: raise error if add_stream is nil
|
|
142
|
+
|
|
143
|
+
request('/v2/project/' + application_id + '/archive/' + archive_id + '/streams', params: camelcase(params), type: Patch)
|
|
130
144
|
end
|
|
131
145
|
|
|
132
146
|
# Remove a stream from a composed archive that was started with the streamMode set to "manual".
|
|
133
147
|
#
|
|
148
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
|
149
|
+
#
|
|
134
150
|
# @param [required, String] archive_id
|
|
135
151
|
#
|
|
136
|
-
# @param [required, String]
|
|
152
|
+
# @param [required, String] remove_stream The ID of the stream to be removed
|
|
137
153
|
#
|
|
138
154
|
# @return [Response]
|
|
139
155
|
#
|
|
140
156
|
# @see TODO: add docs link
|
|
141
157
|
#
|
|
142
|
-
def remove_stream(archive_id:,
|
|
143
|
-
|
|
158
|
+
def remove_stream(application_id: @config.application_id, archive_id:, **params)
|
|
159
|
+
# TODO: raise error if application_id is nil
|
|
160
|
+
# TODO: raise error if remove_stream is nil
|
|
161
|
+
|
|
162
|
+
request('/v2/project/' + application_id + '/archive/' + archive_id + '/streams', params: camelcase(params), type: Patch)
|
|
144
163
|
end
|
|
145
164
|
|
|
146
165
|
# Change the layout of a composed archive while it is being recorded.
|
|
147
166
|
#
|
|
167
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
|
168
|
+
#
|
|
148
169
|
# @param [required, String] archive_id
|
|
149
170
|
#
|
|
150
171
|
# @param [optional, String] type
|
|
@@ -157,8 +178,10 @@ module Vonage
|
|
|
157
178
|
#
|
|
158
179
|
# @see TODO: add docs link
|
|
159
180
|
#
|
|
160
|
-
def change_layout(archive_id:, **params)
|
|
161
|
-
|
|
181
|
+
def change_layout(application_id: @config.application_id, archive_id:, **params)
|
|
182
|
+
# TODO: raise error if application_id is nil
|
|
183
|
+
|
|
184
|
+
request('/v2/project/' + application_id + '/archive/' + archive_id + '/layout', params: camelcase(params), type: Put)
|
|
162
185
|
end
|
|
163
186
|
end
|
|
164
187
|
end
|
|
@@ -11,6 +11,8 @@ module Vonage
|
|
|
11
11
|
|
|
12
12
|
# Force a client to disconnect from a session.
|
|
13
13
|
#
|
|
14
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
|
15
|
+
#
|
|
14
16
|
# @param [required, String] :session_id
|
|
15
17
|
#
|
|
16
18
|
# @param [required, String] :connection_id The connection ID of the specific participant to be disconnected from the session.
|
|
@@ -19,12 +21,16 @@ module Vonage
|
|
|
19
21
|
#
|
|
20
22
|
# @see TODO: add docs link
|
|
21
23
|
#
|
|
22
|
-
def force_disconnect(session_id:, connection_id:)
|
|
23
|
-
|
|
24
|
+
def force_disconnect(application_id: @config.application_id, session_id:, connection_id:)
|
|
25
|
+
# TODO: raise error if application_id is nil
|
|
26
|
+
|
|
27
|
+
request('/v2/project/' + application_id + '/session/' + session_id + '/connection/' + connection_id, type: Delete)
|
|
24
28
|
end
|
|
25
29
|
|
|
26
30
|
# Force mute a specific publisher stream in a session.
|
|
27
31
|
#
|
|
32
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
|
33
|
+
#
|
|
28
34
|
# @param [required, String] :session_id
|
|
29
35
|
#
|
|
30
36
|
# @param [required, String] :stream_id The stream ID of the specific stream to be muted.
|
|
@@ -33,26 +39,35 @@ module Vonage
|
|
|
33
39
|
#
|
|
34
40
|
# @see TODO: add docs link
|
|
35
41
|
#
|
|
36
|
-
def mute_single_stream(session_id:, stream_id:)
|
|
37
|
-
|
|
42
|
+
def mute_single_stream(application_id: @config.application_id, session_id:, stream_id:)
|
|
43
|
+
application_id ||= @config.application_id
|
|
44
|
+
# TODO: raise error if application_id is nil
|
|
45
|
+
|
|
46
|
+
request('/v2/project/' + application_id + '/session/' + session_id + '/stream/' + stream_id + '/mute', type: Post)
|
|
38
47
|
end
|
|
39
48
|
|
|
40
49
|
# Force mute all publisher stream for a specific session.
|
|
41
50
|
#
|
|
51
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
|
52
|
+
#
|
|
42
53
|
# @param [required, String] :session_id
|
|
43
54
|
#
|
|
44
55
|
# @param [required, String] :active
|
|
45
56
|
#
|
|
46
|
-
# @param [required, Array<String>] :excludedStreamIds
|
|
57
|
+
# @param [required, Array<String>] :excludedStreamIds
|
|
47
58
|
#
|
|
48
59
|
# @return [Response]
|
|
49
60
|
#
|
|
50
61
|
# @see TODO: add docs link
|
|
51
62
|
#
|
|
52
|
-
def mute_multiple_streams(session_id:, **params)
|
|
53
|
-
|
|
63
|
+
def mute_multiple_streams(application_id: @config.application_id, session_id:, **params)
|
|
64
|
+
# TODO: raise error if application_id is nil
|
|
65
|
+
# TODO: camelcase params
|
|
66
|
+
|
|
67
|
+
request('/v2/project/' + application_id + '/session/' + session_id + '/mute', params: params, type: Post)
|
|
54
68
|
end
|
|
55
69
|
|
|
56
70
|
# TODO: add disable_force_mute ??
|
|
57
71
|
end
|
|
58
72
|
end
|
|
73
|
+
|
data/lib/vonage/video/signals.rb
CHANGED
|
@@ -25,8 +25,10 @@ module Vonage
|
|
|
25
25
|
#
|
|
26
26
|
# @see TODO: add docs link
|
|
27
27
|
#
|
|
28
|
-
def send_to_one(session_id:, connection_id:, **params)
|
|
29
|
-
|
|
28
|
+
def send_to_one(application_id: @config.application_id, session_id:, connection_id:, **params)
|
|
29
|
+
# TODO: raise error if application_id is nil
|
|
30
|
+
|
|
31
|
+
request('/v2/project/' + application_id + '/session/' + session_id + '/connection/' + connection_id + '/signal', params: params, type: Post)
|
|
30
32
|
end
|
|
31
33
|
|
|
32
34
|
# Send a signal to all participants in an active Vonage Video session.
|
|
@@ -43,8 +45,11 @@ module Vonage
|
|
|
43
45
|
#
|
|
44
46
|
# @see TODO: add docs link
|
|
45
47
|
#
|
|
46
|
-
def send_to_all(session_id:, **params)
|
|
47
|
-
|
|
48
|
+
def send_to_all(application_id: @config.application_id, session_id:, **params)
|
|
49
|
+
# TODO: raise error if application_id is nil
|
|
50
|
+
|
|
51
|
+
request('/v2/project/' + application_id + '/session/' + session_id + '/signal', params: params, type: Post)
|
|
48
52
|
end
|
|
49
53
|
end
|
|
50
54
|
end
|
|
55
|
+
|
data/lib/vonage/video/streams.rb
CHANGED
|
@@ -22,8 +22,10 @@ module Vonage
|
|
|
22
22
|
#
|
|
23
23
|
# @see TODO: add docs link
|
|
24
24
|
#
|
|
25
|
-
def list(session_id:)
|
|
26
|
-
|
|
25
|
+
def list(application_id: @config.application_id, session_id:)
|
|
26
|
+
# TODO: raise error if application_id is nil
|
|
27
|
+
|
|
28
|
+
request('/v2/project/' + application_id + '/session/' + session_id + '/stream', response_class: Video::ListResponse)
|
|
27
29
|
end
|
|
28
30
|
|
|
29
31
|
# Get information about a specified stream.
|
|
@@ -38,8 +40,10 @@ module Vonage
|
|
|
38
40
|
#
|
|
39
41
|
# @see TODO: add docs link
|
|
40
42
|
#
|
|
41
|
-
def info(session_id:, stream_id:)
|
|
42
|
-
|
|
43
|
+
def info(application_id: @config.application_id, session_id:, stream_id:)
|
|
44
|
+
# TODO: raise error if application_id is nil
|
|
45
|
+
|
|
46
|
+
request('/v2/project/' + application_id + '/session/' + session_id + '/stream/' + stream_id)
|
|
43
47
|
end
|
|
44
48
|
|
|
45
49
|
# Change the layout for a list of specified streams.
|
|
@@ -58,13 +62,15 @@ module Vonage
|
|
|
58
62
|
#
|
|
59
63
|
# @see TODO: add docs link
|
|
60
64
|
#
|
|
61
|
-
def change_layout(session_id:, **params)
|
|
65
|
+
def change_layout(application_id: @config.application_id, session_id:, **params)
|
|
66
|
+
# TODO: raise error if application_id is nil
|
|
62
67
|
# TODO camelcase layout_class_list
|
|
63
68
|
# if params[:items]
|
|
64
69
|
# params[:items] = params[:items].map {|item| camelcase(item)}
|
|
65
70
|
# end
|
|
66
71
|
|
|
67
|
-
request('/v2/project/' +
|
|
72
|
+
request('/v2/project/' + application_id + '/session/' + session_id + '/stream', params: params, type: Put)
|
|
68
73
|
end
|
|
69
74
|
end
|
|
70
75
|
end
|
|
76
|
+
|
data/lib/vonage/video.rb
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
module Vonage
|
|
5
5
|
class Video < Namespace
|
|
6
6
|
include Keys
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
self.authentication = BearerToken
|
|
9
9
|
|
|
10
10
|
self.host = :video_host
|
|
@@ -30,7 +30,7 @@ module Vonage
|
|
|
30
30
|
#
|
|
31
31
|
def create_session(**params)
|
|
32
32
|
request_params = params.clone
|
|
33
|
-
request_params[:archive_mode] ||= 'manual'
|
|
33
|
+
request_params[:archive_mode] ||= 'manual'
|
|
34
34
|
media_mode = request_params.delete(:media_mode) || 'routed'
|
|
35
35
|
|
|
36
36
|
if media_mode == 'relayed' && request_params[:archive_mode] == 'manual'
|
|
@@ -42,7 +42,7 @@ module Vonage
|
|
|
42
42
|
response = request('/session/create', params: camelcase(request_params), type: Post)
|
|
43
43
|
|
|
44
44
|
public_response_data = {
|
|
45
|
-
session_id: response.entity
|
|
45
|
+
session_id: response.entity[:session_id],
|
|
46
46
|
archive_mode: request_params[:archive_mode],
|
|
47
47
|
media_mode: media_mode,
|
|
48
48
|
location: request_params[:location]
|
|
@@ -54,22 +54,7 @@ module Vonage
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def generate_client_token(session_id:, scope: 'session.connect', role: 'publisher', **params)
|
|
57
|
-
|
|
58
|
-
raise ArgumentError, "Invalid role: #{role}" unless valid_roles.include?(role)
|
|
59
|
-
|
|
60
|
-
claims = {
|
|
61
|
-
application_id: @config.application_id,
|
|
62
|
-
scope: scope,
|
|
63
|
-
session_id: session_id,
|
|
64
|
-
role: role,
|
|
65
|
-
initial_layout_class_list: '',
|
|
66
|
-
sub: 'video',
|
|
67
|
-
acl: {
|
|
68
|
-
paths: {'/session/**' => {}}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
57
|
+
claims = {session_id: session_id, application_id: @config.application_id, scope: scope, role: role}
|
|
73
58
|
claims[:data] = params[:data] if params[:data]
|
|
74
59
|
claims[:initial_layout_class_list] = params[:initial_layout_class_list].join(' ') if params[:initial_layout_class_list]
|
|
75
60
|
claims[:exp] = params[:expire_time].to_i if params[:expire_time]
|
|
@@ -77,58 +62,30 @@ module Vonage
|
|
|
77
62
|
JWT.generate(claims, @config.private_key)
|
|
78
63
|
end
|
|
79
64
|
|
|
80
|
-
# @return [
|
|
65
|
+
# @return [Streams]
|
|
81
66
|
#
|
|
82
|
-
def
|
|
83
|
-
@
|
|
67
|
+
def streams
|
|
68
|
+
@streams ||= Streams.new(@config)
|
|
84
69
|
end
|
|
85
70
|
|
|
86
|
-
# @return [
|
|
71
|
+
# @return [Archives]
|
|
87
72
|
#
|
|
88
|
-
def
|
|
89
|
-
@
|
|
73
|
+
def archives
|
|
74
|
+
@archives ||= Archives.new(@config)
|
|
90
75
|
end
|
|
91
76
|
|
|
92
|
-
# @return [
|
|
77
|
+
# @return [Archives]
|
|
93
78
|
#
|
|
94
79
|
def moderation
|
|
95
80
|
@moderation ||= Moderation.new(@config)
|
|
96
81
|
end
|
|
97
82
|
|
|
98
|
-
# @return [
|
|
83
|
+
# @return [Archives]
|
|
99
84
|
#
|
|
100
85
|
def signals
|
|
101
86
|
@signals ||= Signals.new(@config)
|
|
102
87
|
end
|
|
103
88
|
|
|
104
|
-
#
|
|
105
|
-
#
|
|
106
|
-
def streams
|
|
107
|
-
@streams ||= Streams.new(@config)
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
# @return [Connections]
|
|
111
|
-
#
|
|
112
|
-
def connections
|
|
113
|
-
@connections ||= Connections.new(@config)
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
# @return [Captions]
|
|
117
|
-
#
|
|
118
|
-
def captions
|
|
119
|
-
@captions ||= Captions.new(@config)
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
# @return [Renders]
|
|
123
|
-
#
|
|
124
|
-
def renders
|
|
125
|
-
@renders ||= Renders.new(@config)
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
# @return [WebSocket]
|
|
129
|
-
#
|
|
130
|
-
def web_socket
|
|
131
|
-
@web_socket ||= WebSocket.new(@config)
|
|
132
|
-
end
|
|
89
|
+
# TODO: add token generator
|
|
133
90
|
end
|
|
134
91
|
end
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
require 'phonelib'
|
|
4
4
|
|
|
5
|
-
module Vonage
|
|
5
|
+
module Vonage
|
|
6
6
|
class Voice::Actions::Connect
|
|
7
|
-
attr_accessor :endpoint, :from, :eventType, :timeout, :limit, :machineDetection, :
|
|
7
|
+
attr_accessor :endpoint, :from, :eventType, :timeout, :limit, :machineDetection, :eventUrl, :eventMethod, :ringbackTone
|
|
8
8
|
|
|
9
9
|
def initialize(attributes = {})
|
|
10
10
|
@endpoint = attributes.fetch(:endpoint)
|
|
@@ -13,7 +13,6 @@ module Vonage
|
|
|
13
13
|
@timeout = attributes.fetch(:timeout, nil)
|
|
14
14
|
@limit = attributes.fetch(:limit, nil)
|
|
15
15
|
@machineDetection = attributes.fetch(:machineDetection, nil)
|
|
16
|
-
@advanced_machine_detection = attributes.fetch(:advanced_machine_detection, nil)
|
|
17
16
|
@eventUrl = attributes.fetch(:eventUrl, nil)
|
|
18
17
|
@eventMethod = attributes.fetch(:eventMethod, nil)
|
|
19
18
|
@ringbackTone = attributes.fetch(:ringbackTone, nil)
|
|
@@ -40,10 +39,6 @@ module Vonage
|
|
|
40
39
|
verify_machine_detection
|
|
41
40
|
end
|
|
42
41
|
|
|
43
|
-
if self.advanced_machine_detection
|
|
44
|
-
verify_advanced_machine_detection
|
|
45
|
-
end
|
|
46
|
-
|
|
47
42
|
if self.eventUrl
|
|
48
43
|
verify_event_url
|
|
49
44
|
end
|
|
@@ -65,11 +60,9 @@ module Vonage
|
|
|
65
60
|
raise ClientError.new("'user' must be defined") unless endpoint[:user]
|
|
66
61
|
when 'websocket'
|
|
67
62
|
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/
|
|
63
|
+
raise ClientError.new("Expected 'content-type' parameter to be either 'audio/116;rate=16000' or 'audio/116;rate=8000") unless endpoint[:'content-type'] == 'audio/116;rate=16000' || endpoint[:'content-type'] == 'audio/116;rate=8000'
|
|
69
64
|
when 'sip'
|
|
70
|
-
raise ClientError.new("Expected 'uri' value to be a valid URI") unless URI.parse(endpoint[:uri]).kind_of?(URI::Generic)
|
|
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])
|
|
65
|
+
raise ClientError.new("Expected 'uri' value to be a valid URI") unless URI.parse(endpoint[:uri]).kind_of?(URI::Generic)
|
|
73
66
|
end
|
|
74
67
|
end
|
|
75
68
|
|
|
@@ -89,33 +82,10 @@ module Vonage
|
|
|
89
82
|
raise ClientError.new("Invalid 'machineDetection' value, must be either: 'continue' or 'hangup' if defined") unless self.machineDetection == 'continue' || self.machineDetection == 'hangup'
|
|
90
83
|
end
|
|
91
84
|
|
|
92
|
-
def verify_advanced_machine_detection
|
|
93
|
-
raise ClientError.new("Invalid 'advanced_machine_detection' value, must be a Hash") unless self.advanced_machine_detection.is_a?(Hash)
|
|
94
|
-
verify_advanced_machine_detection_behavior if self.advanced_machine_detection[:behavior]
|
|
95
|
-
verify_advanced_machine_detection_mode if self.advanced_machine_detection[:mode]
|
|
96
|
-
verify_advanced_machine_detection_beep_timeout if self.advanced_machine_detection[:beep_timeout]
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
def verify_advanced_machine_detection_behavior
|
|
100
|
-
raise ClientError.new("Invalid 'advanced_machine_detection[:behavior]' value, must be a `continue` or `hangup`") unless ['continue', 'hangup'].include?(self.advanced_machine_detection[:behavior])
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
def verify_advanced_machine_detection_mode
|
|
104
|
-
raise ClientError.new("Invalid 'advanced_machine_detection[:mode]' value, must be a `detect` or `detect_beep`") unless ['detect', 'detect_beep'].include?(self.advanced_machine_detection[:mode])
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
def verify_advanced_machine_detection_beep_timeout
|
|
108
|
-
raise ClientError.new("Invalid 'advanced_machine_detection[:beep_timeout]' value, must be between 45 and 120") unless self.advanced_machine_detection[:beep_timeout].between?(45, 120)
|
|
109
|
-
end
|
|
110
|
-
|
|
111
85
|
def verify_event_url
|
|
112
|
-
|
|
113
|
-
raise ClientError.new("Expected 'eventUrl' parameter to be an Array containing a single string item")
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
uri = URI.parse(self.eventUrl[0])
|
|
86
|
+
uri = URI.parse(self.eventUrl)
|
|
117
87
|
|
|
118
|
-
raise ClientError.new("Invalid 'eventUrl' value,
|
|
88
|
+
raise ClientError.new("Invalid 'eventUrl' value, must be a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
|
|
119
89
|
|
|
120
90
|
self.eventUrl
|
|
121
91
|
end
|
|
@@ -153,7 +123,6 @@ module Vonage
|
|
|
153
123
|
ncco[0].merge!(timeout: builder.timeout) if builder.timeout
|
|
154
124
|
ncco[0].merge!(limit: builder.limit) if builder.limit
|
|
155
125
|
ncco[0].merge!(machineDetection: builder.machineDetection) if builder.machineDetection
|
|
156
|
-
ncco[0].merge!(advanced_machine_detection: builder.advanced_machine_detection) if builder.advanced_machine_detection
|
|
157
126
|
ncco[0].merge!(eventUrl: builder.eventUrl) if builder.eventUrl
|
|
158
127
|
ncco[0].merge!(eventMethod: builder.eventMethod) if builder.eventMethod
|
|
159
128
|
ncco[0].merge!(ringbackTone: builder.ringbackTone) if builder.ringbackTone
|
|
@@ -186,7 +155,6 @@ module Vonage
|
|
|
186
155
|
|
|
187
156
|
hash.merge!(dtmfAnswer: endpoint_attrs[:dtmfAnswer]) if endpoint_attrs[:dtmfAnswer]
|
|
188
157
|
hash.merge!(onAnswer: endpoint_attrs[:onAnswer]) if endpoint_attrs[:onAnswer]
|
|
189
|
-
hash.merge!(shaken: endpoint_attrs[:shaken]) if endpoint_attrs[:shaken]
|
|
190
158
|
|
|
191
159
|
hash
|
|
192
160
|
end
|
|
@@ -206,21 +174,17 @@ module Vonage
|
|
|
206
174
|
}
|
|
207
175
|
|
|
208
176
|
hash.merge!(headers: endpoint_attrs[:headers]) if endpoint_attrs[:headers]
|
|
209
|
-
hash.merge!(authorization: endpoint_attrs[:authorization]) if endpoint_attrs[:authorization]
|
|
210
177
|
|
|
211
178
|
hash
|
|
212
179
|
end
|
|
213
180
|
|
|
214
181
|
def sip_endpoint(endpoint_attrs)
|
|
215
182
|
hash = {
|
|
216
|
-
type: 'sip'
|
|
183
|
+
type: 'sip',
|
|
184
|
+
uri: endpoint_attrs[:uri]
|
|
217
185
|
}
|
|
218
186
|
|
|
219
|
-
hash.merge!(uri: endpoint_attrs[:uri]) if endpoint_attrs[:uri]
|
|
220
|
-
hash.merge!(user: endpoint_attrs[:user]) if endpoint_attrs[:user]
|
|
221
|
-
hash.merge!(domain: endpoint_attrs[:domain]) if endpoint_attrs[:domain]
|
|
222
187
|
hash.merge!(headers: endpoint_attrs[:headers]) if endpoint_attrs[:headers]
|
|
223
|
-
hash.merge!(standardHeaders: endpoint_attrs[:standardHeaders]) if endpoint_attrs[:standardHeaders]
|
|
224
188
|
|
|
225
189
|
hash
|
|
226
190
|
end
|
|
@@ -232,4 +196,4 @@ module Vonage
|
|
|
232
196
|
}
|
|
233
197
|
end
|
|
234
198
|
end
|
|
235
|
-
end
|
|
199
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# typed: true
|
|
2
2
|
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
module Vonage
|
|
3
|
+
|
|
4
|
+
module Vonage
|
|
5
5
|
class Voice::Actions::Conversation
|
|
6
6
|
attr_accessor :name, :musicOnHoldUrl, :startOnEnter, :endOnExit, :record, :canSpeak, :canHear, :mute
|
|
7
7
|
|
|
@@ -49,15 +49,9 @@ module Vonage
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def verify_music_on_hold_url
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
unless music_on_hold_url.is_a?(Array) && music_on_hold_url.length == 1 && music_on_hold_url[0].is_a?(String)
|
|
55
|
-
raise ClientError.new("Expected 'musicOnHoldUrl' parameter to be an Array containing a single string item")
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
uri = URI.parse(music_on_hold_url[0])
|
|
52
|
+
uri = URI.parse(self.musicOnHoldUrl)
|
|
59
53
|
|
|
60
|
-
raise ClientError.new("Invalid 'musicOnHoldUrl' value,
|
|
54
|
+
raise ClientError.new("Invalid 'musicOnHoldUrl' value, must be a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
|
|
61
55
|
|
|
62
56
|
self.musicOnHoldUrl
|
|
63
57
|
end
|