vonage 7.23.0 → 7.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36d57526fb0ed81a986a2125a5ed5ebdb3152160cc1666f263772aac023177b1
4
- data.tar.gz: b71dc43bcf08ae0b7e5b5a1f788d918ed57d1037e31008e9bceb1bdd3ac16a2c
3
+ metadata.gz: dd59189827b061987ec3ef8e6b580ed7a0d5dba1513fd19a16bd01b223c64a88
4
+ data.tar.gz: beb8f428da0682a0a4342ecbde7e9ef0113137afa904ec4a70d1bc2d18ceae9c
5
5
  SHA512:
6
- metadata.gz: bbfaf5dab47afb432987729162f803cc505f3359eb5fed530104e7c6877bd3e4ffadd0415ce2281004d6a160a6a26b0e18126edf16c204ec12661dd2448c8766
7
- data.tar.gz: a1d2607e0a78ccad0e6239db088158a448d506fe93a18c838912e0fb53831729b4fe5d3b1472eb33d1fec67b166e3967adb76e95a7f7857b7945b30f6426e73f
6
+ metadata.gz: 7d2d13f1f765ad39173e55c8f029308bba5d4fade7a30458828dd4c2dcddb9c2f6207dca291e7497af744d70f85471cf46de4d86ad103b871963989c624285d8
7
+ data.tar.gz: 0ca1d89cea36c1e71fe136b86b83de92b7d719fc06c4559caef3b5393df20c40155e28a0666b126382694bbdf8d4a544a784a5844f22311b939c6cde7d2f682d
data/lib/vonage/keys.rb CHANGED
@@ -29,7 +29,12 @@ module Vonage
29
29
  'screenshare_type',
30
30
  'session_id',
31
31
  'stream_mode',
32
- 'archive_mode'
32
+ 'archive_mode',
33
+ 'language_code',
34
+ 'max_duration',
35
+ 'partial_captions',
36
+ 'status_callback_url',
37
+ 'audio_rate'
33
38
  ]
34
39
  hash.transform_keys do |k|
35
40
  if exceptions.include?(k.to_s)
@@ -1,16 +1,21 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
+ require 'forwardable'
3
4
 
4
5
  module Vonage
5
6
  class Messaging < Namespace
7
+ extend Forwardable
8
+
6
9
  self.authentication = BearerToken
7
10
 
8
11
  self.request_body = JSON
9
12
 
13
+ def_delegators Message, *Message::CHANNELS.keys
14
+
10
15
  # Send a Message.
11
16
  #
12
17
  # @example
13
- # message = Vonage::Messaging::Message.sms(message: "Hello world!")
18
+ # message = client.messaging.sms(message: "Hello world!")
14
19
  # response = client.messaging.send(to: "447700900000", from: "447700900001", **message)
15
20
  #
16
21
  # @option params [required, String] :to
@@ -22,8 +27,8 @@ module Vonage
22
27
  #
23
28
  # @see https://developer.vonage.com/api/messages-olympus#SendMessage
24
29
  #
25
- def send(params)
26
- request('/v1/messages', params: params, type: Post)
30
+ def send(to:, from:, **message)
31
+ request('/v1/messages', params: {to: to, from: from, **message}, type: Post)
27
32
  end
28
33
 
29
34
  # Validate a JSON Web Token from a Messages API Webhook.
@@ -1,5 +1,5 @@
1
1
  # typed: strong
2
2
 
3
3
  module Vonage
4
- VERSION = '7.23.0'
4
+ VERSION = '7.24.0'
5
5
  end
@@ -0,0 +1,67 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module Vonage
5
+ class Video::Captions < Namespace
6
+ include Keys
7
+
8
+ self.authentication = BearerToken
9
+
10
+ self.request_body = JSON
11
+
12
+ self.host = :video_host
13
+
14
+ # Start Live Captions for a Vonage Video stream
15
+ #
16
+ # @example
17
+ # response = client.video.captions.start(
18
+ # session_id: "12312312-3811-4726-b508-e41a0f96c68f",
19
+ # token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJp...",
20
+ # language_code: 'en-US',
21
+ # max_duration: 300,
22
+ # partial_captions: false,
23
+ # status_callback_url: 'https://example.com/captions/status'
24
+ # )
25
+ #
26
+ # @params [required, String] :session_id The id of the session to start captions for
27
+ #
28
+ # @param [required, String] :token A valid Vonage Video token with role set to 'moderator'
29
+ #
30
+ # @params [optional, String] :language_code The BCP-47 code for a spoken language used on this call. The default value is "en-US"
31
+ # - Must be one of: 'en-US', 'en-AU', 'en-GB', 'zh-CN', 'fr-FR', 'fr-CA', 'de-DE', 'hi-IN', 'it-IT', 'ja-JP', 'ko-KR', 'pt-BR', 'th-TH'
32
+ #
33
+ # @param [optional, Integer] :max_duration The maximum duration for the audio captioning, in seconds.
34
+ # - The default value is 14,400 seconds (4 hours), the maximum duration allowed.
35
+ # - The minimum value for maxDuration is 300 (300 seconds, or 5 minutes).
36
+ #
37
+ # @param [optional, Boolean] :partial_captions Whether to enable this to faster captioning (true, the default) at the cost of some degree of inaccuracies.
38
+ #
39
+ # @param [optional, String] :status_callback_url The URL to send the status of the captions to.
40
+ #
41
+ # @return [Response]
42
+ #
43
+ # @see TODO: Add document link here
44
+ #
45
+ def start(session_id:, token:, **params)
46
+ request(
47
+ '/v2/project/' + @config.application_id + '/captions',
48
+ params: camelcase(params.merge({sessionId: session_id, token: token})),
49
+ type: Post)
50
+ end
51
+
52
+ # Stop live captions for a session
53
+ #
54
+ # @example
55
+ # response = client.video.captions.stop(captions_id: "7c0580fc-6274-4de5-a66f-d0648e8d3ac3")
56
+ #
57
+ # @params [required, String] :captions_id ID of the connection used for captions
58
+ #
59
+ # @return [Response]
60
+ #
61
+ # @see TODO: Add document link here
62
+ #
63
+ def stop(captions_id:)
64
+ request('/v2/project/' + @config.application_id + '/captions/' + captions_id + '/stop', type: Post)
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,11 @@
1
+ # typed: true
2
+
3
+ class Vonage::Video::Renders::ListResponse < Vonage::Response
4
+ include Enumerable
5
+
6
+ def each
7
+ return enum_for(:each) unless block_given?
8
+
9
+ @entity.items.each { |item| yield item }
10
+ end
11
+ end
@@ -0,0 +1,107 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module Vonage
5
+ class Video::Renders < Namespace
6
+ include Keys
7
+
8
+ self.authentication = BearerToken
9
+
10
+ self.request_body = JSON
11
+
12
+ self.host = :video_host
13
+
14
+ # Start an Experience Composer Render
15
+ #
16
+ # @example
17
+ # response = client.video.renders.start(
18
+ # session_id: "12312312-3811-4726-b508-e41a0f96c68f",
19
+ # token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJp...",
20
+ # url: 'https://example.com/',
21
+ # max_duration: 1800,
22
+ # resolution: '1280x720',
23
+ # properties: {
24
+ # name: 'foo'
25
+ # }
26
+ # )
27
+ #
28
+ # @params [required, String] :session_id The session ID of the Vonage Video session you are working with.
29
+ #
30
+ # @param [required, String] :token A valid OpenTok JWT token with a Publisher role and (optionally) connection data to be associated with the output stream.
31
+ #
32
+ # @params [required, String] :url A publicly reachable URL controlled by the customer and capable of generating the content to be rendered without user intervention.
33
+ #
34
+ # @params [optional, Integer] :max_duration The maximum duration of the rendered video in seconds.
35
+ # - After this time, it is stopped automatically, if it is still running.
36
+ # - Min: 60
37
+ # - Max: 3600
38
+ # - Default: 3600
39
+ #
40
+ # @params [optional, String] :resolution The resolution of the Experience Composer render.
41
+ # - Must be one of: '640x480', '480x640', '1280x720', '720x1280', '1080x1920', '1920x1080'
42
+ #
43
+ # @params [optional, Hash] :properties The initial configuration of Publisher properties for the composed output stream.
44
+ # @option properties [required, String] :name The name of the composed output stream which is published to the session.
45
+ #
46
+ # @return [Response]
47
+ #
48
+ # @see TODO: Add document link here
49
+ #
50
+ def start(session_id:, token:, url:, **params)
51
+ request(
52
+ '/v2/project/' + @config.application_id + '/render',
53
+ params: camelcase(params.merge({sessionId: session_id, token: token, url: url})),
54
+ type: Post)
55
+ end
56
+
57
+ # Stop an Experience Composer render
58
+ #
59
+ # @example
60
+ # response = client.video.renders.stop(experience_composer_id: "1248e7070b81464c9789f46ad10e7764")
61
+ #
62
+ # @params [required, String] :experience_composer_id ID of the Experience Composer instance that you want to stop.
63
+ #
64
+ # @return [Response]
65
+ #
66
+ # @see TODO: Add document link here
67
+ #
68
+ def stop(experience_composer_id:)
69
+ request('/v2/project/' + @config.application_id + '/render/' + experience_composer_id, type: Delete)
70
+ end
71
+
72
+ # Get information about an Experience Composer session
73
+ #
74
+ # @example
75
+ # response = client.video.renders.info(experience_composer_id: "1248e7070b81464c9789f46ad10e7764")
76
+ #
77
+ # @params [required, String] :experience_composer_id ID of the Experience Composer instance for which you are requesitng information.
78
+ #
79
+ # @return [Response]
80
+ #
81
+ # @see TODO: Add document link here
82
+ #
83
+ def info(experience_composer_id:)
84
+ request('/v2/project/' + @config.application_id + '/render/' + experience_composer_id)
85
+ end
86
+
87
+ # List all Experience Composer renders in an application
88
+ #
89
+ # @example
90
+ # response = client.video.renders.list
91
+ #
92
+ # @params [optional, Integer] :offset Specify the index offset of the first experience composer. 0 is offset of the most recently started render.
93
+ #
94
+ # @params [optional, Integer] :count Limit the number of experience composers to be returned.
95
+ #
96
+ # @return [Video::Renders::ListResponse]
97
+ #
98
+ # @see TODO: Add document link here
99
+ #
100
+ def list(**params)
101
+ path = '/v2/project/' + @config.application_id + '/render'
102
+ path += "?#{Params.encode(camelcase(params))}" unless params.empty?
103
+
104
+ request(path, response_class: ListResponse)
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,61 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module Vonage
5
+ class Video::WebSocket < Namespace
6
+ include Keys
7
+
8
+ self.authentication = BearerToken
9
+
10
+ self.request_body = JSON
11
+
12
+ self.host = :video_host
13
+
14
+ # Start an audio connector websocket connection
15
+ #
16
+ # @example
17
+ # response = client.video.web_socket.connect(
18
+ # session_id: "12312312-3811-4726-b508-e41a0f96c68f",
19
+ # token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJp...",
20
+ # websocket: {
21
+ # uri: 'wss://example.com/ws-endpoint',
22
+ # streams: ["8b732909-0a06-46a2-8ea8-074e64d43422"],
23
+ # headers: { property1: 'foo', property2: 'bar' },
24
+ # audio_rate: 16000
25
+ # }
26
+ # )
27
+ #
28
+ # @params [required, String] :session_id The Vonage Video session ID that includes the Vonage Video streams you want to include in the WebSocket stream.
29
+ # - The Audio Connector feature is only supported in routed sessions
30
+ #
31
+ # @param [required, String] :token A valid Vonage Video token for the Audio Connector connection to the Vonage Video Session.
32
+ # - You can add additional data to the JWT to identify that the connection is the Audio Connector endpoint or for any other identifying data.
33
+ #
34
+ # @params [required, Hash] :websocket The WebSocket configuration for the Audio Connector connection.
35
+ # @option websocket [required, String] :uri A publicly reachable WebSocket URI to be used for the destination of the audio stream
36
+ # @option websocket [optional, String] :streams An array of stream IDs for the Vonage Video streams you want to include in the WebSocket audio.
37
+ # - If you omit this property, all streams in the session will be included.
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
+ # @option websocket [optional, Integer] :audio_rate A number representing the audio sampling rate in Hz
40
+ # - Must be one of: 8000, 16000
41
+ #
42
+ # @return [Response]
43
+ #
44
+ # @see TODO: Add document link here
45
+ #
46
+ def connect(session_id:, token:, websocket:)
47
+ raise ArgumentError, 'websocket must be a Hash' unless websocket.is_a?(Hash)
48
+ raise ArgumentError, 'websocket must contain a uri' unless websocket.key?(:uri)
49
+
50
+ request(
51
+ '/v2/project/' + @config.application_id + '/connect',
52
+ params: {
53
+ sessionId: session_id,
54
+ token: token,
55
+ websocket: camelcase(websocket)
56
+ },
57
+ type: Post
58
+ )
59
+ end
60
+ end
61
+ end
data/lib/vonage/video.rb CHANGED
@@ -54,6 +54,9 @@ module Vonage
54
54
  end
55
55
 
56
56
  def generate_client_token(session_id:, scope: 'session.connect', role: 'publisher', **params)
57
+ valid_roles = %w[publisher subscriber moderator publisheronly]
58
+ raise ArgumentError, "Invalid role: #{role}" unless valid_roles.include?(role)
59
+
57
60
  claims = {
58
61
  application_id: @config.application_id,
59
62
  scope: scope,
@@ -104,6 +107,22 @@ module Vonage
104
107
  @streams ||= Streams.new(@config)
105
108
  end
106
109
 
110
+ # @return [Captions]
111
+ #
112
+ def captions
113
+ @captions ||= Captions.new(@config)
114
+ end
115
+
116
+ # @return [Renders]
117
+ #
118
+ def renders
119
+ @renders ||= Renders.new(@config)
120
+ end
107
121
 
122
+ # @return [WebSocket]
123
+ #
124
+ def web_socket
125
+ @web_socket ||= WebSocket.new(@config)
126
+ end
108
127
  end
109
128
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vonage
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.23.0
4
+ version: 7.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vonage
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-21 00:00:00.000000000 Z
11
+ date: 2024-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vonage-jwt
@@ -240,11 +240,15 @@ files:
240
240
  - lib/vonage/video/archives/list_response.rb
241
241
  - lib/vonage/video/broadcasts.rb
242
242
  - lib/vonage/video/broadcasts/list_response.rb
243
+ - lib/vonage/video/captions.rb
243
244
  - lib/vonage/video/moderation.rb
245
+ - lib/vonage/video/renders.rb
246
+ - lib/vonage/video/renders/list_response.rb
244
247
  - lib/vonage/video/signals.rb
245
248
  - lib/vonage/video/sip.rb
246
249
  - lib/vonage/video/streams.rb
247
250
  - lib/vonage/video/streams/list_response.rb
251
+ - lib/vonage/video/web_socket.rb
248
252
  - lib/vonage/voice.rb
249
253
  - lib/vonage/voice/actions/connect.rb
250
254
  - lib/vonage/voice/actions/conversation.rb