vonage 7.16.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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -170
  3. data/lib/vonage/client.rb +4 -32
  4. data/lib/vonage/client_error.rb +1 -1
  5. data/lib/vonage/config.rb +3 -7
  6. data/lib/vonage/errors.rb +20 -37
  7. data/lib/vonage/gsm7.rb +1 -1
  8. data/lib/vonage/keys.rb +7 -1
  9. data/lib/vonage/logger.rb +3 -5
  10. data/lib/vonage/messaging/channels/viber.rb +1 -8
  11. data/lib/vonage/messaging/channels/whats_app.rb +1 -3
  12. data/lib/vonage/namespace.rb +58 -128
  13. data/lib/vonage/numbers.rb +6 -29
  14. data/lib/vonage/server_error.rb +1 -1
  15. data/lib/vonage/signature.rb +1 -1
  16. data/lib/vonage/sms.rb +20 -0
  17. data/lib/vonage/version.rb +1 -1
  18. data/lib/vonage/video/archives.rb +187 -0
  19. data/lib/vonage/video/list_response.rb +11 -0
  20. data/lib/vonage/video/moderation.rb +73 -0
  21. data/lib/vonage/video/signals.rb +55 -0
  22. data/lib/vonage/video/streams.rb +76 -0
  23. data/lib/vonage/video.rb +91 -0
  24. data/lib/vonage/voice/actions/connect.rb +3 -27
  25. data/lib/vonage/voice/actions/pay.rb +107 -0
  26. data/lib/vonage/voice/actions/talk.rb +2 -11
  27. data/lib/vonage/voice/talk.rb +1 -11
  28. data/lib/vonage/voice.rb +0 -11
  29. data/lib/vonage.rb +0 -1
  30. data/vonage.gemspec +1 -2
  31. metadata +14 -59
  32. data/lib/vonage/api_error.rb +0 -33
  33. data/lib/vonage/meetings/applications.rb +0 -25
  34. data/lib/vonage/meetings/dial_in_numbers/list_response.rb +0 -11
  35. data/lib/vonage/meetings/dial_in_numbers.rb +0 -23
  36. data/lib/vonage/meetings/recordings.rb +0 -36
  37. data/lib/vonage/meetings/rooms/list_response.rb +0 -11
  38. data/lib/vonage/meetings/rooms.rb +0 -155
  39. data/lib/vonage/meetings/sessions/list_response.rb +0 -11
  40. data/lib/vonage/meetings/sessions.rb +0 -28
  41. data/lib/vonage/meetings/themes/list_response.rb +0 -11
  42. data/lib/vonage/meetings/themes.rb +0 -218
  43. data/lib/vonage/meetings.rb +0 -38
  44. data/lib/vonage/proactive_connect/events/list_response.rb +0 -11
  45. data/lib/vonage/proactive_connect/events.rb +0 -68
  46. data/lib/vonage/proactive_connect/item.rb +0 -104
  47. data/lib/vonage/proactive_connect/items/file_response.rb +0 -32
  48. data/lib/vonage/proactive_connect/items/list_response.rb +0 -11
  49. data/lib/vonage/proactive_connect/items.rb +0 -107
  50. data/lib/vonage/proactive_connect/list.rb +0 -168
  51. data/lib/vonage/proactive_connect/lists/list_response.rb +0 -11
  52. data/lib/vonage/proactive_connect/lists.rb +0 -35
  53. data/lib/vonage/proactive_connect.rb +0 -33
  54. data/lib/vonage/subaccounts/balance_transfers/list_response.rb +0 -11
  55. data/lib/vonage/subaccounts/credit_transfers/list_response.rb +0 -11
  56. data/lib/vonage/subaccounts/list_response.rb +0 -15
  57. data/lib/vonage/subaccounts.rb +0 -203
  58. data/lib/vonage/users/list_response.rb +0 -11
  59. data/lib/vonage/users.rb +0 -156
  60. data/lib/vonage/verify2/channels/email.rb +0 -38
  61. data/lib/vonage/verify2/channels/silent_auth.rb +0 -32
  62. data/lib/vonage/verify2/channels/sms.rb +0 -39
  63. data/lib/vonage/verify2/channels/voice.rb +0 -32
  64. data/lib/vonage/verify2/channels/whats_app.rb +0 -38
  65. data/lib/vonage/verify2/channels/whats_app_interactive.rb +0 -32
  66. data/lib/vonage/verify2/start_verification_options.rb +0 -71
  67. data/lib/vonage/verify2/workflow.rb +0 -39
  68. data/lib/vonage/verify2/workflow_builder.rb +0 -25
  69. data/lib/vonage/verify2.rb +0 -93
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c55251a1296c1c7e13ef6a3f491868be1d21c3b43905f21f3042c1901b2bef23
4
- data.tar.gz: d9ed23ef4f8b1e8a6a25bc4c72e904b9ffa7b2b622b60a1afd8369f1268b253f
3
+ metadata.gz: e003a6ed3211d3eace84884bf3fb03d21b81f097b13aba079f1906daf95380ff
4
+ data.tar.gz: 956c6921b50df45aaf2f1901b08ccd3cb164c2553b23d8e45570f63dcdf6f960
5
5
  SHA512:
6
- metadata.gz: 5ee43b28d5fad08043d51e30b4093939717dd3786e5ed1a85086d16bd3b88aec2535d957fdef93801ede173ec4b447d96ef504ed95f5dff6a1d2f3425f0dd013
7
- data.tar.gz: ac4727ee0577c863d4f2cb181003b0b67b3bc78e6b9b43e66da89a402d401e2459198ba336ace27e1588b9d2f7ecf67f157b30918fd56ab8b6a48cc63581e0d7
6
+ metadata.gz: 1500879cd4a974009f6510cf12ea15b4ce60a9163f916b8a5e07fe785323c24c6909134163b21e29afc9c251550fd36a9e348c2ff7eac3b18b45f0e4ef7e1be1
7
+ data.tar.gz: fe368d23b897a7f1b2b9ba473c993a351ffb1233ef80304c16ec69ed28692c93e422c7a453f8d0da14b6e038424c215026a945d7ccee9b4a26412e3ecbe5435f
data/README.md CHANGED
@@ -12,14 +12,11 @@ need a Vonage account. Sign up [for free at vonage.com][signup].
12
12
  * [Installation](#installation)
13
13
  * [Usage](#usage)
14
14
  * [Logging](#logging)
15
- * [Exceptions](#exceptions)
16
15
  * [Overriding the default hosts](#overriding-the-default-hosts)
17
16
  * [JWT authentication](#jwt-authentication)
18
17
  * [Webhook signatures](#webhook-signatures)
19
18
  * [Pagination](#pagination)
20
19
  * [NCCO Builder](#ncco-builder)
21
- * [Messages API](#messages-api)
22
- * [Verify API v2](#verify-api-v2)
23
20
  * [Documentation](#documentation)
24
21
  * [Frequently Asked Questions](#frequently-asked-questions)
25
22
  * [Supported APIs](#supported-apis)
@@ -83,46 +80,6 @@ By default the library sets the logger to `Rails.logger` if it is defined.
83
80
 
84
81
  To disable logging set the logger to `nil`.
85
82
 
86
- ## Exceptions
87
-
88
- Where exceptions result from an error response from the Vonage API (HTTP responses that aren't ion the range `2xx` or `3xx`), the `Net::HTTPResponse` object will be available as a property of the `Exception` object via a `http_response` getter method (where there is no `Net::HTTPResponse` object associated with the exception, the value of `http_response` will be `nil`).
89
-
90
- You can rescue the the exception to access the `http_response`, as well as use other getters provided for specific parts of the response. For example:
91
-
92
- ```ruby
93
- begin
94
- verification_request = client.verify2.start_verification(
95
- brand: 'Acme',
96
- workflow: [{channel: 'sms', to: '44700000000'}]
97
- )
98
- rescue Vonage::APIError => error
99
- if error.http_response
100
- error.http_response # => #<Net::HTTPUnauthorized 401 Unauthorized readbody=true>
101
- error.http_response_code # => "401"
102
- error.http_response_headers # => {"date"=>["Sun, 24 Sep 2023 11:08:47 GMT"], ...rest of headers}
103
- error.http_response_body # => {"title"=>"Unauthorized", ...rest of body}
104
- end
105
- end
106
- ```
107
-
108
- For certain legacy API products, such as the [SMS API](https://developer.vonage.com/en/messaging/sms/overview), [Verify v1 API](https://developer.vonage.com/en/verify/verify-v1/overview) and [Number Insight v1 API](https://developer.vonage.com/en/number-insight/overview), a `200` response is received even in situations where there is an API-related error. For exceptions raised in these situation, rather than a `Net::HTTPResponse` object, a `Vonage::Response` object will be made available as a property of the exception via a `response` getter method. The properties on this object will depend on the response data provided by the API endpoint. For example:
109
-
110
- ```ruby
111
- begin
112
- sms = client.sms.send(
113
- from: 'Vonage',
114
- to: '44700000000',
115
- text: 'Hello World!'
116
- )
117
- rescue Vonage::Error => error
118
- if error.is_a? Vonage::ServiceError
119
- error.response # => #<Vonage::Response:0x0000555b2e49d4f8>
120
- error.response.messages.first.status # => "4"
121
- error.response.messages.first.error_text # => "Bad Credentials"
122
- error.response.http_response # => #<Net::HTTPOK 200 OK readbody=true>
123
- end
124
- end
125
- ```
126
83
 
127
84
  ## Overriding the default hosts
128
85
 
@@ -263,136 +220,11 @@ Once the message data is created, you can then send the message.
263
220
  response = client.messaging.send(to: "447700900000", from: "447700900001", **message)
264
221
  ```
265
222
 
266
- ## Verify API v2
267
-
268
- The [Vonage Verify API v2](https://developer.vonage.com/en/verify/verify-v2/overview) allows you to manage 2FA verification workflows over a number of different channels such as SMS, WhatsApp, WhatsApp Interactive, Voice, Email, and Silent Authentication, either individually or in combination with each other. See the Vonage Developer Documentation for a [complete API reference](https://developer.vonage.com/en/api/verify.v2) listing all the channels, verification options, and callback types.
269
-
270
- The Ruby SDK provides two methods for interacting with the Verify v2 API:
271
-
272
- - `Verify2#start_verification`: starts a new verification request. Here you can specify options for the request and the workflow to be used.
273
- - `Verify2#check_code`: for channels where the end-user is sent a one-time code, this method is used to verify the code against the `request_id` of the verification request created by the `start_verification` method.
274
-
275
- ### Creating a Verify2 Object
276
-
277
- ```ruby
278
- verify = client.verify2
279
- ```
280
-
281
- ### Making a verification request
282
-
283
- For simple requests, you may prefer to manually set the value for `workflow` (an array of one or more hashes containing the settings for a particular channel) and any optional params.
284
-
285
- Example with the required `:brand` and `:workflow` arguments:
286
-
287
- ```ruby
288
- verification_request = verify.start_verification(
289
- brand: 'Acme',
290
- workflow: [{channel: 'sms', to: '447000000000'}]
291
- )
292
- ```
293
-
294
- Example with the required `:brand` and `:workflow` arguments, and an optional `code_length`:
295
-
296
- ```ruby
297
- verification_request = verify.start_verification(
298
- brand: 'Acme',
299
- workflow: [{channel: 'sms', to: '447000000000'}],
300
- code_length: 6
301
- )
302
- ```
303
-
304
- For more complex requests (e.g. with mutliple workflow channels or addtional options), or to take advantage of built-in input validation, you can use the `StartVerificationOptions` object and the `Workflow` and various channel objects or the `WorkflowBuilder`:
305
-
306
- #### Create options using StartVerificationOptions object
307
-
308
- ```ruby
309
- opts = verify.start_verification_options(
310
- locale: 'fr-fr',
311
- code_length: 6,
312
- client_ref: 'abc-123'
313
- ).to_h
314
-
315
- verification_request = verify.start_verification(
316
- brand: 'Acme',
317
- workflow: [{channel: 'email', to: 'alice.example.com'}],
318
- **opts
319
- )
320
- ```
321
-
322
- #### Create workflow using Workflow and Channel objects
323
-
324
- ```ruby
325
- # Instantiate a Workflow object
326
- workflow = verify.workflow
327
-
328
- # Add channels to the workflow
329
- workflow << workflow.sms(to: '447000000000')
330
- workflow << workflow.email(to: 'alice.example.com')
331
-
332
- # Channel data is encpsulated in channel objects stored in the Workflow list array
333
- workflow.list
334
- # => [ #<Vonage::Verify2::Channels::SMS:0x0000561474a74778 @channel="sms", @to="447000000000">,
335
- #<Vonage::Verify2::Channels::Email:0x0000561474c51a28 @channel="email", @to="alice.example.com">]
336
-
337
- # To use the list as the value for `:workflow` in a `start_verification` request call,
338
- # the objects must be hashified
339
- workflow_list = workflow.hashified_list
340
- # => [{:channel=>"sms", :to=>"447000000000"}, {:channel=>"email", :to=>"alice.example.com"}]
341
-
342
- verification_request = verify.start_verification(brand: 'Acme', workflow: workflow_list)
343
- ```
344
-
345
- #### Create a workflow using the WorkflowBuilder
346
-
347
- ```ruby
348
- workflow = verify.workflow_builder.build do |builder|
349
- builder.add_voice(to: '447000000001')
350
- builder.add_whatsapp(to: '447000000000')
351
- end
352
-
353
- workflow_list = workflow.hashified_list
354
- # => [{:channel=>"voice", :to=>"447000000001"}, {:channel=>"whatsapp", :to=>"447000000000"}]
355
-
356
- verification_request = verify.start_verification(brand: 'Acme', workflow: workflow_list)
357
- ```
358
-
359
- ### Cancelling a request
360
-
361
- You can cancel in in-progress verification request
362
-
363
- ```ruby
364
- # Get the `request_id` from the Vonage#Response object returned by the `start_verification` method call
365
- request_id = verification_request.request_id
366
-
367
- verify.cancel_verification_request(request_id: request_id)
368
- ```
369
-
370
- ### Checking a code
371
-
372
- ```ruby
373
- # Get the `request_id` from the Vonage#Response object returned by the `start_verification` method call
374
- request_id = verification_request.request_id
375
-
376
- # Get the one-time code via user input
377
- # e.g. from params in a route handler or controller action for a form input
378
- code = params[:code]
379
-
380
- begin
381
- code_check = verify.check_code(request_id: request_id, code: code)
382
- rescue => error
383
- # an invalid code will raise an exception of type Vonage::ClientError
384
- end
385
-
386
- if code_check.http_response.code == '200'
387
- # code is valid
388
- end
389
- ```
390
-
391
223
  ## Documentation
392
224
 
393
225
  Vonage Ruby documentation: https://www.rubydoc.info/github/Vonage/vonage-ruby-sdk
394
226
 
395
- Vonage Ruby code examples: https://github.com/Vonage/vonage-ruby-code-snippets
227
+ Vonage Ruby code examples: https://github.com/Nexmo/nexmo-ruby-code-snippets
396
228
 
397
229
  Vonage APIs API reference: https://developer.nexmo.com/api
398
230
 
@@ -420,7 +252,6 @@ The following is a list of Vonage APIs and whether the Ruby SDK provides support
420
252
  | Reports API | Beta |❌|
421
253
  | SMS API | General Availability |✅|
422
254
  | Verify API | General Availability |✅|
423
- | Verify API v2 | General Availability |✅|
424
255
  | Voice API | General Availability |✅|
425
256
 
426
257
  ## License
data/lib/vonage/client.rb CHANGED
@@ -61,13 +61,6 @@ module Vonage
61
61
  @files ||= T.let(Files.new(config), T.nilable(Vonage::Files))
62
62
  end
63
63
 
64
- # @return [Meetings]
65
- #
66
- sig { returns(T.nilable(Vonage::Meetings)) }
67
- def meetings
68
- @meetings ||= T.let(Meetings.new(config), T.nilable(Vonage::Meetings))
69
- end
70
-
71
64
  # @return [Messages]
72
65
  #
73
66
  sig { returns(T.nilable(Vonage::Messages)) }
@@ -103,13 +96,6 @@ module Vonage
103
96
  @pricing ||= T.let(PricingTypes.new(config), T.nilable(Vonage::PricingTypes))
104
97
  end
105
98
 
106
- # @return [ProactiveConnect]
107
- #
108
- sig { returns(T.nilable(Vonage::ProactiveConnect)) }
109
- def proactive_connect
110
- @proactive_connect ||= T.let(ProactiveConnect.new(config), T.nilable(Vonage::ProactiveConnect))
111
- end
112
-
113
99
  # @return [Redact]
114
100
  #
115
101
  sig { returns(T.nilable(Vonage::Redact)) }
@@ -131,13 +117,6 @@ module Vonage
131
117
  @sms ||= T.let(SMS.new(config), T.nilable(Vonage::SMS))
132
118
  end
133
119
 
134
- # @return [Subaccounts]
135
- #
136
- sig { returns(T.nilable(Vonage::Subaccounts)) }
137
- def subaccounts
138
- @subaccounts ||= T.let(Subaccounts.new(config), T.nilable(Vonage::Subaccounts))
139
- end
140
-
141
120
  # @return [TFA]
142
121
  #
143
122
  sig { returns(T.nilable(Vonage::TFA)) }
@@ -145,13 +124,6 @@ module Vonage
145
124
  @tfa ||= T.let(TFA.new(config), T.nilable(Vonage::TFA))
146
125
  end
147
126
 
148
- # @return [Users]
149
- #
150
- sig { returns(T.nilable(Vonage::Users)) }
151
- def users
152
- @users ||= T.let(Users.new(config), T.nilable(Vonage::Users))
153
- end
154
-
155
127
  # @return [Verify]
156
128
  #
157
129
  sig { returns(T.nilable(Vonage::Verify)) }
@@ -159,11 +131,11 @@ module Vonage
159
131
  @verify ||= T.let(Verify.new(config), T.nilable(Vonage::Verify))
160
132
  end
161
133
 
162
- # @return [Verify2]
134
+ # @return [Video]
163
135
  #
164
- sig { returns(T.nilable(Vonage::Verify2)) }
165
- def verify2
166
- @verify2 ||= T.let(Verify2.new(config), T.nilable(Vonage::Verify2))
136
+ sig { returns(T.nilable(Vonage::Video)) }
137
+ def video
138
+ @video ||= T.let(Video.new(config), T.nilable(Vonage::Video))
167
139
  end
168
140
 
169
141
  # @return [Voice]
@@ -1,6 +1,6 @@
1
1
  # typed: strong
2
2
 
3
3
  module Vonage
4
- class ClientError < APIError
4
+ class ClientError < Error
5
5
  end
6
6
  end
data/lib/vonage/config.rb CHANGED
@@ -18,7 +18,7 @@ module Vonage
18
18
  self.signature_secret = ENV['VONAGE_SIGNATURE_SECRET']
19
19
  self.signature_method = ENV['VONAGE_SIGNATURE_METHOD'] || 'md5hash'
20
20
  self.token = T.let(nil, T.nilable(String))
21
- self.vonage_host = 'api-eu.vonage.com'
21
+ self.video_host = 'video.api.vonage.com'
22
22
  end
23
23
 
24
24
  # Merges the config with the given options hash.
@@ -130,11 +130,7 @@ module Vonage
130
130
 
131
131
  # @return [Vonage::Logger]
132
132
  #
133
- sig { params(logger: T.nilable(
134
- defined?(ActiveSupport::BroadcastLogger) ?
135
- T.any(::Logger, Vonage::Logger, ActiveSupport::BroadcastLogger)
136
- : T.any(::Logger, Vonage::Logger)
137
- )).returns(T.nilable(Vonage::Logger)) }
133
+ sig { params(logger: T.nilable(T.any(::Logger, Vonage::Logger))).returns(T.nilable(Vonage::Logger)) }
138
134
  def logger=(logger)
139
135
  @logger = T.let(Logger.new(logger), T.nilable(Vonage::Logger))
140
136
  end
@@ -204,7 +200,7 @@ module Vonage
204
200
  attr_writer :token
205
201
 
206
202
  sig { returns(String) }
207
- attr_accessor :vonage_host
203
+ attr_accessor :video_host
208
204
 
209
205
  protected
210
206
 
data/lib/vonage/errors.rb CHANGED
@@ -1,25 +1,14 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
- require "json"
3
+ require 'json'
4
4
 
5
5
  module Vonage
6
6
  module Errors
7
7
  extend T::Sig
8
8
 
9
- sig do
10
- params(
11
- response:
12
- T.any(
13
- Net::HTTPUnauthorized,
14
- Net::HTTPClientError,
15
- Net::HTTPServerError,
16
- T.untyped
17
- )
18
- ).returns(Vonage::Error)
19
- end
9
+ sig {params(response: T.any(Net::HTTPUnauthorized, Net::HTTPClientError, Net::HTTPServerError, T.untyped)).returns(Vonage::Error)}
20
10
  def self.parse(response)
21
- exception_class =
22
- case response
11
+ exception_class = case response
23
12
  when Net::HTTPUnauthorized
24
13
  AuthenticationError
25
14
  when Net::HTTPClientError
@@ -27,40 +16,34 @@ module Vonage
27
16
  when Net::HTTPServerError
28
17
  ServerError
29
18
  else
30
- APIError
19
+ Error
31
20
  end
32
21
 
33
- message = response.content_type.to_s.include?("json") ? set_message(response) : ""
34
-
35
- exception_class.new(message, http_response: response)
36
- end
37
-
38
- def self.set_message(response)
39
- hash = ::JSON.parse(response.body)
40
-
41
- if hash.key?("error_title")
42
- hash["error_title"]
43
- elsif hash.key?("error-code-label")
44
- hash["error-code-label"]
45
- elsif hash.key?("description")
46
- hash["description"]
47
- elsif hash.key?("message")
48
- hash["message"]
49
- elsif problem_details?(hash)
50
- problem_details_message(hash)
51
- else
52
- ""
22
+ message = if response.content_type == 'application/json'
23
+ hash = ::JSON.parse(response.body)
24
+
25
+ if hash.key?('error_title')
26
+ hash['error_title']
27
+ elsif hash.key?('error-code-label')
28
+ hash['error-code-label']
29
+ elsif hash.key?('description')
30
+ hash['description']
31
+ elsif problem_details?(hash)
32
+ problem_details_message(hash)
33
+ end
53
34
  end
35
+
36
+ exception_class.new(message)
54
37
  end
55
38
 
56
39
  sig { params(hash: T::Hash[String, T.untyped]).returns(T::Boolean) }
57
40
  def self.problem_details?(hash)
58
- hash.key?("title") && hash.key?("detail") && hash.key?("type")
41
+ hash.key?('title') && hash.key?('detail') && hash.key?('type')
59
42
  end
60
43
 
61
44
  sig { params(hash: T::Hash[String, T.untyped]).returns(String) }
62
45
  def self.problem_details_message(hash)
63
- "#{hash["title"]}. #{hash["detail"]} See #{hash["type"]} for more info, or email support@vonage.com if you have any questions."
46
+ "#{hash['title']}. #{hash['detail']} See #{hash['type']} for more info, or email support@nexmo.com if you have any questions."
64
47
  end
65
48
  end
66
49
 
data/lib/vonage/gsm7.rb CHANGED
@@ -4,7 +4,7 @@ module Vonage
4
4
  module GSM7
5
5
  extend T::Sig
6
6
 
7
- CHARACTERS = "\n\f\r !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~ ¡£¤¥§¿ÄÅÆÇÉÑÖØÜßàäåæèéìñòöøùüΓΔΘΛΞΠΣΦΨΩ€"
7
+ CHARACTERS = "\n\f\r !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~ ¡£¤¥§¿ÄÅÆÉÑÖØÜßàäåæçèéìñòöøùüΓΔΘΛΞΠΣΦΨΩ€"
8
8
 
9
9
  REGEXP = /\A[#{Regexp.escape(CHARACTERS)}]*\z/
10
10
 
data/lib/vonage/keys.rb CHANGED
@@ -21,7 +21,13 @@ module Vonage
21
21
  'voice_callback_value',
22
22
  'voice_status_callback',
23
23
  'messages_callback_value',
24
- 'messages_callback_type'
24
+ 'messages_callback_type',
25
+ 'add_stream',
26
+ 'has_audio',
27
+ 'has_video',
28
+ 'remove_stream',
29
+ 'screenshare_type',
30
+ 'archive_mode'
25
31
  ]
26
32
  hash.transform_keys do |k|
27
33
  if exceptions.include?(k.to_s)
data/lib/vonage/logger.rb CHANGED
@@ -7,11 +7,7 @@ module Vonage
7
7
  class Logger
8
8
  extend T::Sig
9
9
 
10
- sig { params(logger: T.nilable(
11
- defined?(ActiveSupport::BroadcastLogger) ?
12
- T.any(::Logger, Vonage::Logger, ActiveSupport::BroadcastLogger)
13
- : T.any(::Logger, Vonage::Logger)
14
- )).void }
10
+ sig { params(logger: T.nilable(T.any(::Logger, Vonage::Logger))).void }
15
11
  def initialize(logger)
16
12
  @logger = logger || ::Logger.new(nil)
17
13
  end
@@ -24,6 +20,8 @@ module Vonage
24
20
 
25
21
  sig { params(request: T.any(Net::HTTP::Post, Net::HTTP::Get, Net::HTTP::Delete, Net::HTTP::Put, Net::HTTP::Patch)).void }
26
22
  def log_request_info(request)
23
+ @logger = T.let(@logger, T.nilable(T.any(::Logger, Vonage::Logger)))
24
+
27
25
  T.must(@logger).info do
28
26
  format('Vonage API request', {
29
27
  method: request.method,
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Vonage
4
4
  class Messaging::Channels::Viber < Messaging::Message
5
- MESSAGE_TYPES = ['text', 'image', 'video', 'file']
5
+ MESSAGE_TYPES = ['text', 'image']
6
6
 
7
7
  attr_reader :data
8
8
 
@@ -33,13 +33,6 @@ module Vonage
33
33
  when 'image'
34
34
  raise Vonage::ClientError.new(":message must be a Hash") unless message.is_a? Hash
35
35
  raise Vonage::ClientError.new(":url is required in :message") unless message[:url]
36
- when 'video'
37
- raise Vonage::ClientError.new(":message must be a Hash") unless message.is_a? Hash
38
- raise Vonage::ClientError.new(":url is required in :message") unless message[:url]
39
- raise Vonage::ClientError.new(":thumb_url is required in :message") unless message[:thumb_url]
40
- when 'file'
41
- raise Vonage::ClientError.new(":message must be a Hash") unless message.is_a? Hash
42
- raise Vonage::ClientError.new(":url is required in :message") unless message[:url]
43
36
  end
44
37
  end
45
38
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Vonage
4
4
  class Messaging::Channels::WhatsApp < Messaging::Message
5
- MESSAGE_TYPES = ['text', 'image', 'audio', 'video', 'file', 'template', 'sticker', 'custom']
5
+ MESSAGE_TYPES = ['text', 'image', 'audio', 'video', 'file', 'template', 'custom']
6
6
 
7
7
  attr_reader :data
8
8
 
@@ -35,8 +35,6 @@ module Vonage
35
35
  raise Vonage::ClientError.new(":name is required in :template") unless message[:name]
36
36
  raise Vonage::ClientError.new(":whatsapp is required in :opts") unless opts[:whatsapp]
37
37
  raise Vonage::ClientError.new(":locale is required in :whatsapp") unless opts[:whatsapp][:locale]
38
- when 'sticker'
39
- raise Vonage::ClientError.new(":message must contain either :id or :url") unless message.has_key?(:id) ^ message.has_key?(:url)
40
38
  when 'custom'
41
39
  raise Vonage::ClientError.new(":message must be a Hash") unless message.is_a? Hash
42
40
  else