vonage 7.26.0 → 7.27.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d3865caa299175327806358dbe9a66e59abefa41240a5d9a847e5e73a37ea50
4
- data.tar.gz: 861a7ae004b3908083af43cae0809330732dc07aa7be22a3cc362dc8b538fdab
3
+ metadata.gz: 1ef29adae44fffb9754118333b6a82cac7172cb536eb2b4ec31644694c6388ef
4
+ data.tar.gz: 43496b6bcf0db687cdef8bdd4506db140fea685f48a306abc1aac4325f8300f5
5
5
  SHA512:
6
- metadata.gz: 336c7b033206cf204f41e513a2dc8a4c56b57750660e17b37aede3d200aedcced48352ab18ffa3d44f7924df34548f767f19c9189dc385d9f2557a584d399bd7
7
- data.tar.gz: da28e64d300d4f70c789e670c10f60beb9fbb058c1da3af8f2f995a8a61541d5b73cea93342f0a5f3b1b0a620dbba5c277fe5b8617259a52446bbbbeed09042e
6
+ metadata.gz: 055f8c7f7e0bcdc9eb8c59f0110b6bbfb850a1d725468f0e23d1e5bf736b5acdf3a9dfdbf0e17e0f4e5b54fabe6415173c2d8f39106b73ca336389f4f8483baa
7
+ data.tar.gz: 72ad26a1bf8696cd465ea2f89f7ab190803a29ee13dcb3680238504b9c81c6264dc444e2e12c0e078a19dd2042ea8fe31e8988e32162413325fa7be5a56444d4
data/README.md CHANGED
@@ -83,7 +83,7 @@ client = Vonage::Client.new(application_id: application_id, private_key: private
83
83
  ```
84
84
 
85
85
  Both arguments should have string values corresponding to the `id` and `private_key`
86
- values returned in a ["create an application"](https://developer.nexmo.com/api/application.v2#createApplication)
86
+ values returned in a ["create an application"](https://developer.vonage.com/api/application.v2#createApplication)
87
87
  response. These credentials can be stored in a datastore, in environment variables,
88
88
  on disk outside of source control, or in some kind of key management infrastructure.
89
89
 
@@ -104,8 +104,8 @@ token = Vonage::JWT.generate(claims)
104
104
  client = Vonage::Client.new(token: token)
105
105
  ```
106
106
 
107
- Documentation for the Vonage Ruby JWT generator gem can be found at
108
- [https://www.rubydoc.info/github/nexmo/nexmo-jwt-ruby](https://www.rubydoc.info/github/nexmo/nexmo-jwt-ruby).
107
+ Documentation for the Vonage Ruby JWT generator gem can be found at: https://www.rubydoc.info/gems/vonage-jwt
108
+
109
109
  The documentation outlines all the possible parameters you can use to customize and build a token with.
110
110
 
111
111
  ### Logging
@@ -179,9 +179,6 @@ client = Vonage::Client.new(
179
179
 
180
180
  By default the hosts are set to `api.nexmo.com` and `rest.nexmo.com`, respectively.
181
181
 
182
-
183
-
184
-
185
182
  ### Webhook signatures
186
183
 
187
184
  Certain Vonage APIs provide signed [webhooks](https://developer.vonage.com/en/getting-started/concepts/webhooks) as a means of verifying the origin of the webhooks. The exact signing mechanism varies depending on the API.
@@ -300,10 +297,10 @@ Vonage APIs paginate list requests. This means that if a collection is requested
300
297
 
301
298
  The `auto_advance` parameter is set to a default of `true` for the following APIs:
302
299
 
303
- * [Account API](https://developer.nexmo.com/api/developer/account)
304
- * [Application API](https://developer.nexmo.com/api/application.v2)
305
- * [Conversation API](https://developer.nexmo.com/api/conversation)
306
- * [Voice API](https://developer.nexmo.com/api/voice)
300
+ * [Account API](https://developer.vonage.com/api/developer/account)
301
+ * [Application API](https://developer.vonage.com/api/application.v2)
302
+ * [Conversation API](https://developer.vonage.com/api/conversation)
303
+ * [Voice API](https://developer.vonage.com/api/voice)
307
304
 
308
305
  To modify the `auto_advance` behavior you can specify it in your method:
309
306
 
@@ -314,7 +311,7 @@ client.applications.list(auto_advance: false)
314
311
 
315
312
  ## Messages API
316
313
 
317
- The [Vonage Messages API](https://developer.vonage.com/messages/overview) allows you to send messages over a number of different channels, and various message types within each channel. See the Vonage Developer Documentation for a [complete API reference](https://developer.vonage.com/api/messages-olympus) listing all the channel and message type combinations.
314
+ The [Vonage Messages API](https://developer.vonage.com/messages/overview) allows you to send messages over a number of different channels, and various message types within each channel. See the Vonage Developer Documentation for a [complete API reference](https://developer.vonage.com/en/api/messages) listing all the channel and message type combinations.
318
315
 
319
316
  The Ruby SDK allows you to construct message data for specific messaging channels. Other than SMS (which has only one type -- text), you need to pass the message `:type` as well as the `:message` itself as arguments to the appropriate messages method, along with any optional properties if needed.
320
317
 
@@ -513,11 +510,11 @@ response = client.voice.create({
513
510
 
514
511
  ## Documentation
515
512
 
516
- Vonage Ruby SDK documentation: https://www.rubydoc.info/github/Vonage/vonage-ruby-sdk
513
+ Vonage Ruby SDK documentation: https://www.rubydoc.info/gems/vonage
517
514
 
518
515
  Vonage Ruby SDK code examples: https://github.com/Vonage/vonage-ruby-code-snippets
519
516
 
520
- Vonage APIs API reference: https://developer.nexmo.com/api
517
+ Vonage APIs API reference: https://developer.vonage.com/api
521
518
 
522
519
  ## Supported APIs
523
520
 
@@ -13,12 +13,15 @@ module Vonage
13
13
 
14
14
  # Update an existing application.
15
15
  #
16
+ # @deprecated
17
+ #
16
18
  # @param [required, String] :default_theme_id The id of the theme to set as application default theme
17
19
  #
18
20
  # @return [Response]
19
21
  #
20
22
  # @see https://developer.vonage.com/en/api/meetings#updateApplication
21
23
  def update(default_theme_id:)
24
+ logger.info('This method is deprecated and will be removed in a future release.')
22
25
  request("/v1/meetings/applications", params: {update_details: {default_theme_id: default_theme_id}}, type: Patch)
23
26
  end
24
27
  end
@@ -13,10 +13,13 @@ module Vonage
13
13
 
14
14
  # Get numbers that can be used to dial into a meeting.
15
15
  #
16
+ # @deprecated
17
+ #
16
18
  # @return [ListResponse]
17
19
  #
18
20
  # @see https://developer.vonage.com/en/api/meetings#getDialInNumbers
19
21
  def list
22
+ logger.info('This method is deprecated and will be removed in a future release.')
20
23
  request("/v1/meetings/dial-in-numbers", response_class: ListResponse)
21
24
  end
22
25
  end
@@ -13,23 +13,29 @@ module Vonage
13
13
 
14
14
  # Return information for specified recording.
15
15
  #
16
+ # @deprecated
17
+ #
16
18
  # @param [required, String] recording_id The id of the recoring for which the info should be returned
17
19
  #
18
20
  # @return [Response]
19
21
  #
20
22
  # @see https://developer.vonage.com/en/api/meetings#getRecording
21
23
  def info(recording_id:)
24
+ logger.info('This method is deprecated and will be removed in a future release.')
22
25
  request("/v1/meetings/recordings/" + recording_id)
23
26
  end
24
27
 
25
28
  # Delete a specified recording.
26
29
  #
30
+ # @deprecated
31
+ #
27
32
  # @param [required, String] recording_id The id of the recoring to be deleted
28
33
  #
29
34
  # @return [Response]
30
35
  #
31
36
  # @see https://developer.vonage.com/en/api/meetings#deleteRecording
32
37
  def delete(recording_id:)
38
+ logger.info('This method is deprecated and will be removed in a future release.')
33
39
  request("/v1/meetings/recordings/" + recording_id, type: Delete)
34
40
  end
35
41
  end
@@ -13,6 +13,8 @@ module Vonage
13
13
 
14
14
  # Get a list of rooms associated with the Vonage application.
15
15
  #
16
+ # @deprecated
17
+ #
16
18
  # @param [optional, Integer] :start_id
17
19
  #
18
20
  # @param [optional, Integer] :end_id
@@ -23,6 +25,7 @@ module Vonage
23
25
  #
24
26
  # @see https://developer.vonage.com/en/api/meetings#getRooms
25
27
  def list(**params)
28
+ logger.info('This method is deprecated and will be removed in a future release.')
26
29
  path = "/v1/meetings/rooms"
27
30
  path += "?#{Params.encode(params)}" unless params.empty?
28
31
 
@@ -31,6 +34,8 @@ module Vonage
31
34
 
32
35
  # Return information for specified room.
33
36
  #
37
+ # @deprecated
38
+ #
34
39
  # @param [required, String] room_id
35
40
  # The id of the room for which the info should be returned
36
41
  #
@@ -38,11 +43,14 @@ module Vonage
38
43
  #
39
44
  # @see https://developer.vonage.com/en/api/meetings#getRoom
40
45
  def info(room_id:)
46
+ logger.info('This method is deprecated and will be removed in a future release.')
41
47
  request("/v1/meetings/rooms/" + room_id)
42
48
  end
43
49
 
44
50
  # Create a new room.
45
51
  #
52
+ # @deprecated
53
+ #
46
54
  # @param [required, String] :display_name
47
55
  #
48
56
  # @param [optional, String] :metadata
@@ -95,6 +103,7 @@ module Vonage
95
103
  #
96
104
  # @see https://developer.vonage.com/en/api/meetings#createRoom
97
105
  def create(display_name:, **params)
106
+ logger.info('This method is deprecated and will be removed in a future release.')
98
107
  request(
99
108
  "/v1/meetings/rooms",
100
109
  params: params.merge({ display_name: display_name }),
@@ -106,6 +115,8 @@ module Vonage
106
115
  # Although paramaters (other than `room_id`) are optional, at least one other parameter must be provided or an error
107
116
  # response will be received.
108
117
  #
118
+ # @deprecated
119
+ #
109
120
  # @param [required, String] room_id The ID of the Room to be updated
110
121
  #
111
122
  # @param [optional, String(date)] :expires_at
@@ -142,6 +153,7 @@ module Vonage
142
153
  #
143
154
  # @see https://developer.vonage.com/en/api/meetings#updateRoom
144
155
  def update(room_id:, **params)
156
+ logger.info('This method is deprecated and will be removed in a future release.')
145
157
  raise ArgumentError, 'must provide at least one other param in addition to :room_id' if params.empty?
146
158
  request(
147
159
  "/v1/meetings/rooms/" + room_id,
@@ -13,12 +13,15 @@ module Vonage
13
13
 
14
14
  # Return a list of recordings for a specified session.
15
15
  #
16
+ # @deprecated
17
+ #
16
18
  # @param [required, String] session_id The id of the session for which the recordings list should be returned
17
19
  #
18
20
  # @return [ListResponse]
19
21
  #
20
22
  # @see https://developer.vonage.com/en/api/meetings#getSessionRecordings
21
23
  def list_recordings(session_id:)
24
+ logger.info('This method is deprecated and will be removed in a future release.')
22
25
  request(
23
26
  "/v1/meetings/sessions/" + session_id + "/recordings",
24
27
  response_class: ListResponse
@@ -13,26 +13,34 @@ module Vonage
13
13
 
14
14
  # Get a list of themes associated with the Vonage application.
15
15
  #
16
+ # @deprecated
17
+ #
16
18
  # @return [ListResponse]
17
19
  #
18
20
  # @see https://developer.vonage.com/en/api/meetings#getThemes
19
21
  def list
22
+ logger.info('This method is deprecated and will be removed in a future release.')
20
23
  request("/v1/meetings/themes", response_class: ListResponse)
21
24
  end
22
25
 
23
26
  # Return information for specified theme.
24
27
  #
28
+ # @deprecated
29
+ #
25
30
  # @param [required, String] theme_id The id of the theme for which the info should be returned
26
31
  #
27
32
  # @return [Response]
28
33
  #
29
34
  # @see https://developer.vonage.com/en/api/meetings#getThemeById
30
35
  def info(theme_id:)
36
+ logger.info('This method is deprecated and will be removed in a future release.')
31
37
  request("/v1/meetings/themes/" + theme_id)
32
38
  end
33
39
 
34
40
  # Create a new theme.
35
41
  #
42
+ # @deprecated
43
+ #
36
44
  # @param [required, String] :main_color
37
45
  # The main color that will be used for the meeting room.
38
46
  #
@@ -49,6 +57,7 @@ module Vonage
49
57
  #
50
58
  # @see https://developer.vonage.com/en/api/meetings#createTheme
51
59
  def create(main_color:, brand_text:, **params)
60
+ logger.info('This method is deprecated and will be removed in a future release.')
52
61
  request(
53
62
  "/v1/meetings/themes",
54
63
  params: params.merge(main_color: main_color, brand_text: brand_text),
@@ -58,6 +67,8 @@ module Vonage
58
67
 
59
68
  # Update an existing theme.
60
69
  #
70
+ # @deprecated
71
+ #
61
72
  # @param [required, String] theme_id The id of the theme to be updated
62
73
  #
63
74
  # @param [required, String] :main_color
@@ -76,6 +87,7 @@ module Vonage
76
87
  #
77
88
  # @see https://developer.vonage.com/en/api/meetings#updateTheme
78
89
  def update(theme_id:, **params)
90
+ logger.info('This method is deprecated and will be removed in a future release.')
79
91
  request(
80
92
  "/v1/meetings/themes/" + theme_id,
81
93
  params: {
@@ -87,6 +99,8 @@ module Vonage
87
99
 
88
100
  # Delete an existing theme.
89
101
  #
102
+ # @deprecated
103
+ #
90
104
  # @param [required, String] :theme_id The id of the theme to be deleted
91
105
  #
92
106
  # @param [optional, Boolean] :force. Set to `true` to force delete a theme currently being used for a room, or as
@@ -96,6 +110,7 @@ module Vonage
96
110
  #
97
111
  # @see https://developer.vonage.com/en/api/meetings#deleteTheme
98
112
  def delete(theme_id:, force: false)
113
+ logger.info('This method is deprecated and will be removed in a future release.')
99
114
  request(
100
115
  "/v1/meetings/themes/" + theme_id + "?force=#{force}",
101
116
  type: Delete
@@ -104,6 +119,8 @@ module Vonage
104
119
 
105
120
  # Get a list of rooms that are associated with a theme id.
106
121
  #
122
+ # @deprecated
123
+ #
107
124
  # @param [required, String] theme_id THe ID of the theme to search for rooms associated with.
108
125
  #
109
126
  # @param [optional, Integer] :start_id
@@ -116,6 +133,7 @@ module Vonage
116
133
  #
117
134
  # @see https://developer.vonage.com/en/api/meetings#getRoomsByThemeId
118
135
  def list_rooms(theme_id:, **params)
136
+ logger.info('This method is deprecated and will be removed in a future release.')
119
137
  path = "/v1/meetings/themes/" + theme_id + "/rooms"
120
138
  path += "?#{Params.encode(params)}" unless params.empty?
121
139
 
@@ -124,6 +142,8 @@ module Vonage
124
142
 
125
143
  # Set a logo for a theme.
126
144
  #
145
+ # @deprecated
146
+ #
127
147
  # @param [required, String] :theme_id The ID of the theme for which the logo should be set
128
148
  #
129
149
  # @param [required, String] :filepath
@@ -146,6 +166,7 @@ module Vonage
146
166
  #
147
167
  # TODO: add type signature
148
168
  def set_logo(theme_id:, filepath:, logo_type:)
169
+ logger.info('This method is deprecated and will be removed in a future release.')
149
170
  pn = Pathname.new(filepath)
150
171
  valid_logo_types = ['white', 'colored', 'favicon']
151
172
  raise ArgumentError, ':filepath not for a file' unless pn.file?
@@ -5,33 +5,45 @@ module Vonage
5
5
  class Meetings < Namespace
6
6
  extend T::Sig
7
7
 
8
+ # @deprecated
8
9
  sig { returns(T.nilable(Vonage::Meetings::Rooms)) }
9
10
  def rooms
11
+ logger.info('This method is deprecated and will be removed in a future release.')
10
12
  @rooms ||= Rooms.new(@config)
11
13
  end
12
14
 
15
+ # @deprecated
13
16
  sig { returns(T.nilable(Vonage::Meetings::Recordings)) }
14
17
  def recordings
18
+ logger.info('This method is deprecated and will be removed in a future release.')
15
19
  @recordings ||= Recordings.new(@config)
16
20
  end
17
21
 
22
+ # @deprecated
18
23
  sig { returns(T.nilable(Vonage::Meetings::Sessions)) }
19
24
  def sessions
25
+ logger.info('This method is deprecated and will be removed in a future release.')
20
26
  @sessions ||= Sessions.new(@config)
21
27
  end
22
28
 
29
+ # @deprecated
23
30
  sig { returns(T.nilable(Vonage::Meetings::Themes)) }
24
31
  def themes
32
+ logger.info('This method is deprecated and will be removed in a future release.')
25
33
  @themes ||= Themes.new(@config)
26
34
  end
27
35
 
36
+ # @deprecated
28
37
  sig { returns(T.nilable(Vonage::Meetings::Applications)) }
29
38
  def applications
39
+ logger.info('This method is deprecated and will be removed in a future release.')
30
40
  @applications ||= Applications.new(@config)
31
41
  end
32
42
 
43
+ # @deprecated
33
44
  sig { returns(T.nilable(Vonage::Meetings::DialInNumbers)) }
34
45
  def dial_in_numbers
46
+ logger.info('This method is deprecated and will be removed in a future release.')
35
47
  @dial_in_numbers ||= DialInNumbers.new(@config)
36
48
  end
37
49
  end
@@ -0,0 +1,42 @@
1
+ # typed: true
2
+
3
+ module Vonage
4
+ class Messaging::Channels::RCS < Messaging::Message
5
+ MESSAGE_TYPES = ['text', 'image', 'video', 'file', 'custom']
6
+
7
+ attr_reader :data
8
+
9
+ def initialize(attributes = {})
10
+ @type = attributes.fetch(:type, nil)
11
+ @message = attributes.fetch(:message, nil)
12
+ @opts = attributes.fetch(:opts, {})
13
+ @data = {}
14
+
15
+ after_initialize!
16
+ end
17
+
18
+ private
19
+
20
+ def build
21
+ data[:channel] = 'rcs'
22
+ super
23
+ end
24
+
25
+ def verify_type
26
+ raise ClientError.new("Invalid message type") unless MESSAGE_TYPES.include?(type)
27
+ end
28
+
29
+ def verify_message
30
+ case type
31
+ when 'text'
32
+ raise Vonage::ClientError.new("Invalid parameter type. `:message` must be a String") unless message.is_a? String
33
+ when 'custom'
34
+ raise Vonage::ClientError.new("Invalid parameter type. `:message` must be a Hash") unless message.is_a? Hash
35
+ raise Vonage::ClientError.new("Invalid parameter content. `:message` must not be empty") if message.empty?
36
+ else
37
+ raise Vonage::ClientError.new("Invalid parameter type. `:message` must be a Hash") unless message.is_a? Hash
38
+ raise Vonage::ClientError.new("Missing parameter. `:message` must contain a `:url` key") unless message[:url]
39
+ end
40
+ end
41
+ end
42
+ end
@@ -5,6 +5,7 @@ module Vonage
5
5
  CHANNELS = {
6
6
  sms: Vonage::Messaging::Channels::SMS,
7
7
  mms: Vonage::Messaging::Channels::MMS,
8
+ rcs: Vonage::Messaging::Channels::RCS,
8
9
  whatsapp: Vonage::Messaging::Channels::WhatsApp,
9
10
  messenger: Vonage::Messaging::Channels::Messenger,
10
11
  viber: Vonage::Messaging::Channels::Viber
@@ -25,12 +25,26 @@ module Vonage
25
25
  # @option params [required, Hash] **message
26
26
  # The Vonage Message object to use for this message.
27
27
  #
28
- # @see https://developer.vonage.com/api/messages-olympus#SendMessage
28
+ # @see https://developer.vonage.com/api/messages#SendMessage
29
29
  #
30
30
  def send(to:, from:, **message)
31
31
  request('/v1/messages', params: {to: to, from: from, **message}, type: Post)
32
32
  end
33
33
 
34
+ # Update a Message Object.
35
+ #
36
+ # @example
37
+ # message = client.messaging.update(message_uuid: "aaaaaaaa-bbbb-4ccc-8ddd-0123456789ab", status: "read")
38
+ #
39
+ # @option params [required, String] :message_uuid. the UUID of the message to update.
40
+ #
41
+ # `:message_uuid` is always required. Other parameters will depend on the message channel and the specific action being performed.
42
+ # @see https://developer.vonage.com/api/messages#UpdateMessage
43
+ #
44
+ def update(message_uuid:, **params)
45
+ request("/v1/messages/#{message_uuid}", params: params, type: Patch)
46
+ end
47
+
34
48
  # Validate a JSON Web Token from a Messages API Webhook.
35
49
  #
36
50
  # @param [String, required] :token The JWT from the Webhook's Authorization header
@@ -17,6 +17,8 @@ module Vonage
17
17
  # puts "#{item.msisdn} #{item.country} #{item.type}"
18
18
  # end
19
19
  #
20
+ # @param [Hash] params
21
+ #
20
22
  # @option params [String] :application_id
21
23
  # The application that you want to return the numbers for.
22
24
  #
@@ -47,8 +49,6 @@ module Vonage
47
49
  # Set this to `true` to auto-advance through all the pages in the record
48
50
  # and collect all the data. The default is `false`.
49
51
  #
50
- # @param [Hash] params
51
- #
52
52
  # @return [ListResponse]
53
53
  #
54
54
  # @see https://developer.nexmo.com/api/developer/numbers#getOwnedNumbers
@@ -65,6 +65,8 @@ module Vonage
65
65
  # puts "#{item.msisdn} #{item.type} #{item.cost}"
66
66
  # end
67
67
  #
68
+ # @param [Hash] params
69
+ #
68
70
  # @option params [required, String] :country
69
71
  # The two character country code in ISO 3166-1 alpha-2 format.
70
72
  #
@@ -82,7 +84,7 @@ module Vonage
82
84
  # - `2` - Search for numbers that end with **:pattern**
83
85
  #
84
86
  # @option params [String] :features
85
- # Available features are `SMS` and `VOICE`.
87
+ # Available features are `SMS`, `MMS`, and `VOICE`.
86
88
  # To look for numbers that support both, use a comma-separated value: `SMS,VOICE`.
87
89
  #
88
90
  # @option params [Integer] :size
@@ -95,8 +97,6 @@ module Vonage
95
97
  # Set this to `true` to auto-advance through all the pages in the record
96
98
  # and collect all the data. The default is `false`.
97
99
  #
98
- # @param [Hash] params
99
- #
100
100
  # @return [ListResponse]
101
101
  #
102
102
  # @see https://developer.nexmo.com/api/developer/numbers#getAvailableNumbers
@@ -110,6 +110,8 @@ module Vonage
110
110
  # @example
111
111
  # response = client.numbers.buy(country: 'GB', msisdn: '447700900000')
112
112
  #
113
+ # @param [Hash] params
114
+ #
113
115
  # @option params [required, String] :country
114
116
  # The two character country code in ISO 3166-1 alpha-2 format.
115
117
  #
@@ -120,8 +122,6 @@ module Vonage
120
122
  # If you'd like to perform an action on a subaccount, provide the `api_key` of that account here.
121
123
  # If you'd like to perform an action on your own account, you do not need to provide this field.
122
124
  #
123
- # @param [Hash] params
124
- #
125
125
  # @return [Response]
126
126
  #
127
127
  # @see https://developer.nexmo.com/api/developer/numbers#buyANumber
@@ -140,6 +140,8 @@ module Vonage
140
140
  # @example
141
141
  # response = client.numbers.cancel(country: 'GB', msisdn: '447700900000')
142
142
  #
143
+ # @param [Hash] params
144
+ #
143
145
  # @option params [required, String] :country
144
146
  # The two character country code in ISO 3166-1 alpha-2 format.
145
147
  #
@@ -150,8 +152,6 @@ module Vonage
150
152
  # If you'd like to perform an action on a subaccount, provide the `api_key` of that account here.
151
153
  # If you'd like to perform an action on your own account, you do not need to provide this field.
152
154
  #
153
- # @param [Hash] params
154
- #
155
155
  # @return [Response]
156
156
  #
157
157
  # @see https://developer.nexmo.com/api/developer/numbers#cancelANumber
@@ -177,6 +177,8 @@ module Vonage
177
177
  #
178
178
  # response = client.numbers.update(params)
179
179
  #
180
+ # @param [Hash] params
181
+ #
180
182
  # @option params [required, String] :country
181
183
  # The two character country code in ISO 3166-1 alpha-2 format.
182
184
  #
@@ -203,8 +205,6 @@ module Vonage
203
205
  # @option params [String] :voice_status_callback
204
206
  # A webhook URI for Vonage to send a request to when a call ends.
205
207
  #
206
- # @param [Hash] params
207
- #
208
208
  # @return [Response]
209
209
  #
210
210
  # @see https://developer.nexmo.com/api/developer/numbers#updateANumber
@@ -11,6 +11,8 @@ module Vonage
11
11
 
12
12
  # Find all events
13
13
  #
14
+ # @deprecated
15
+ #
14
16
  # @example
15
17
  # response = proactive_connect.events.list
16
18
  #
@@ -59,6 +61,7 @@ module Vonage
59
61
  # @see https://developer.vonage.com/en/api/proactive-connect#eventsFindAll
60
62
  #
61
63
  def list(**params)
64
+ logger.info('This method is deprecated and will be removed in a future release.')
62
65
  path = "/v0.1/bulk/events"
63
66
  path += "?#{Params.encode(params)}" unless params.empty?
64
67
 
@@ -13,6 +13,8 @@ module Vonage
13
13
 
14
14
  # Create a list item
15
15
  #
16
+ # @deprecated
17
+ #
16
18
  # @example
17
19
  # response = proactive_connect.item.create(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865', data: {name: 'Joe Bloggs', email: 'joe@email.com'})
18
20
  #
@@ -25,6 +27,7 @@ module Vonage
25
27
  # @see https://developer.vonage.com/en/api/proactive-connect#itemsCreate
26
28
  #
27
29
  def create(list_id:, data:)
30
+ logger.info('This method is deprecated and will be removed in a future release.')
28
31
  raise ArgumentError.new(":data must be a Hash") unless data.is_a? Hash
29
32
  request(
30
33
  "/v0.1/bulk/lists/#{list_id}/items",
@@ -35,6 +38,8 @@ module Vonage
35
38
 
36
39
  # Get list item by id
37
40
  #
41
+ # @deprecated
42
+ #
38
43
  # @example
39
44
  # response = proactive_connect.item.find(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865', item_id: 'd97ebf20-e4de-4e50-921a-7bb4dceb373a')
40
45
  #
@@ -47,11 +52,14 @@ module Vonage
47
52
  # @see https://developer.vonage.com/en/api/proactive-connect#itemsGet
48
53
  #
49
54
  def find(list_id:, item_id:)
55
+ logger.info('This method is deprecated and will be removed in a future release.')
50
56
  request("/v0.1/bulk/lists/#{list_id}/items/#{item_id}")
51
57
  end
52
58
 
53
59
  # Update list item
54
60
  #
61
+ # @deprecated
62
+ #
55
63
  # @example
56
64
  # response = proactive_connect.item.create(
57
65
  # list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865',
@@ -73,6 +81,7 @@ module Vonage
73
81
  # @see https://developer.vonage.com/en/api/proactive-connect#itemsUpdate
74
82
  #
75
83
  def update(list_id:, item_id:, data:)
84
+ logger.info('This method is deprecated and will be removed in a future release.')
76
85
  raise ArgumentError.new(":data must be a Hash") unless data.is_a? Hash
77
86
  request(
78
87
  "/v0.1/bulk/lists/#{list_id}/items/#{item_id}",
@@ -83,6 +92,8 @@ module Vonage
83
92
 
84
93
  # Delete list item
85
94
  #
95
+ # @deprecated
96
+ #
86
97
  # @example
87
98
  # response = proactive_connect.item.delete(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865', item_id: 'd97ebf20-e4de-4e50-921a-7bb4dceb373a')
88
99
  #
@@ -95,6 +106,7 @@ module Vonage
95
106
  # @see https://developer.vonage.com/en/api/proactive-connect#itemsDelete
96
107
  #
97
108
  def delete(list_id:, item_id:)
109
+ logger.info('This method is deprecated and will be removed in a future release.')
98
110
  request(
99
111
  "/v0.1/bulk/lists/#{list_id}/items/#{item_id}",
100
112
  type: Delete
@@ -11,6 +11,8 @@ module Vonage
11
11
 
12
12
  # Find all list items
13
13
  #
14
+ # @deprecated
15
+ #
14
16
  # @example
15
17
  # response = proactive_connect.items.list(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
16
18
  #
@@ -29,6 +31,7 @@ module Vonage
29
31
  # @see https://developer.vonage.com/en/api/proactive-connect#itemsFindAll
30
32
  #
31
33
  def list(list_id:, **params)
34
+ logger.info('This method is deprecated and will be removed in a future release.')
32
35
  path = "/v0.1/bulk/lists/#{list_id}/items"
33
36
  path += "?#{Params.encode(params)}" unless params.empty?
34
37
 
@@ -37,6 +40,8 @@ module Vonage
37
40
 
38
41
  # Download list items as a CSV file format
39
42
  #
43
+ # @deprecated
44
+ #
40
45
  # @example
41
46
  # response = proactive_connect.items.download_csv(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
42
47
  #
@@ -64,6 +69,7 @@ module Vonage
64
69
  # @see https://developer.vonage.com/en/api/proactive-connect#itemsDownload
65
70
  #
66
71
  def download_csv(list_id:, order: 'asc', **params)
72
+ logger.info('This method is deprecated and will be removed in a future release.')
67
73
  response = request("/v0.1/bulk/lists/#{list_id}/items/download?order=#{order}", response_class: FileResponse)
68
74
 
69
75
  response.filename = params[:filename] if params[:filename]
@@ -74,6 +80,8 @@ module Vonage
74
80
 
75
81
  # Import list items from a CSV file
76
82
  #
83
+ # @deprecated
84
+ #
77
85
  # @example
78
86
  # response = proactive_connect.items.upload_csv(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865', filepath: '/files/import.csv')
79
87
  #
@@ -96,6 +104,7 @@ module Vonage
96
104
  # @see https://developer.vonage.com/en/api/proactive-connect#itemsImport
97
105
  #
98
106
  def upload_csv(list_id:, filepath:)
107
+ logger.info('This method is deprecated and will be removed in a future release.')
99
108
  pn = Pathname.new(filepath)
100
109
  raise ArgumentError, ':filepath not for a file' unless pn.file?
101
110
  raise ArgumentError, 'file at :filepath not readable' unless pn.readable?
@@ -13,6 +13,8 @@ module Vonage
13
13
 
14
14
  # Create list
15
15
  #
16
+ # @deprecated
17
+ #
16
18
  # @example
17
19
  # response = proactive_connect.list.create(name: 'List Number 1')
18
20
  #
@@ -47,6 +49,7 @@ module Vonage
47
49
  # @see https://developer.vonage.com/en/api/proactive-connect#listsCreate
48
50
  #
49
51
  def create(name:, **params)
52
+ logger.info('This method is deprecated and will be removed in a future release.')
50
53
  request(
51
54
  "/v0.1/bulk/lists",
52
55
  params: params.merge({ name: name }),
@@ -56,6 +59,8 @@ module Vonage
56
59
 
57
60
  # Get list by id
58
61
  #
62
+ # @deprecated
63
+ #
59
64
  # @example
60
65
  # response = proactive_connect.list.find(id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
61
66
  #
@@ -65,11 +70,14 @@ module Vonage
65
70
  # @see https://developer.vonage.com/en/api/proactive-connect#listsGet
66
71
  #
67
72
  def find(id:)
73
+ logger.info('This method is deprecated and will be removed in a future release.')
68
74
  request("/v0.1/bulk/lists/#{id}")
69
75
  end
70
76
 
71
77
  # Update list
72
78
  #
79
+ # @deprecated
80
+ #
73
81
  # @example
74
82
  # response = proactive_connect.list.update(name: 'List Number 1')
75
83
  #
@@ -107,6 +115,7 @@ module Vonage
107
115
  # @see https://developer.vonage.com/en/api/proactive-connect#listsUpdate
108
116
  #
109
117
  def update(id:, name:, **params)
118
+ logger.info('This method is deprecated and will be removed in a future release.')
110
119
  request(
111
120
  "/v0.1/bulk/lists/#{id}",
112
121
  params: params.merge({ name: name }),
@@ -116,6 +125,8 @@ module Vonage
116
125
 
117
126
  # Delete a list by id
118
127
  #
128
+ # @deprecated
129
+ #
119
130
  # @example
120
131
  # response = proactive_connect.list.delete(id: '74ea1ecf-06c9-4072-a285-61677bd353e8')
121
132
  #
@@ -125,6 +136,7 @@ module Vonage
125
136
  # @see https://developer.vonage.com/en/api/proactive-connect#listsDelete
126
137
  #
127
138
  def delete(id:)
139
+ logger.info('This method is deprecated and will be removed in a future release.')
128
140
  request(
129
141
  "/v0.1/bulk/lists/#{id}",
130
142
  type: Delete
@@ -133,6 +145,8 @@ module Vonage
133
145
 
134
146
  # Clear list by deleting all items
135
147
  #
148
+ # @deprecated
149
+ #
136
150
  # @example
137
151
  # response = proactive_connect.list.clear_items(id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
138
152
  #
@@ -142,6 +156,7 @@ module Vonage
142
156
  # @see https://developer.vonage.com/en/api/proactive-connect#listsClear
143
157
  #
144
158
  def clear_items(id:)
159
+ logger.info('This method is deprecated and will be removed in a future release.')
145
160
  request(
146
161
  "/v0.1/bulk/lists/#{id}/clear",
147
162
  type: Post
@@ -150,6 +165,8 @@ module Vonage
150
165
 
151
166
  # Fetch and replace all items from datasource
152
167
  #
168
+ # @deprecated
169
+ #
153
170
  # @example
154
171
  # response = proactive_connect.list.fetch_and_replace_items(id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
155
172
  #
@@ -159,6 +176,7 @@ module Vonage
159
176
  # @see https://developer.vonage.com/en/api/proactive-connect#listsFetch
160
177
  #
161
178
  def fetch_and_replace_items(id:)
179
+ logger.info('This method is deprecated and will be removed in a future release.')
162
180
  request(
163
181
  "/v0.1/bulk/lists/#{id}/fetch",
164
182
  type: Post
@@ -11,6 +11,8 @@ module Vonage
11
11
 
12
12
  # Find all lists
13
13
  #
14
+ # @deprecated
15
+ #
14
16
  # @example
15
17
  # response = proactive_connect.lists.list
16
18
  #
@@ -26,6 +28,7 @@ module Vonage
26
28
  # @see https://developer.vonage.com/en/api/proactive-connect#listsFindAll
27
29
  #
28
30
  def list(**params)
31
+ logger.info('This method is deprecated and will be removed in a future release.')
29
32
  path = "/v0.1/bulk/lists"
30
33
  path += "?#{Params.encode(params)}" unless params.empty?
31
34
 
@@ -5,28 +5,38 @@ module Vonage
5
5
  class ProactiveConnect < Namespace
6
6
  extend T::Sig
7
7
 
8
+ # @deprecated
8
9
  sig { returns(T.nilable(Vonage::ProactiveConnect::Lists)) }
9
10
  def lists
11
+ logger.info('This method is deprecated and will be removed in a future release.')
10
12
  @lists ||= Lists.new(@config)
11
13
  end
12
14
 
15
+ # @deprecated
13
16
  sig { returns(T.nilable(Vonage::ProactiveConnect::List)) }
14
17
  def list
18
+ logger.info('This method is deprecated and will be removed in a future release.')
15
19
  @list ||= List.new(@config)
16
20
  end
17
21
 
22
+ # @deprecated
18
23
  sig { returns(T.nilable(Vonage::ProactiveConnect::Items)) }
19
24
  def items
25
+ logger.info('This method is deprecated and will be removed in a future release.')
20
26
  @items ||= Items.new(@config)
21
27
  end
22
28
 
29
+ # @deprecated
23
30
  sig { returns(T.nilable(Vonage::ProactiveConnect::Item)) }
24
31
  def item
32
+ logger.info('This method is deprecated and will be removed in a future release.')
25
33
  @item ||= Item.new(@config)
26
34
  end
27
35
 
36
+ # @deprecated
28
37
  sig { returns(T.nilable(Vonage::ProactiveConnect::Events)) }
29
38
  def events
39
+ logger.info('This method is deprecated and will be removed in a future release.')
30
40
  @events ||= Events.new(@config)
31
41
  end
32
42
  end
@@ -1,5 +1,5 @@
1
1
  # typed: strong
2
2
 
3
3
  module Vonage
4
- VERSION = '7.26.0'
4
+ VERSION = '7.27.0'
5
5
  end
@@ -107,9 +107,13 @@ module Vonage
107
107
  end
108
108
 
109
109
  def verify_event_url
110
- uri = URI.parse(self.eventUrl)
110
+ unless self.eventUrl.is_a?(Array) && self.eventUrl.length == 1 && self.eventUrl[0].is_a?(String)
111
+ raise ClientError.new("Expected 'eventUrl' parameter to be an Array containing a single string item")
112
+ end
113
+
114
+ uri = URI.parse(self.eventUrl[0])
111
115
 
112
- raise ClientError.new("Invalid 'eventUrl' value, must be a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
116
+ raise ClientError.new("Invalid 'eventUrl' value, array must contain a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
113
117
 
114
118
  self.eventUrl
115
119
  end
@@ -49,9 +49,15 @@ module Vonage
49
49
  end
50
50
 
51
51
  def verify_music_on_hold_url
52
- uri = URI.parse(self.musicOnHoldUrl)
52
+ music_on_hold_url = self.musicOnHoldUrl
53
53
 
54
- raise ClientError.new("Invalid 'musicOnHoldUrl' value, must be a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
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])
59
+
60
+ raise ClientError.new("Invalid 'musicOnHoldUrl' value, array must contain a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
55
61
 
56
62
  self.musicOnHoldUrl
57
63
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Vonage
5
5
  class Voice::Actions::Input
6
- attr_accessor :type, :dtmf, :speech, :eventUrl, :eventMethod
6
+ attr_accessor :type, :dtmf, :speech, :eventUrl, :eventMethod, :mode
7
7
 
8
8
  def initialize(attributes = {})
9
9
  @type = attributes.fetch(:type)
@@ -11,6 +11,7 @@ module Vonage
11
11
  @speech = attributes.fetch(:speech, nil)
12
12
  @eventUrl = attributes.fetch(:eventUrl, nil)
13
13
  @eventMethod = attributes.fetch(:eventMethod, nil)
14
+ @mode = attributes.fetch(:mode, nil)
14
15
 
15
16
  after_initialize!
16
17
  end
@@ -33,6 +34,10 @@ module Vonage
33
34
  if self.eventMethod
34
35
  validate_event_method
35
36
  end
37
+
38
+ if self.mode
39
+ validate_mode
40
+ end
36
41
  end
37
42
 
38
43
  def validate_type
@@ -83,9 +88,13 @@ module Vonage
83
88
  end
84
89
 
85
90
  def validate_event_url
86
- uri = URI.parse(self.eventUrl)
91
+ unless self.eventUrl.is_a?(Array) && self.eventUrl.length == 1 && self.eventUrl[0].is_a?(String)
92
+ raise ClientError.new("Expected 'eventUrl' parameter to be an Array containing a single string item")
93
+ end
94
+
95
+ uri = URI.parse(self.eventUrl[0])
87
96
 
88
- raise ClientError.new("Invalid 'eventUrl' value, must be a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
97
+ raise ClientError.new("Invalid 'eventUrl' value, array must contain a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
89
98
 
90
99
  self.eventUrl
91
100
  end
@@ -96,6 +105,12 @@ module Vonage
96
105
  raise ClientError.new("Invalid 'eventMethod' value. must be either: 'GET' or 'POST'") unless valid_methods.include?(self.eventMethod.upcase)
97
106
  end
98
107
 
108
+ def validate_mode
109
+ valid_modes = ['asyncronous']
110
+
111
+ raise ClientError.new("Invalid 'mode' value, must be asyncronous'") unless valid_modes.include?(self.mode)
112
+ end
113
+
99
114
  def action
100
115
  create_input!(self)
101
116
  end
@@ -112,6 +127,7 @@ module Vonage
112
127
  ncco[0].merge!(speech: builder.speech) if builder.speech
113
128
  ncco[0].merge!(eventUrl: builder.eventUrl) if builder.eventUrl
114
129
  ncco[0].merge!(eventMethod: builder.eventMethod) if builder.eventMethod
130
+ ncco[0].merge!(mode: builder.mode) if builder.mode
115
131
 
116
132
  ncco
117
133
  end
@@ -22,10 +22,15 @@ module Vonage
22
22
  end
23
23
 
24
24
  def validate_event_url
25
- uri = URI.parse(self.eventUrl[0])
25
+ event_url = self.eventUrl
26
26
 
27
- raise ClientError.new("Expected 'eventUrl' value to be an Array with a single string") unless self.eventUrl.is_a?(Array)
28
- raise ClientError.new("Invalid 'eventUrl' value, must be a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
27
+ unless event_url.is_a?(Array) && event_url.length == 1 && event_url[0].is_a?(String)
28
+ raise ClientError.new("Expected 'eventUrl' parameter to be an Array containing a single string item")
29
+ end
30
+
31
+ uri = URI.parse(event_url[0])
32
+
33
+ raise ClientError.new("Invalid 'eventUrl' value, array must contain a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
29
34
 
30
35
  self.eventUrl
31
36
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Vonage
5
5
  class Voice::Actions::Record
6
- attr_accessor :format, :split, :channels, :endOnSilence, :endOnKey, :timeOut, :beepStart, :eventUrl, :eventMethod
6
+ attr_accessor :format, :split, :channels, :endOnSilence, :endOnKey, :timeOut, :beepStart, :eventUrl, :eventMethod, :transcription
7
7
 
8
8
  def initialize(attributes = {})
9
9
  @format = attributes.fetch(:format, nil)
@@ -15,6 +15,7 @@ module Vonage
15
15
  @beepStart = attributes.fetch(:beepStart, nil)
16
16
  @eventUrl = attributes.fetch(:eventUrl, nil)
17
17
  @eventMethod = attributes.fetch(:eventMethod, nil)
18
+ @transcription = attributes.fetch(:transcription, nil)
18
19
 
19
20
  after_initialize!
20
21
  end
@@ -55,6 +56,10 @@ module Vonage
55
56
  if self.eventMethod
56
57
  validate_event_method
57
58
  end
59
+
60
+ if self.transcription
61
+ validate_transcription
62
+ end
58
63
  end
59
64
 
60
65
  def validate_format
@@ -90,9 +95,13 @@ module Vonage
90
95
  end
91
96
 
92
97
  def validate_event_url
93
- uri = URI.parse(self.eventUrl)
98
+ unless self.eventUrl.is_a?(Array) && self.eventUrl.length == 1 && self.eventUrl[0].is_a?(String)
99
+ raise ClientError.new("Expected 'eventUrl' parameter to be an Array containing a single string item")
100
+ end
94
101
 
95
- raise ClientError.new("Invalid 'eventUrl' value, must be a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
102
+ uri = URI.parse(self.eventUrl[0])
103
+
104
+ raise ClientError.new("Invalid 'eventUrl' value, array must contain a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
96
105
 
97
106
  self.eventUrl
98
107
  end
@@ -100,7 +109,45 @@ module Vonage
100
109
  def validate_event_method
101
110
  valid_methods = ['GET', 'POST']
102
111
 
103
- raise ClientError.new("Invalid 'eventMethod' value. must be either: 'GET' or 'POST'") unless valid_methods.include?(self.eventMethod.upcase)
112
+ raise ClientError.new("Invalid 'eventMethod' value. Must be either: 'GET' or 'POST'") unless valid_methods.include?(self.eventMethod.upcase)
113
+ end
114
+
115
+ def validate_transcription
116
+ raise ClientError.new("Expected 'transcription' parameter to be a Hash") unless self.transcription.is_a?(Hash)
117
+
118
+ if self.transcription[:language]
119
+ raise ClientError.new("Invalid 'language' value, must be a String") unless self.transcription[:language].is_a?(String)
120
+ end
121
+
122
+ if self.transcription[:eventUrl]
123
+ event_url = self.transcription[:eventUrl]
124
+
125
+ unless event_url.is_a?(Array) && event_url.length == 1 && event_url[0].is_a?(String)
126
+ raise ClientError.new("Expected 'eventUrl' parameter to be an Array containing a single string item")
127
+ end
128
+
129
+ uri = URI.parse(event_url[0])
130
+
131
+ raise ClientError.new("Invalid 'eventUrl' value, array must contain a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
132
+ end
133
+
134
+ if self.transcription[:eventMethod]
135
+ event_method = self.transcription[:eventMethod]
136
+ raise ClientError.new("Invalid 'eventMethod' value, must be either: 'GET' or 'POST'") unless ['GET', 'POST'].include?(event_method.upcase)
137
+ end
138
+
139
+ if self.transcription[:sentimentAnalysis]
140
+ sentiment_analysis = self.transcription[:sentimentAnalysis]
141
+ raise ClientError.new("Invalid 'sentimentAnalysis' value, must be a Boolean") unless sentiment_analysis == true || sentiment_analysis == false
142
+ end
143
+
144
+ # if self.dtmf[:maxDigits]
145
+ # raise ClientError.new("Expected 'maxDigits' to not be more than 22") if self.dtmf[:maxDigits] > 22
146
+ # end
147
+
148
+ # if self.dtmf[:submitOnHash]
149
+ # raise ClientError.new("Invalid 'submitOnHash' value, must be a Boolean") unless self.dtmf[:submitOnHash] == true || self.dtmf[:submitOnHash] == false
150
+ # end
104
151
  end
105
152
 
106
153
  def action
@@ -123,6 +170,7 @@ module Vonage
123
170
  ncco[0].merge!(beepStart: builder.beepStart) if builder.beepStart
124
171
  ncco[0].merge!(eventUrl: builder.eventUrl) if builder.eventUrl
125
172
  ncco[0].merge!(eventMethod: builder.eventMethod) if builder.eventMethod
173
+ ncco[0].merge!(transcription: builder.transcription) if builder.transcription
126
174
 
127
175
  ncco
128
176
  end
@@ -3,13 +3,16 @@
3
3
 
4
4
  module Vonage
5
5
  class Voice::Actions::Stream
6
- attr_accessor :streamUrl, :level, :bargeIn, :loop
6
+ attr_accessor :streamUrl, :level, :bargeIn, :loop, :eventOnCompletion, :eventUrl, :eventMethod
7
7
 
8
8
  def initialize(attributes = {})
9
9
  @streamUrl = attributes.fetch(:streamUrl)
10
10
  @level = attributes.fetch(:level, nil)
11
11
  @bargeIn = attributes.fetch(:bargeIn, nil)
12
12
  @loop = attributes.fetch(:loop, nil)
13
+ @eventOnCompletion = attributes.fetch(:eventOnCompletion, nil)
14
+ @eventUrl = attributes.fetch(:eventUrl, nil)
15
+ @eventMethod = attributes.fetch(:eventMethod, nil)
13
16
 
14
17
  after_initialize!
15
18
  end
@@ -28,12 +31,28 @@ module Vonage
28
31
  if self.loop
29
32
  verify_loop
30
33
  end
34
+
35
+ if self.eventOnCompletion || self.eventOnCompletion == false
36
+ verify_event_on_completion
37
+ end
38
+
39
+ if self.eventUrl
40
+ verify_event_url
41
+ end
42
+
43
+ if self.eventMethod
44
+ verify_event_method
45
+ end
31
46
  end
32
47
 
33
48
  def verify_stream_url
34
- raise ClientError.new("Expected 'streamUrl' parameter to be an Array containing a single string item") unless self.streamUrl.is_a?(Array)
49
+ stream_url = self.streamUrl
50
+
51
+ unless stream_url.is_a?(Array) && stream_url.length == 1 && stream_url[0].is_a?(String)
52
+ raise ClientError.new("Expected 'streamUrl' parameter to be an Array containing a single string item")
53
+ end
35
54
 
36
- uri = URI.parse(self.streamUrl[0])
55
+ uri = URI.parse(stream_url[0])
37
56
 
38
57
  raise ClientError.new("Invalid 'streamUrl' value, must be a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
39
58
  end
@@ -47,7 +66,29 @@ module Vonage
47
66
  end
48
67
 
49
68
  def verify_loop
50
- raise ClientError.new("Expected 'loop' value to be either 1 or 0") unless self.loop == 1 || self.loop == 0
69
+ raise ClientError.new("Expected 'loop' value to be either 0 or a positive integer") unless self.loop >= 0
70
+ end
71
+
72
+ def verify_event_on_completion
73
+ raise ClientError.new("Expected 'eventOnCompletion' value to be a Boolean") unless self.eventOnCompletion == true || self.eventOnCompletion == false
74
+ end
75
+
76
+ def verify_event_url
77
+ unless self.eventUrl.is_a?(Array) && self.eventUrl.length == 1 && self.eventUrl[0].is_a?(String)
78
+ raise ClientError.new("Expected 'eventUrl' parameter to be an Array containing a single string item")
79
+ end
80
+
81
+ uri = URI.parse(self.eventUrl[0])
82
+
83
+ raise ClientError.new("Invalid 'eventUrl' value, array must contain a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
84
+
85
+ self.eventUrl
86
+ end
87
+
88
+ def verify_event_method
89
+ valid_methods = ['GET', 'POST']
90
+
91
+ raise ClientError.new("Invalid 'eventMethod' value. must be either: 'GET' or 'POST'") unless valid_methods.include?(self.eventMethod.upcase)
51
92
  end
52
93
 
53
94
  def action
@@ -65,6 +106,9 @@ module Vonage
65
106
  ncco[0].merge!(level: builder.level) if builder.level
66
107
  ncco[0].merge!(bargeIn: builder.bargeIn) if (builder.bargeIn || builder.bargeIn == false)
67
108
  ncco[0].merge!(loop: builder.loop) if builder.loop
109
+ ncco[0].merge!(eventOnCompletion: builder.eventOnCompletion) if (builder.eventOnCompletion || builder.eventOnCompletion == false)
110
+ ncco[0].merge!(eventUrl: builder.eventUrl) if builder.eventUrl
111
+ ncco[0].merge!(eventMethod: builder.eventMethod) if builder.eventMethod
68
112
 
69
113
  ncco
70
114
  end
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
  module Vonage
4
4
  class Voice::Actions::Talk
5
- attr_accessor :text, :bargeIn, :loop, :level, :language, :style, :premium
5
+ attr_accessor :text, :bargeIn, :loop, :level, :language, :style, :premium, :eventOnCompletion, :eventUrl, :eventMethod
6
6
 
7
7
  def initialize(attributes= {})
8
8
  @text = attributes.fetch(:text)
@@ -12,12 +12,15 @@ module Vonage
12
12
  @language = attributes.fetch(:language, nil)
13
13
  @style = attributes.fetch(:style, nil)
14
14
  @premium = attributes.fetch(:premium, nil)
15
+ @eventOnCompletion = attributes.fetch(:eventOnCompletion, nil)
16
+ @eventUrl = attributes.fetch(:eventUrl, nil)
17
+ @eventMethod = attributes.fetch(:eventMethod, nil)
15
18
 
16
19
  after_initialize!
17
20
  end
18
21
 
19
22
  def after_initialize!
20
- if self.bargeIn
23
+ if self.bargeIn || self.bargeIn == false
21
24
  verify_barge_in
22
25
  end
23
26
 
@@ -33,9 +36,21 @@ module Vonage
33
36
  verify_style
34
37
  end
35
38
 
36
- if self.premium
39
+ if self.premium || self.premium == false
37
40
  verify_premium
38
41
  end
42
+
43
+ if self.eventOnCompletion || self.eventOnCompletion == false
44
+ verify_event_on_completion
45
+ end
46
+
47
+ if self.eventUrl
48
+ verify_event_url
49
+ end
50
+
51
+ if self.eventMethod
52
+ verify_event_method
53
+ end
39
54
  end
40
55
 
41
56
  def verify_barge_in
@@ -43,7 +58,7 @@ module Vonage
43
58
  end
44
59
 
45
60
  def verify_loop
46
- raise ClientError.new("Expected 'loop' value to be either 1 or 0") unless self.loop == 1 || self.loop == 0
61
+ raise ClientError.new("Expected 'loop' value to be either 0 or a positive integer") unless self.loop >= 0
47
62
  end
48
63
 
49
64
  def verify_level
@@ -58,6 +73,28 @@ module Vonage
58
73
  raise ClientError.new("Expected 'premium' value to be a Boolean") unless self.premium == true || self.premium == false
59
74
  end
60
75
 
76
+ def verify_event_on_completion
77
+ raise ClientError.new("Expected 'eventOnCompletion' value to be a Boolean") unless self.eventOnCompletion == true || self.eventOnCompletion == false
78
+ end
79
+
80
+ def verify_event_url
81
+ unless self.eventUrl.is_a?(Array) && self.eventUrl.length == 1 && self.eventUrl[0].is_a?(String)
82
+ raise ClientError.new("Expected 'eventUrl' parameter to be an Array containing a single string item")
83
+ end
84
+
85
+ uri = URI.parse(self.eventUrl[0])
86
+
87
+ raise ClientError.new("Invalid 'eventUrl' value, array must contain a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
88
+
89
+ self.eventUrl
90
+ end
91
+
92
+ def verify_event_method
93
+ valid_methods = ['GET', 'POST']
94
+
95
+ raise ClientError.new("Invalid 'eventMethod' value. must be either: 'GET' or 'POST'") unless valid_methods.include?(self.eventMethod.upcase)
96
+ end
97
+
61
98
  def action
62
99
  create_talk!(self)
63
100
  end
@@ -75,6 +112,10 @@ module Vonage
75
112
  ncco[0].merge!(level: builder.level) if builder.level
76
113
  ncco[0].merge!(language: builder.language) if builder.language
77
114
  ncco[0].merge!(style: builder.style) if builder.style
115
+ ncco[0].merge!(premium: builder.premium) if (builder.bargeIn || builder.bargeIn == false)
116
+ ncco[0].merge!(eventOnCompletion: builder.eventOnCompletion) if (builder.eventOnCompletion || builder.eventOnCompletion == false)
117
+ ncco[0].merge!(eventUrl: builder.eventUrl) if builder.eventUrl
118
+ ncco[0].merge!(eventMethod: builder.eventMethod) if builder.eventMethod
78
119
 
79
120
  ncco
80
121
  end
data/lib/vonage.rb CHANGED
@@ -13,6 +13,7 @@ module Vonage
13
13
  'http' => 'HTTP',
14
14
  'json' => 'JSON',
15
15
  'jwt' => 'JWT',
16
+ 'rcs' => 'RCS',
16
17
  'sip' => 'SIP',
17
18
  'sms' => 'SMS',
18
19
  'network_sim_swap' => 'NetworkSIMSwap',
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.26.0
4
+ version: 7.27.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-08-08 00:00:00.000000000 Z
11
+ date: 2024-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vonage-jwt
@@ -184,6 +184,7 @@ files:
184
184
  - lib/vonage/messaging.rb
185
185
  - lib/vonage/messaging/channels/messenger.rb
186
186
  - lib/vonage/messaging/channels/mms.rb
187
+ - lib/vonage/messaging/channels/rcs.rb
187
188
  - lib/vonage/messaging/channels/sms.rb
188
189
  - lib/vonage/messaging/channels/viber.rb
189
190
  - lib/vonage/messaging/channels/whats_app.rb