vonage 7.29.1 → 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.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +89 -476
  3. data/lib/vonage/applications.rb +4 -12
  4. data/lib/vonage/basic.rb +1 -1
  5. data/lib/vonage/bearer_token.rb +1 -1
  6. data/lib/vonage/client.rb +0 -65
  7. data/lib/vonage/client_error.rb +1 -1
  8. data/lib/vonage/config.rb +1 -9
  9. data/lib/vonage/conversations/events.rb +0 -12
  10. data/lib/vonage/conversations/legs.rb +0 -6
  11. data/lib/vonage/conversations/members.rb +0 -15
  12. data/lib/vonage/conversations/users.rb +0 -15
  13. data/lib/vonage/conversations.rb +0 -30
  14. data/lib/vonage/errors.rb +20 -37
  15. data/lib/vonage/gsm7.rb +1 -1
  16. data/lib/vonage/http.rb +3 -3
  17. data/lib/vonage/jwt.rb +0 -17
  18. data/lib/vonage/key_secret_params.rb +2 -3
  19. data/lib/vonage/keys.rb +1 -14
  20. data/lib/vonage/logger.rb +3 -5
  21. data/lib/vonage/messaging/channels/viber.rb +2 -9
  22. data/lib/vonage/messaging/channels/whats_app.rb +1 -3
  23. data/lib/vonage/messaging/message.rb +0 -1
  24. data/lib/vonage/messaging.rb +4 -34
  25. data/lib/vonage/namespace.rb +68 -137
  26. data/lib/vonage/numbers.rb +17 -40
  27. data/lib/vonage/server_error.rb +1 -1
  28. data/lib/vonage/signature.rb +5 -5
  29. data/lib/vonage/sms.rb +20 -20
  30. data/lib/vonage/version.rb +1 -1
  31. data/lib/vonage/video/archives.rb +58 -25
  32. data/lib/vonage/video/list_response.rb +11 -0
  33. data/lib/vonage/video/moderation.rb +22 -7
  34. data/lib/vonage/video/signals.rb +9 -4
  35. data/lib/vonage/video/streams.rb +12 -6
  36. data/lib/vonage/video.rb +13 -50
  37. data/lib/vonage/voice/actions/connect.rb +5 -34
  38. data/lib/vonage/voice/actions/conversation.rb +4 -10
  39. data/lib/vonage/voice/actions/input.rb +3 -19
  40. data/lib/vonage/voice/actions/notify.rb +3 -8
  41. data/lib/vonage/voice/actions/pay.rb +107 -0
  42. data/lib/vonage/voice/actions/record.rb +4 -52
  43. data/lib/vonage/voice/actions/stream.rb +4 -48
  44. data/lib/vonage/voice/actions/talk.rb +4 -54
  45. data/lib/vonage/voice/talk.rb +1 -11
  46. data/lib/vonage/voice.rb +0 -24
  47. data/lib/vonage.rb +0 -4
  48. data/vonage.gemspec +1 -3
  49. metadata +12 -108
  50. data/lib/vonage/api_error.rb +0 -33
  51. data/lib/vonage/conversation/event/list_response.rb +0 -11
  52. data/lib/vonage/conversation/event.rb +0 -108
  53. data/lib/vonage/conversation/list_response.rb +0 -11
  54. data/lib/vonage/conversation/member/list_response.rb +0 -11
  55. data/lib/vonage/conversation/member.rb +0 -134
  56. data/lib/vonage/conversation/user/conversations_list_response.rb +0 -11
  57. data/lib/vonage/conversation/user/sessions_list_response.rb +0 -11
  58. data/lib/vonage/conversation/user.rb +0 -67
  59. data/lib/vonage/conversation.rb +0 -164
  60. data/lib/vonage/meetings/applications.rb +0 -28
  61. data/lib/vonage/meetings/dial_in_numbers/list_response.rb +0 -11
  62. data/lib/vonage/meetings/dial_in_numbers.rb +0 -26
  63. data/lib/vonage/meetings/recordings.rb +0 -42
  64. data/lib/vonage/meetings/rooms/list_response.rb +0 -11
  65. data/lib/vonage/meetings/rooms.rb +0 -167
  66. data/lib/vonage/meetings/sessions/list_response.rb +0 -11
  67. data/lib/vonage/meetings/sessions.rb +0 -31
  68. data/lib/vonage/meetings/themes/list_response.rb +0 -11
  69. data/lib/vonage/meetings/themes.rb +0 -239
  70. data/lib/vonage/meetings.rb +0 -50
  71. data/lib/vonage/messaging/channels/rcs.rb +0 -42
  72. data/lib/vonage/network_authentication/client_authentication.rb +0 -39
  73. data/lib/vonage/network_authentication/server_authentication.rb +0 -47
  74. data/lib/vonage/network_authentication.rb +0 -22
  75. data/lib/vonage/network_number_verification.rb +0 -92
  76. data/lib/vonage/network_sim_swap.rb +0 -84
  77. data/lib/vonage/number_insight_2.rb +0 -36
  78. data/lib/vonage/proactive_connect/events/list_response.rb +0 -11
  79. data/lib/vonage/proactive_connect/events.rb +0 -71
  80. data/lib/vonage/proactive_connect/item.rb +0 -116
  81. data/lib/vonage/proactive_connect/items/file_response.rb +0 -32
  82. data/lib/vonage/proactive_connect/items/list_response.rb +0 -11
  83. data/lib/vonage/proactive_connect/items.rb +0 -116
  84. data/lib/vonage/proactive_connect/list.rb +0 -186
  85. data/lib/vonage/proactive_connect/lists/list_response.rb +0 -11
  86. data/lib/vonage/proactive_connect/lists.rb +0 -38
  87. data/lib/vonage/proactive_connect.rb +0 -43
  88. data/lib/vonage/subaccounts/balance_transfers/list_response.rb +0 -11
  89. data/lib/vonage/subaccounts/credit_transfers/list_response.rb +0 -11
  90. data/lib/vonage/subaccounts/list_response.rb +0 -15
  91. data/lib/vonage/subaccounts.rb +0 -203
  92. data/lib/vonage/users/list_response.rb +0 -11
  93. data/lib/vonage/users.rb +0 -156
  94. data/lib/vonage/verify2/channels/email.rb +0 -36
  95. data/lib/vonage/verify2/channels/silent_auth.rb +0 -45
  96. data/lib/vonage/verify2/channels/sms.rb +0 -63
  97. data/lib/vonage/verify2/channels/voice.rb +0 -32
  98. data/lib/vonage/verify2/channels/whats_app.rb +0 -39
  99. data/lib/vonage/verify2/channels/whats_app_interactive.rb +0 -32
  100. data/lib/vonage/verify2/start_verification_options.rb +0 -63
  101. data/lib/vonage/verify2/template_fragments/list_response.rb +0 -11
  102. data/lib/vonage/verify2/template_fragments.rb +0 -125
  103. data/lib/vonage/verify2/templates/list_response.rb +0 -11
  104. data/lib/vonage/verify2/templates.rb +0 -86
  105. data/lib/vonage/verify2/workflow.rb +0 -39
  106. data/lib/vonage/verify2/workflow_builder.rb +0 -25
  107. data/lib/vonage/verify2.rb +0 -112
  108. data/lib/vonage/video/archives/list_response.rb +0 -11
  109. data/lib/vonage/video/broadcasts/list_response.rb +0 -11
  110. data/lib/vonage/video/broadcasts.rb +0 -75
  111. data/lib/vonage/video/captions.rb +0 -67
  112. data/lib/vonage/video/renders/list_response.rb +0 -11
  113. data/lib/vonage/video/renders.rb +0 -107
  114. data/lib/vonage/video/sip.rb +0 -48
  115. data/lib/vonage/video/streams/list_response.rb +0 -11
  116. data/lib/vonage/video/web_socket.rb +0 -61
@@ -5,8 +5,6 @@ module Vonage
5
5
  class Numbers < Namespace
6
6
  include Keys
7
7
 
8
- self.authentication = Basic
9
-
10
8
  self.host = :rest_host
11
9
 
12
10
  # Retrieve all the inbound numbers associated with your Vonage account.
@@ -17,8 +15,6 @@ module Vonage
17
15
  # puts "#{item.msisdn} #{item.country} #{item.type}"
18
16
  # end
19
17
  #
20
- # @param [Hash] params
21
- #
22
18
  # @option params [String] :application_id
23
19
  # The application that you want to return the numbers for.
24
20
  #
@@ -49,12 +45,14 @@ module Vonage
49
45
  # Set this to `true` to auto-advance through all the pages in the record
50
46
  # and collect all the data. The default is `false`.
51
47
  #
48
+ # @param [Hash] params
49
+ #
52
50
  # @return [ListResponse]
53
51
  #
54
52
  # @see https://developer.nexmo.com/api/developer/numbers#getOwnedNumbers
55
53
  #
56
54
  def list(params = nil)
57
- request("/account/numbers", params: params, response_class: ListResponse)
55
+ request('/account/numbers', params: params, response_class: ListResponse)
58
56
  end
59
57
 
60
58
  # Retrieve inbound numbers that are available for the specified country.
@@ -65,8 +63,6 @@ module Vonage
65
63
  # puts "#{item.msisdn} #{item.type} #{item.cost}"
66
64
  # end
67
65
  #
68
- # @param [Hash] params
69
- #
70
66
  # @option params [required, String] :country
71
67
  # The two character country code in ISO 3166-1 alpha-2 format.
72
68
  #
@@ -84,7 +80,7 @@ module Vonage
84
80
  # - `2` - Search for numbers that end with **:pattern**
85
81
  #
86
82
  # @option params [String] :features
87
- # Available features are `SMS`, `MMS`, and `VOICE`.
83
+ # Available features are `SMS` and `VOICE`.
88
84
  # To look for numbers that support both, use a comma-separated value: `SMS,VOICE`.
89
85
  #
90
86
  # @option params [Integer] :size
@@ -97,12 +93,14 @@ module Vonage
97
93
  # Set this to `true` to auto-advance through all the pages in the record
98
94
  # and collect all the data. The default is `false`.
99
95
  #
96
+ # @param [Hash] params
97
+ #
100
98
  # @return [ListResponse]
101
99
  #
102
100
  # @see https://developer.nexmo.com/api/developer/numbers#getAvailableNumbers
103
101
  #
104
102
  def search(params)
105
- request("/number/search", params: params, response_class: ListResponse)
103
+ request('/number/search', params: params, response_class: ListResponse)
106
104
  end
107
105
 
108
106
  # Request to purchase a specific inbound number.
@@ -110,8 +108,6 @@ module Vonage
110
108
  # @example
111
109
  # response = client.numbers.buy(country: 'GB', msisdn: '447700900000')
112
110
  #
113
- # @param [Hash] params
114
- #
115
111
  # @option params [required, String] :country
116
112
  # The two character country code in ISO 3166-1 alpha-2 format.
117
113
  #
@@ -122,17 +118,14 @@ module Vonage
122
118
  # If you'd like to perform an action on a subaccount, provide the `api_key` of that account here.
123
119
  # If you'd like to perform an action on your own account, you do not need to provide this field.
124
120
  #
121
+ # @param [Hash] params
122
+ #
125
123
  # @return [Response]
126
124
  #
127
125
  # @see https://developer.nexmo.com/api/developer/numbers#buyANumber
128
126
  #
129
127
  def buy(params)
130
- request(
131
- "/number/buy",
132
- params: params,
133
- type: Post,
134
- response_class: Response
135
- )
128
+ request('/number/buy', params: params, type: Post, response_class: Response)
136
129
  end
137
130
 
138
131
  # Cancel your subscription for a specific inbound number.
@@ -140,8 +133,6 @@ module Vonage
140
133
  # @example
141
134
  # response = client.numbers.cancel(country: 'GB', msisdn: '447700900000')
142
135
  #
143
- # @param [Hash] params
144
- #
145
136
  # @option params [required, String] :country
146
137
  # The two character country code in ISO 3166-1 alpha-2 format.
147
138
  #
@@ -152,17 +143,14 @@ module Vonage
152
143
  # If you'd like to perform an action on a subaccount, provide the `api_key` of that account here.
153
144
  # If you'd like to perform an action on your own account, you do not need to provide this field.
154
145
  #
146
+ # @param [Hash] params
147
+ #
155
148
  # @return [Response]
156
149
  #
157
150
  # @see https://developer.nexmo.com/api/developer/numbers#cancelANumber
158
151
  #
159
152
  def cancel(params)
160
- request(
161
- "/number/cancel",
162
- params: params,
163
- type: Post,
164
- response_class: Response
165
- )
153
+ request('/number/cancel', params: params, type: Post, response_class: Response)
166
154
  end
167
155
 
168
156
  # Change the behaviour of a number that you own.
@@ -177,8 +165,6 @@ module Vonage
177
165
  #
178
166
  # response = client.numbers.update(params)
179
167
  #
180
- # @param [Hash] params
181
- #
182
168
  # @option params [required, String] :country
183
169
  # The two character country code in ISO 3166-1 alpha-2 format.
184
170
  #
@@ -205,30 +191,21 @@ module Vonage
205
191
  # @option params [String] :voice_status_callback
206
192
  # A webhook URI for Vonage to send a request to when a call ends.
207
193
  #
194
+ # @param [Hash] params
195
+ #
208
196
  # @return [Response]
209
197
  #
210
198
  # @see https://developer.nexmo.com/api/developer/numbers#updateANumber
211
199
  #
212
200
  def update(params)
213
- request(
214
- "/number/update",
215
- params: camelcase(params),
216
- type: Post,
217
- response_class: Response
218
- )
201
+ request('/number/update', params: camelcase(params), type: Post, response_class: Response)
219
202
  end
220
203
 
221
204
  private
222
205
 
223
206
  # A specific implementation of iterable_request for Numbers, because the Numbers API
224
207
  # handles pagination differently to other Vonage APIs
225
- def iterable_request(
226
- path,
227
- response: nil,
228
- response_class: nil,
229
- params: {},
230
- &block
231
- )
208
+ def iterable_request(path, response: nil, response_class: nil, params: {}, &block)
232
209
  response = parse(response, response_class)
233
210
  params[:index] = 1 unless params.has_key?(:index)
234
211
  size = params.fetch(:size, 10)
@@ -1,6 +1,6 @@
1
1
  # typed: strong
2
2
 
3
3
  module Vonage
4
- class ServerError < APIError
4
+ class ServerError < Error
5
5
  end
6
6
  end
@@ -27,24 +27,24 @@ module Vonage
27
27
  #
28
28
  # @see https://developer.nexmo.com/concepts/guides/signing-messages
29
29
  #
30
- def check(params, signature_secret: @config.signature_secret, signature_method: @config.signature_method)
30
+ def check(params, signature_method: @config.signature_method)
31
31
  params = params.dup
32
32
 
33
33
  signature = params.delete('sig')
34
34
 
35
- ::JWT::JWA::Hmac::SecurityUtils.secure_compare(signature, digest(params, signature_secret, signature_method))
35
+ ::JWT::SecurityUtils.secure_compare(signature, digest(params, signature_method))
36
36
  end
37
37
 
38
38
  private
39
39
 
40
- def digest(params, signature_secret, signature_method)
40
+ def digest(params, signature_method)
41
41
  digest_string = params.sort.map { |k, v| "&#{k}=#{v.tr('&=', '_')}" }.join
42
42
 
43
43
  case signature_method
44
44
  when 'md5', 'sha1', 'sha256', 'sha512'
45
- OpenSSL::HMAC.hexdigest(signature_method, signature_secret, digest_string).upcase
45
+ OpenSSL::HMAC.hexdigest(signature_method, @config.signature_secret, digest_string).upcase
46
46
  when 'md5hash'
47
- Digest::MD5.hexdigest("#{digest_string}#{signature_secret}")
47
+ Digest::MD5.hexdigest("#{digest_string}#{@config.signature_secret}")
48
48
  else
49
49
  raise ArgumentError, "Unknown signature algorithm: #{signature_method}. Expected: md5hash, md5, sha1, sha256, or sha512."
50
50
  end
data/lib/vonage/sms.rb CHANGED
@@ -47,6 +47,14 @@ module Vonage
47
47
  # @option params [String] :type
48
48
  # The format of the message body.
49
49
  #
50
+ # @option params [String] :vcard
51
+ # A business card in [vCard format](https://en.wikipedia.org/wiki/VCard).
52
+ # Depends on **:type** option having the value `vcard`.
53
+ #
54
+ # @option params [String] :vcal
55
+ # A calendar event in [vCal format](https://en.wikipedia.org/wiki/VCal).
56
+ # Depends on **:type** option having the value `vcal`.
57
+ #
50
58
  # @option params [String] :body
51
59
  # Hex encoded binary data.
52
60
  # Depends on **:type** option having the value `binary`.
@@ -59,6 +67,18 @@ module Vonage
59
67
  # The value of the [protocol identifier](https://en.wikipedia.org/wiki/GSM_03.40#Protocol_Identifier) to use.
60
68
  # Ensure that the value is aligned with **:udh**.
61
69
  #
70
+ # @option params [String] :title
71
+ # The title for a wappush SMS.
72
+ # Depends on **:type** option having the value `wappush`.
73
+ #
74
+ # @option params [String] :url
75
+ # The URL of your website.
76
+ # Depends on **:type** option having the value `wappush`.
77
+ #
78
+ # @option params [String] :validity
79
+ # The availability for an SMS in milliseconds.
80
+ # Depends on **:type** option having the value `wappush`.
81
+ #
62
82
  # @option params [String] :client_ref
63
83
  # You can optionally include your own reference of up to 40 characters.
64
84
  #
@@ -91,31 +111,11 @@ module Vonage
91
111
  response
92
112
  end
93
113
 
94
- # Validate a Signature from an SMS API Webhook.
95
- #
96
- # @param [Hash, required] :webhook_params The parameters from the webhook request body
97
- # @param [String, optional] :signature_secret The account signature secret. Required, unless `signature_secret`
98
- # is set in `Config`
99
- # @param [String, optional] :signature_method The account signature method. Required, unless `signature_method`
100
- # is set in `Config`
101
- #
102
- # @return [Boolean] true, if the JWT is verified, false otherwise
103
- def verify_webhook_sig(webhook_params:, signature_secret: @config.signature_secret, signature_method: @config.signature_method)
104
- signature.check(webhook_params, signature_secret: signature_secret, signature_method: signature_method)
105
- end
106
-
107
114
  private
108
115
 
109
116
  sig { params(text: String).returns(T::Boolean) }
110
117
  def unicode?(text)
111
118
  !Vonage::GSM7.encoded?(text)
112
119
  end
113
-
114
- # @return [Signature]
115
- #
116
- sig { returns(T.nilable(Vonage::Signature)) }
117
- def signature
118
- @signature ||= T.let(Signature.new(@config), T.nilable(Vonage::Signature))
119
- end
120
120
  end
121
121
  end
@@ -1,5 +1,5 @@
1
1
  # typed: strong
2
2
 
3
3
  module Vonage
4
- VERSION = '7.29.1'
4
+ VERSION = '8.0.0.beta'
5
5
  end
@@ -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,41 +27,47 @@ module Vonage
25
27
  #
26
28
  # @see TODO: add docs link
27
29
  #
28
- def list(**params)
29
- request('/v2/project/' + @config.application_id + '/archive', params: params, response_class: ListResponse)
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
- request('/v2/project/' + @config.application_id + '/archive/' + archive_id)
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] :has_audio
58
+ # @param [optional, String] :hasAudio
49
59
  #
50
- # @param [optional, String] :has_video
60
+ # @param [optional, String] :hasVideo
51
61
  #
52
62
  # @param [optional, String] :name
53
63
  #
54
- # @param [optional, String] :output_mode
64
+ # @param [optional, String] :outputMode
55
65
  #
56
66
  # @param [optional, String] :resolution
57
67
  #
58
- # @param [optional, String] :stream_mode
68
+ # @param [optional, String] :streamMode
59
69
  #
60
- # @param [optional, String] :multi_archive_tag
61
- #
62
- # @param [optional, String] :max_bitrate
70
+ # @param [optional, String] :multiArchiveTag
63
71
  #
64
72
  # @param [optional, Hash] :layout
65
73
  #
@@ -73,39 +81,52 @@ module Vonage
73
81
  #
74
82
  # @see TODO: add docs link
75
83
  #
76
- def start(session_id:, **params)
77
- request('/v2/project/' + @config.application_id + '/archive', params: camelcase(params.merge(session_id: session_id)), type: Post)
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)
78
89
  end
79
90
 
80
91
  # Stop recording a specified archive.
81
92
  #
93
+ # @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
94
+ #
82
95
  # @param [required, String] archive_id
83
96
  #
84
97
  # @return [Response]
85
98
  #
86
99
  # @see TODO: add docs link
87
100
  #
88
- def stop(archive_id:)
89
- request('/v2/project/' + @config.application_id + '/archive/' + archive_id + '/stop', type: Post)
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)
90
105
  end
91
106
 
92
107
  # Delete a specified archive.
93
108
  #
109
+ # @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
110
+ #
94
111
  # @param [required, String] archive_id
95
112
  #
96
113
  # @return [Response]
97
114
  #
98
115
  # @see TODO: add docs link
99
116
  #
100
- def delete(archive_id:)
101
- request('/v2/project/' + @config.application_id + '/archive/' + archive_id, type: Delete)
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)
102
121
  end
103
122
 
104
123
  # Add a stream to a composed archive that was started with the streamMode set to "manual".
105
124
  #
125
+ # @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
126
+ #
106
127
  # @param [required, String] archive_id
107
128
  #
108
- # @param [required, String] stream_id The ID of the stream to be added
129
+ # @param [required, String] add_stream The ID of the stream to be added
109
130
  #
110
131
  # @param [optional, Boolean] has_audio
111
132
  #
@@ -115,26 +136,36 @@ module Vonage
115
136
  #
116
137
  # @see TODO: add docs link
117
138
  #
118
- def add_stream(archive_id:, stream_id:, **params)
119
- request('/v2/project/' + @config.application_id + '/archive/' + archive_id + '/streams', params: camelcase(params.merge(addStream: stream_id)), type: Patch)
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)
120
144
  end
121
145
 
122
146
  # Remove a stream from a composed archive that was started with the streamMode set to "manual".
123
147
  #
148
+ # @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
149
+ #
124
150
  # @param [required, String] archive_id
125
151
  #
126
- # @param [required, String] stream_id The ID of the stream to be removed
152
+ # @param [required, String] remove_stream The ID of the stream to be removed
127
153
  #
128
154
  # @return [Response]
129
155
  #
130
156
  # @see TODO: add docs link
131
157
  #
132
- def remove_stream(archive_id:, stream_id:)
133
- request('/v2/project/' + @config.application_id + '/archive/' + archive_id + '/streams', params: {removeStream: stream_id}, type: Patch)
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)
134
163
  end
135
164
 
136
165
  # Change the layout of a composed archive while it is being recorded.
137
166
  #
167
+ # @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
168
+ #
138
169
  # @param [required, String] archive_id
139
170
  #
140
171
  # @param [optional, String] type
@@ -147,8 +178,10 @@ module Vonage
147
178
  #
148
179
  # @see TODO: add docs link
149
180
  #
150
- def change_layout(archive_id:, **params)
151
- request('/v2/project/' + @config.application_id + '/archive/' + archive_id + '/layout', params: camelcase(params), type: Put)
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)
152
185
  end
153
186
  end
154
187
  end
@@ -0,0 +1,11 @@
1
+ # typed: true
2
+
3
+ class Vonage::Video::ListResponse < Vonage::Response
4
+ include Enumerable
5
+
6
+ def each
7
+ return enum_for(:each) unless block_given?
8
+
9
+ @entity._embedded.calls.each { |item| yield item }
10
+ end
11
+ 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
- request('/v2/project/' + @config.application_id + '/session/' + session_id + '/connection/' + connection_id, type: Delete)
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
- request('/v2/project/' + @config.application_id + '/session/' + session_id + '/stream/' + stream_id + '/mute', type: Post)
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
- request('/v2/project/' + @config.application_id + '/session/' + session_id + '/mute', params: params, type: Post)
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
+
@@ -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
- request('/v2/project/' + @config.application_id + '/session/' + session_id + '/connection/' + connection_id + '/signal', params: params, type: Post)
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
- request('/v2/project/' + @config.application_id + '/session/' + session_id + '/signal', params: params, type: Post)
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
+
@@ -22,8 +22,10 @@ module Vonage
22
22
  #
23
23
  # @see TODO: add docs link
24
24
  #
25
- def list(session_id:)
26
- request('/v2/project/' + @config.application_id + '/session/' + session_id + '/stream', response_class: ListResponse)
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
- request('/v2/project/' + @config.application_id + '/session/' + session_id + '/stream/' + stream_id)
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/' + @config.application_id + '/session/' + session_id + '/stream', params: params, type: Put)
72
+ request('/v2/project/' + application_id + '/session/' + session_id + '/stream', params: params, type: Put)
68
73
  end
69
74
  end
70
75
  end
76
+