vonage 7.32.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.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +92 -604
  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 -4
  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 -17
  20. data/lib/vonage/logger.rb +3 -0
  21. data/lib/vonage/messaging/channels/messenger.rb +0 -2
  22. data/lib/vonage/messaging/channels/mms.rb +3 -13
  23. data/lib/vonage/messaging/channels/sms.rb +0 -2
  24. data/lib/vonage/messaging/channels/viber.rb +2 -11
  25. data/lib/vonage/messaging/channels/whats_app.rb +1 -5
  26. data/lib/vonage/messaging/message.rb +1 -4
  27. data/lib/vonage/messaging.rb +3 -42
  28. data/lib/vonage/namespace.rb +68 -137
  29. data/lib/vonage/number_insight.rb +0 -1
  30. data/lib/vonage/numbers.rb +17 -40
  31. data/lib/vonage/server_error.rb +1 -1
  32. data/lib/vonage/signature.rb +5 -5
  33. data/lib/vonage/sms.rb +20 -23
  34. data/lib/vonage/version.rb +1 -1
  35. data/lib/vonage/video/archives.rb +58 -35
  36. data/lib/vonage/video/list_response.rb +11 -0
  37. data/lib/vonage/video/moderation.rb +22 -7
  38. data/lib/vonage/video/signals.rb +9 -4
  39. data/lib/vonage/video/streams.rb +12 -6
  40. data/lib/vonage/video.rb +13 -56
  41. data/lib/vonage/voice/actions/connect.rb +9 -42
  42. data/lib/vonage/voice/actions/conversation.rb +4 -10
  43. data/lib/vonage/voice/actions/input.rb +3 -19
  44. data/lib/vonage/voice/actions/notify.rb +3 -8
  45. data/lib/vonage/voice/actions/pay.rb +107 -0
  46. data/lib/vonage/voice/actions/record.rb +4 -52
  47. data/lib/vonage/voice/actions/stream.rb +3 -7
  48. data/lib/vonage/voice/actions/talk.rb +4 -14
  49. data/lib/vonage/voice/ncco.rb +1 -3
  50. data/lib/vonage/voice/talk.rb +1 -11
  51. data/lib/vonage/voice.rb +0 -24
  52. data/lib/vonage.rb +0 -4
  53. data/vonage.gemspec +1 -3
  54. metadata +12 -112
  55. data/lib/vonage/api_error.rb +0 -33
  56. data/lib/vonage/conversation/event/list_response.rb +0 -11
  57. data/lib/vonage/conversation/event.rb +0 -108
  58. data/lib/vonage/conversation/list_response.rb +0 -11
  59. data/lib/vonage/conversation/member/list_response.rb +0 -11
  60. data/lib/vonage/conversation/member.rb +0 -134
  61. data/lib/vonage/conversation/user/conversations_list_response.rb +0 -11
  62. data/lib/vonage/conversation/user/sessions_list_response.rb +0 -11
  63. data/lib/vonage/conversation/user.rb +0 -67
  64. data/lib/vonage/conversation.rb +0 -164
  65. data/lib/vonage/meetings/applications.rb +0 -28
  66. data/lib/vonage/meetings/dial_in_numbers/list_response.rb +0 -11
  67. data/lib/vonage/meetings/dial_in_numbers.rb +0 -26
  68. data/lib/vonage/meetings/recordings.rb +0 -42
  69. data/lib/vonage/meetings/rooms/list_response.rb +0 -11
  70. data/lib/vonage/meetings/rooms.rb +0 -167
  71. data/lib/vonage/meetings/sessions/list_response.rb +0 -11
  72. data/lib/vonage/meetings/sessions.rb +0 -31
  73. data/lib/vonage/meetings/themes/list_response.rb +0 -11
  74. data/lib/vonage/meetings/themes.rb +0 -239
  75. data/lib/vonage/meetings.rb +0 -50
  76. data/lib/vonage/messaging/channels/rcs.rb +0 -44
  77. data/lib/vonage/network_authentication/client_authentication.rb +0 -39
  78. data/lib/vonage/network_authentication/server_authentication.rb +0 -47
  79. data/lib/vonage/network_authentication.rb +0 -22
  80. data/lib/vonage/network_number_verification.rb +0 -92
  81. data/lib/vonage/network_sim_swap.rb +0 -84
  82. data/lib/vonage/number_insight_2.rb +0 -21
  83. data/lib/vonage/proactive_connect/events/list_response.rb +0 -11
  84. data/lib/vonage/proactive_connect/events.rb +0 -71
  85. data/lib/vonage/proactive_connect/item.rb +0 -116
  86. data/lib/vonage/proactive_connect/items/file_response.rb +0 -32
  87. data/lib/vonage/proactive_connect/items/list_response.rb +0 -11
  88. data/lib/vonage/proactive_connect/items.rb +0 -116
  89. data/lib/vonage/proactive_connect/list.rb +0 -186
  90. data/lib/vonage/proactive_connect/lists/list_response.rb +0 -11
  91. data/lib/vonage/proactive_connect/lists.rb +0 -38
  92. data/lib/vonage/proactive_connect.rb +0 -43
  93. data/lib/vonage/subaccounts/balance_transfers/list_response.rb +0 -11
  94. data/lib/vonage/subaccounts/credit_transfers/list_response.rb +0 -11
  95. data/lib/vonage/subaccounts/list_response.rb +0 -15
  96. data/lib/vonage/subaccounts.rb +0 -203
  97. data/lib/vonage/users/list_response.rb +0 -11
  98. data/lib/vonage/users.rb +0 -156
  99. data/lib/vonage/verify2/channels/email.rb +0 -36
  100. data/lib/vonage/verify2/channels/silent_auth.rb +0 -45
  101. data/lib/vonage/verify2/channels/sms.rb +0 -63
  102. data/lib/vonage/verify2/channels/voice.rb +0 -32
  103. data/lib/vonage/verify2/channels/whats_app.rb +0 -39
  104. data/lib/vonage/verify2/channels/whats_app_interactive.rb +0 -32
  105. data/lib/vonage/verify2/start_verification_options.rb +0 -63
  106. data/lib/vonage/verify2/template_fragments/list_response.rb +0 -11
  107. data/lib/vonage/verify2/template_fragments.rb +0 -125
  108. data/lib/vonage/verify2/templates/list_response.rb +0 -11
  109. data/lib/vonage/verify2/templates.rb +0 -86
  110. data/lib/vonage/verify2/workflow.rb +0 -39
  111. data/lib/vonage/verify2/workflow_builder.rb +0 -25
  112. data/lib/vonage/verify2.rb +0 -112
  113. data/lib/vonage/video/archives/list_response.rb +0 -11
  114. data/lib/vonage/video/broadcasts/list_response.rb +0 -11
  115. data/lib/vonage/video/broadcasts.rb +0 -75
  116. data/lib/vonage/video/captions.rb +0 -67
  117. data/lib/vonage/video/connections/list_response.rb +0 -11
  118. data/lib/vonage/video/connections.rb +0 -29
  119. data/lib/vonage/video/renders/list_response.rb +0 -11
  120. data/lib/vonage/video/renders.rb +0 -107
  121. data/lib/vonage/video/sip.rb +0 -48
  122. data/lib/vonage/video/streams/list_response.rb +0 -11
  123. data/lib/vonage/video/web_socket.rb +0 -62
  124. data/lib/vonage/voice/actions/transfer.rb +0 -83
  125. data/lib/vonage/voice/actions/wait.rb +0 -43
@@ -1,107 +0,0 @@
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
@@ -1,48 +0,0 @@
1
- # typed: true
2
- # frozen_string_literal: true
3
-
4
- module Vonage
5
- class Video::SIP < Namespace
6
- include Keys
7
-
8
- self.authentication = BearerToken
9
-
10
- self.request_body = JSON
11
-
12
- self.host = :video_host
13
-
14
- # Initiate an outbound SIP call.
15
- #
16
- def dial(session_id:, token:, sip_uri:, **params)
17
- request(
18
- '/v2/project/' + @config.application_id + '/dial',
19
- params: camelcase({
20
- session_id: session_id,
21
- token: token,
22
- sip: params.merge({uri: sip_uri})
23
- }),
24
- type: Post
25
- )
26
- end
27
-
28
- # Play DTMF tones into a SIP call.
29
- #
30
- def play_dtmf_to_session(session_id:, dtmf_digits:)
31
- request(
32
- '/v2/project/' + @config.application_id + '/session/' + session_id + '/play-dtmf',
33
- params: {digits: dtmf_digits},
34
- type: Post
35
- )
36
- end
37
-
38
- # Play DMTF tones into a specific connection.
39
- #
40
- def play_dtmf_to_connection(session_id:, connection_id:, dtmf_digits:)
41
- request(
42
- '/v2/project/' + @config.application_id + '/session/' + session_id + '/connection/' + connection_id + '/play-dtmf',
43
- params: {digits: dtmf_digits},
44
- type: Post
45
- )
46
- end
47
- end
48
- end
@@ -1,11 +0,0 @@
1
- # typed: true
2
-
3
- class Vonage::Video::Streams::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
@@ -1,62 +0,0 @@
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
- # @option websocket [optional, Boolean] :bidirectional Whether to send audio data from the WebSocket connection to a stream published in the session.
42
- #
43
- # @return [Response]
44
- #
45
- # @see TODO: Add document link here
46
- #
47
- def connect(session_id:, token:, websocket:)
48
- raise ArgumentError, 'websocket must be a Hash' unless websocket.is_a?(Hash)
49
- raise ArgumentError, 'websocket must contain a uri' unless websocket.key?(:uri)
50
-
51
- request(
52
- '/v2/project/' + @config.application_id + '/connect',
53
- params: {
54
- sessionId: session_id,
55
- token: token,
56
- websocket: camelcase(websocket)
57
- },
58
- type: Post
59
- )
60
- end
61
- end
62
- end
@@ -1,83 +0,0 @@
1
- # typed: true
2
- # typed: true
3
- # frozen_string_literal: true
4
-
5
- module Vonage
6
- class Voice::Actions::Transfer
7
- attr_accessor :conversation_id, :can_hear, :can_speak, :mute
8
-
9
- def initialize(attributes = {})
10
- @conversation_id = attributes.fetch(:conversation_id)
11
- @can_hear = attributes.fetch(:can_hear, nil)
12
- @can_speak = attributes.fetch(:can_speak, nil)
13
- @mute = attributes.fetch(:mute, nil)
14
-
15
- after_initialize!
16
- end
17
-
18
- def after_initialize!
19
- validate_conversation_id
20
- validate_can_hear if self.can_hear
21
- validate_can_speak if self.can_speak
22
- validate_mute if self.mute != nil
23
- end
24
-
25
- def validate_conversation_id
26
- conversation_id = self.conversation_id
27
-
28
- raise ClientError.new("Expected 'conversation_id' parameter to be a string") unless conversation_id.is_a?(String)
29
-
30
- self.conversation_id
31
- end
32
-
33
- def validate_can_hear
34
- can_hear = self.can_hear
35
- unless can_hear.is_a?(Array) && can_hear.all? { |item| item.is_a?(String) }
36
- raise ClientError.new("Expected 'can_hear' parameter to be an array of strings")
37
- end
38
-
39
- self.can_hear
40
- end
41
-
42
- def validate_can_speak
43
- can_speak = self.can_speak
44
- unless can_speak.is_a?(Array) && can_speak.all? { |item| item.is_a?(String) }
45
- raise ClientError.new("Expected 'can_speak' parameter to be an array of strings")
46
- end
47
-
48
- self.can_speak
49
- end
50
-
51
- def validate_mute
52
- mute = self.mute
53
- unless [true, false].include?(mute)
54
- raise ClientError.new("Expected 'mute' parameter to be a boolean")
55
- end
56
-
57
- if self.mute && self.can_speak
58
- raise ClientError.new("The 'mute' parameter is not supported if 'can_speak' is also set")
59
- end
60
-
61
- self.mute
62
- end
63
-
64
- def action
65
- create_transfer!(self)
66
- end
67
-
68
- def create_transfer!(builder)
69
- ncco = [
70
- {
71
- action: 'transfer',
72
- conversation_id: builder.conversation_id,
73
- }
74
- ]
75
-
76
- ncco[0].merge!(canHear: builder.can_hear) if builder.can_hear
77
- ncco[0].merge!(canSpeak: builder.can_speak) if builder.can_speak
78
- ncco[0].merge!(mute: builder.mute) if builder.mute != nil
79
-
80
- ncco
81
- end
82
- end
83
- end
@@ -1,43 +0,0 @@
1
- # typed: true
2
- # typed: true
3
- # frozen_string_literal: true
4
-
5
- module Vonage
6
- class Voice::Actions::Wait
7
- attr_accessor :timeout
8
-
9
- def initialize(attributes = {})
10
- @timeout = attributes.fetch(:timeout, nil)
11
-
12
- after_initialize!
13
- end
14
-
15
- def after_initialize!
16
- validate_timeout if self.timeout
17
- end
18
-
19
- def validate_timeout
20
- timeout = self.timeout
21
-
22
- raise ClientError.new("Expected 'timeout' parameter to be a number") unless timeout.is_a?(Numeric)
23
-
24
- self.timeout
25
- end
26
-
27
- def action
28
- create_wait!(self)
29
- end
30
-
31
- def create_wait!(builder)
32
- ncco = [
33
- {
34
- action: 'wait'
35
- }
36
- ]
37
-
38
- ncco[0].merge!(timeout: builder.timeout) if builder.timeout
39
-
40
- ncco
41
- end
42
- end
43
- end