vonage 7.25.0 → 7.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -13
- data/lib/vonage/basic.rb +1 -1
- data/lib/vonage/bearer_token.rb +1 -1
- data/lib/vonage/client.rb +14 -0
- data/lib/vonage/key_secret_params.rb +3 -2
- data/lib/vonage/keys.rb +4 -1
- data/lib/vonage/meetings/applications.rb +3 -0
- data/lib/vonage/meetings/dial_in_numbers.rb +3 -0
- data/lib/vonage/meetings/recordings.rb +6 -0
- data/lib/vonage/meetings/rooms.rb +12 -0
- data/lib/vonage/meetings/sessions.rb +3 -0
- data/lib/vonage/meetings/themes.rb +21 -0
- data/lib/vonage/meetings.rb +12 -0
- data/lib/vonage/messaging/channels/rcs.rb +42 -0
- data/lib/vonage/messaging/message.rb +1 -0
- data/lib/vonage/messaging.rb +15 -1
- data/lib/vonage/namespace.rb +9 -12
- data/lib/vonage/network_authentication/client_authentication.rb +39 -0
- data/lib/vonage/network_authentication/server_authentication.rb +47 -0
- data/lib/vonage/network_authentication.rb +22 -0
- data/lib/vonage/network_number_verification.rb +92 -0
- data/lib/vonage/network_sim_swap.rb +84 -0
- data/lib/vonage/numbers.rb +11 -11
- data/lib/vonage/proactive_connect/events.rb +3 -0
- data/lib/vonage/proactive_connect/item.rb +12 -0
- data/lib/vonage/proactive_connect/items.rb +9 -0
- data/lib/vonage/proactive_connect/list.rb +18 -0
- data/lib/vonage/proactive_connect/lists.rb +3 -0
- data/lib/vonage/proactive_connect.rb +10 -0
- data/lib/vonage/verify2/start_verification_options.rb +2 -1
- data/lib/vonage/version.rb +1 -1
- data/lib/vonage/voice/actions/connect.rb +7 -2
- data/lib/vonage/voice/actions/conversation.rb +8 -2
- data/lib/vonage/voice/actions/input.rb +19 -3
- data/lib/vonage/voice/actions/notify.rb +8 -3
- data/lib/vonage/voice/actions/record.rb +52 -4
- data/lib/vonage/voice/actions/stream.rb +48 -4
- data/lib/vonage/voice/actions/talk.rb +45 -4
- data/lib/vonage/voice.rb +2 -0
- data/lib/vonage.rb +2 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ef29adae44fffb9754118333b6a82cac7172cb536eb2b4ec31644694c6388ef
|
4
|
+
data.tar.gz: 43496b6bcf0db687cdef8bdd4506db140fea685f48a306abc1aac4325f8300f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
|
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.
|
304
|
-
* [Application API](https://developer.
|
305
|
-
* [Conversation API](https://developer.
|
306
|
-
* [Voice API](https://developer.
|
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
|
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/
|
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.
|
517
|
+
Vonage APIs API reference: https://developer.vonage.com/api
|
521
518
|
|
522
519
|
## Supported APIs
|
523
520
|
|
@@ -528,6 +525,8 @@ The following is a list of Vonage APIs for which the Ruby SDK currently provides
|
|
528
525
|
* [Conversation API](https://developer.vonage.com/en/conversation/overview)
|
529
526
|
* [Meetings API](https://developer.vonage.com/en/meetings/overview)
|
530
527
|
* [Messages API](https://developer.vonage.com/en/messages/overview)
|
528
|
+
* [Network Number Verification API](https://developer.vonage.com/en/number-verification/overview)
|
529
|
+
* [Network SIM Swap API](https://developer.vonage.com/en/sim-swap/overview)
|
531
530
|
* [Number Insight API](https://developer.vonage.com/en/number-insight/overview)
|
532
531
|
* [Numbers API](https://developer.vonage.com/en/numbers/overview)
|
533
532
|
* [Proactive Connect API](https://developer.vonage.com/en/proactive-connect/overview) *
|
data/lib/vonage/basic.rb
CHANGED
data/lib/vonage/bearer_token.rb
CHANGED
data/lib/vonage/client.rb
CHANGED
@@ -91,6 +91,20 @@ module Vonage
|
|
91
91
|
@messaging ||= T.let(Messaging.new(config), T.nilable(Vonage::Messaging))
|
92
92
|
end
|
93
93
|
|
94
|
+
# @return [NetworkNumberVerification]
|
95
|
+
#
|
96
|
+
sig { returns(T.nilable(Vonage::NetworkNumberVerification)) }
|
97
|
+
def network_number_verification
|
98
|
+
@network_number_verification ||= T.let(NetworkNumberVerification.new(config), T.nilable(Vonage::NetworkNumberVerification))
|
99
|
+
end
|
100
|
+
|
101
|
+
# @return [NetworkSIMSwap]
|
102
|
+
#
|
103
|
+
sig { returns(T.nilable(Vonage::NetworkSIMSwap)) }
|
104
|
+
def network_sim_swap
|
105
|
+
@network_sim_swap ||= T.let(NetworkSIMSwap.new(config), T.nilable(Vonage::NetworkSIMSwap))
|
106
|
+
end
|
107
|
+
|
94
108
|
# @return [NumberInsight]
|
95
109
|
#
|
96
110
|
sig { returns(T.nilable(Vonage::NumberInsight)) }
|
@@ -5,9 +5,10 @@ module Vonage
|
|
5
5
|
extend T::Sig
|
6
6
|
|
7
7
|
sig { params(
|
8
|
-
object: T.any(T::Hash[T.untyped, T.untyped], URI::HTTPS, Net::HTTP::Post, Net::HTTP::Get)
|
8
|
+
object: T.any(T::Hash[T.untyped, T.untyped], URI::HTTPS, Net::HTTP::Post, Net::HTTP::Get),
|
9
|
+
data: T.nilable(Hash)
|
9
10
|
).void }
|
10
|
-
def update(object)
|
11
|
+
def update(object, data)
|
11
12
|
return unless object.is_a?(Hash)
|
12
13
|
|
13
14
|
@config = T.let(@config, T.nilable(Vonage::Config))
|
data/lib/vonage/keys.rb
CHANGED
@@ -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?
|
data/lib/vonage/meetings.rb
CHANGED
@@ -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
|
data/lib/vonage/messaging.rb
CHANGED
@@ -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
|
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
|
data/lib/vonage/namespace.rb
CHANGED
@@ -57,18 +57,15 @@ module Vonage
|
|
57
57
|
Post = Net::HTTP::Post
|
58
58
|
Delete = Net::HTTP::Delete
|
59
59
|
|
60
|
-
def build_request(path:, type: Get, params: {})
|
60
|
+
def build_request(path:, type: Get, params: {}, auth_data: nil)
|
61
61
|
authentication = self.class.authentication.new(@config)
|
62
|
-
authentication.update(params)
|
62
|
+
authentication.update(params, auth_data)
|
63
63
|
|
64
64
|
uri = URI("https://" + @host + path)
|
65
65
|
unless type.const_get(:REQUEST_HAS_BODY) || params.empty?
|
66
66
|
uri.query = Params.encode(params)
|
67
67
|
end
|
68
68
|
|
69
|
-
# Set BasicAuth if neeeded
|
70
|
-
authentication.update(uri)
|
71
|
-
|
72
69
|
# instantiate request
|
73
70
|
request = type.new(uri)
|
74
71
|
|
@@ -80,8 +77,8 @@ module Vonage
|
|
80
77
|
request["Accept"] = "application/json"
|
81
78
|
self.class.request_headers.each { |key, value| request[key] = value }
|
82
79
|
|
83
|
-
# Set
|
84
|
-
authentication.update(request)
|
80
|
+
# Set Authorization header if needed
|
81
|
+
authentication.update(request, auth_data)
|
85
82
|
|
86
83
|
# set body
|
87
84
|
if type.const_get(:REQUEST_HAS_BODY)
|
@@ -106,7 +103,7 @@ module Vonage
|
|
106
103
|
response
|
107
104
|
end
|
108
105
|
|
109
|
-
def request(path, params: nil, type: Get, response_class: Response, &block)
|
106
|
+
def request(path, params: nil, type: Get, response_class: Response, auth_data: nil, &block)
|
110
107
|
auto_advance =
|
111
108
|
(
|
112
109
|
if !params.nil? && params.key?(:auto_advance)
|
@@ -120,7 +117,7 @@ module Vonage
|
|
120
117
|
params.tap { |params| params.delete(:auto_advance) } if !params.nil? &&
|
121
118
|
params.key?(:auto_advance)
|
122
119
|
|
123
|
-
request = build_request(path: path, params: params || {}, type: type)
|
120
|
+
request = build_request(path: path, params: params || {}, type: type, auth_data: auth_data)
|
124
121
|
|
125
122
|
response = make_request!(request, &block)
|
126
123
|
|
@@ -139,7 +136,7 @@ module Vonage
|
|
139
136
|
end
|
140
137
|
end
|
141
138
|
|
142
|
-
def multipart_post_request(path, filepath:, file_name:, mime_type:, params: {}, override_uri: nil, no_auth: false, response_class: Response, &block)
|
139
|
+
def multipart_post_request(path, filepath:, file_name:, mime_type:, params: {}, override_uri: nil, no_auth: false, response_class: Response, auth_data: nil, &block)
|
143
140
|
authentication = self.class.authentication.new(@config) unless no_auth
|
144
141
|
|
145
142
|
uri = override_uri ? URI(override_uri) : URI('https://' + @host + path)
|
@@ -156,8 +153,8 @@ module Vonage
|
|
156
153
|
|
157
154
|
request['User-Agent'] = UserAgent.string(@config.app_name, @config.app_version)
|
158
155
|
|
159
|
-
# Set
|
160
|
-
authentication.update(request) unless no_auth
|
156
|
+
# Set Authorization header if needed
|
157
|
+
authentication.update(request, auth_data) unless no_auth
|
161
158
|
|
162
159
|
logger.log_request_info(request)
|
163
160
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Vonage
|
5
|
+
class NetworkAuthentication::ClientAuthentication < Namespace
|
6
|
+
extend T::Sig
|
7
|
+
|
8
|
+
self.authentication = BearerToken
|
9
|
+
|
10
|
+
self.host = :vonage_host
|
11
|
+
|
12
|
+
self.request_headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
13
|
+
|
14
|
+
def token(oidc_auth_code:, redirect_uri:, **params)
|
15
|
+
request(
|
16
|
+
'/oauth2/token',
|
17
|
+
params: {
|
18
|
+
grant_type: 'authorization_code',
|
19
|
+
code: oidc_auth_code,
|
20
|
+
redirect_uri: redirect_uri
|
21
|
+
},
|
22
|
+
type: Post
|
23
|
+
).access_token
|
24
|
+
end
|
25
|
+
|
26
|
+
def generate_oidc_uri(purpose:, api_scope:, login_hint:, redirect_uri:, state:)
|
27
|
+
scope = "openid%20dpv:#{purpose}%23#{api_scope}"
|
28
|
+
uri = "https://oidc.idp.vonage.com/oauth2/auth?" +
|
29
|
+
"client_id=#{@config.application_id}" +
|
30
|
+
"&response_type=code" +
|
31
|
+
"&scope=#{scope}" +
|
32
|
+
"&login_hint=#{login_hint}" +
|
33
|
+
"&redirect_uri=#{redirect_uri}" +
|
34
|
+
"&state=#{state}"
|
35
|
+
|
36
|
+
uri
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|