vonage 7.27.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 (111) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +89 -388
  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 -9
  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/jwt.rb +0 -17
  17. data/lib/vonage/key_secret_params.rb +2 -3
  18. data/lib/vonage/keys.rb +1 -11
  19. data/lib/vonage/logger.rb +3 -5
  20. data/lib/vonage/messaging/channels/viber.rb +1 -8
  21. data/lib/vonage/messaging/channels/whats_app.rb +1 -3
  22. data/lib/vonage/messaging/message.rb +0 -1
  23. data/lib/vonage/messaging.rb +4 -34
  24. data/lib/vonage/namespace.rb +68 -137
  25. data/lib/vonage/numbers.rb +17 -40
  26. data/lib/vonage/server_error.rb +1 -1
  27. data/lib/vonage/signature.rb +5 -5
  28. data/lib/vonage/sms.rb +20 -20
  29. data/lib/vonage/version.rb +1 -1
  30. data/lib/vonage/video/archives.rb +53 -18
  31. data/lib/vonage/video/list_response.rb +11 -0
  32. data/lib/vonage/video/moderation.rb +22 -7
  33. data/lib/vonage/video/signals.rb +9 -4
  34. data/lib/vonage/video/streams.rb +12 -6
  35. data/lib/vonage/video.rb +13 -50
  36. data/lib/vonage/voice/actions/connect.rb +5 -34
  37. data/lib/vonage/voice/actions/conversation.rb +4 -10
  38. data/lib/vonage/voice/actions/input.rb +3 -19
  39. data/lib/vonage/voice/actions/notify.rb +3 -8
  40. data/lib/vonage/voice/actions/pay.rb +107 -0
  41. data/lib/vonage/voice/actions/record.rb +4 -52
  42. data/lib/vonage/voice/actions/stream.rb +4 -48
  43. data/lib/vonage/voice/actions/talk.rb +4 -54
  44. data/lib/vonage/voice/talk.rb +1 -11
  45. data/lib/vonage/voice.rb +0 -24
  46. data/lib/vonage.rb +0 -4
  47. data/vonage.gemspec +1 -3
  48. metadata +9 -104
  49. data/lib/vonage/api_error.rb +0 -33
  50. data/lib/vonage/conversation/event/list_response.rb +0 -11
  51. data/lib/vonage/conversation/event.rb +0 -108
  52. data/lib/vonage/conversation/list_response.rb +0 -11
  53. data/lib/vonage/conversation/member/list_response.rb +0 -11
  54. data/lib/vonage/conversation/member.rb +0 -134
  55. data/lib/vonage/conversation/user/conversations_list_response.rb +0 -11
  56. data/lib/vonage/conversation/user/sessions_list_response.rb +0 -11
  57. data/lib/vonage/conversation/user.rb +0 -67
  58. data/lib/vonage/conversation.rb +0 -164
  59. data/lib/vonage/meetings/applications.rb +0 -28
  60. data/lib/vonage/meetings/dial_in_numbers/list_response.rb +0 -11
  61. data/lib/vonage/meetings/dial_in_numbers.rb +0 -26
  62. data/lib/vonage/meetings/recordings.rb +0 -42
  63. data/lib/vonage/meetings/rooms/list_response.rb +0 -11
  64. data/lib/vonage/meetings/rooms.rb +0 -167
  65. data/lib/vonage/meetings/sessions/list_response.rb +0 -11
  66. data/lib/vonage/meetings/sessions.rb +0 -31
  67. data/lib/vonage/meetings/themes/list_response.rb +0 -11
  68. data/lib/vonage/meetings/themes.rb +0 -239
  69. data/lib/vonage/meetings.rb +0 -50
  70. data/lib/vonage/messaging/channels/rcs.rb +0 -42
  71. data/lib/vonage/network_authentication/client_authentication.rb +0 -39
  72. data/lib/vonage/network_authentication/server_authentication.rb +0 -47
  73. data/lib/vonage/network_authentication.rb +0 -22
  74. data/lib/vonage/network_number_verification.rb +0 -92
  75. data/lib/vonage/network_sim_swap.rb +0 -84
  76. data/lib/vonage/number_insight_2.rb +0 -36
  77. data/lib/vonage/proactive_connect/events/list_response.rb +0 -11
  78. data/lib/vonage/proactive_connect/events.rb +0 -71
  79. data/lib/vonage/proactive_connect/item.rb +0 -116
  80. data/lib/vonage/proactive_connect/items/file_response.rb +0 -32
  81. data/lib/vonage/proactive_connect/items/list_response.rb +0 -11
  82. data/lib/vonage/proactive_connect/items.rb +0 -116
  83. data/lib/vonage/proactive_connect/list.rb +0 -186
  84. data/lib/vonage/proactive_connect/lists/list_response.rb +0 -11
  85. data/lib/vonage/proactive_connect/lists.rb +0 -38
  86. data/lib/vonage/proactive_connect.rb +0 -43
  87. data/lib/vonage/subaccounts/balance_transfers/list_response.rb +0 -11
  88. data/lib/vonage/subaccounts/credit_transfers/list_response.rb +0 -11
  89. data/lib/vonage/subaccounts/list_response.rb +0 -15
  90. data/lib/vonage/subaccounts.rb +0 -203
  91. data/lib/vonage/users/list_response.rb +0 -11
  92. data/lib/vonage/users.rb +0 -156
  93. data/lib/vonage/verify2/channels/email.rb +0 -36
  94. data/lib/vonage/verify2/channels/silent_auth.rb +0 -45
  95. data/lib/vonage/verify2/channels/sms.rb +0 -63
  96. data/lib/vonage/verify2/channels/voice.rb +0 -32
  97. data/lib/vonage/verify2/channels/whats_app.rb +0 -39
  98. data/lib/vonage/verify2/channels/whats_app_interactive.rb +0 -32
  99. data/lib/vonage/verify2/start_verification_options.rb +0 -63
  100. data/lib/vonage/verify2/workflow.rb +0 -39
  101. data/lib/vonage/verify2/workflow_builder.rb +0 -25
  102. data/lib/vonage/verify2.rb +0 -100
  103. data/lib/vonage/video/archives/list_response.rb +0 -11
  104. data/lib/vonage/video/broadcasts/list_response.rb +0 -11
  105. data/lib/vonage/video/broadcasts.rb +0 -75
  106. data/lib/vonage/video/captions.rb +0 -67
  107. data/lib/vonage/video/renders/list_response.rb +0 -11
  108. data/lib/vonage/video/renders.rb +0 -107
  109. data/lib/vonage/video/sip.rb +0 -48
  110. data/lib/vonage/video/streams/list_response.rb +0 -11
  111. data/lib/vonage/video/web_socket.rb +0 -61
data/lib/vonage/client.rb CHANGED
@@ -40,17 +40,8 @@ module Vonage
40
40
  @applications ||= T.let(Applications.new(config), T.nilable(Vonage::Applications))
41
41
  end
42
42
 
43
- # @return [Conversation]
44
- #
45
- sig { returns(T.nilable(Vonage::Conversation)) }
46
- def conversation
47
- @conversation ||= T.let(Conversation.new(config), T.nilable(Vonage::Conversation))
48
- end
49
-
50
43
  # @return [Conversations]
51
44
  #
52
- # @deprecated Please use {#conversation} instead
53
- #
54
45
  sig { returns(T.nilable(Vonage::Conversations)) }
55
46
  def conversations
56
47
  @conversations ||= T.let(Conversations.new(config), T.nilable(Vonage::Conversations))
@@ -70,13 +61,6 @@ module Vonage
70
61
  @files ||= T.let(Files.new(config), T.nilable(Vonage::Files))
71
62
  end
72
63
 
73
- # @return [Meetings]
74
- #
75
- sig { returns(T.nilable(Vonage::Meetings)) }
76
- def meetings
77
- @meetings ||= T.let(Meetings.new(config), T.nilable(Vonage::Meetings))
78
- end
79
-
80
64
  # @return [Messages]
81
65
  #
82
66
  sig { returns(T.nilable(Vonage::Messages)) }
@@ -91,20 +75,6 @@ module Vonage
91
75
  @messaging ||= T.let(Messaging.new(config), T.nilable(Vonage::Messaging))
92
76
  end
93
77
 
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
-
108
78
  # @return [NumberInsight]
109
79
  #
110
80
  sig { returns(T.nilable(Vonage::NumberInsight)) }
@@ -112,13 +82,6 @@ module Vonage
112
82
  @number_insight ||= T.let(NumberInsight.new(config), T.nilable(Vonage::NumberInsight))
113
83
  end
114
84
 
115
- # @return [NumberInsight2]
116
- #
117
- sig { returns(T.nilable(Vonage::NumberInsight2)) }
118
- def number_insight_2
119
- @number_insight_2 ||= T.let(NumberInsight2.new(config), T.nilable(Vonage::NumberInsight2))
120
- end
121
-
122
85
  # @return [Numbers]
123
86
  #
124
87
  sig { returns(T.nilable(Vonage::Numbers)) }
@@ -133,13 +96,6 @@ module Vonage
133
96
  @pricing ||= T.let(PricingTypes.new(config), T.nilable(Vonage::PricingTypes))
134
97
  end
135
98
 
136
- # @return [ProactiveConnect]
137
- #
138
- sig { returns(T.nilable(Vonage::ProactiveConnect)) }
139
- def proactive_connect
140
- @proactive_connect ||= T.let(ProactiveConnect.new(config), T.nilable(Vonage::ProactiveConnect))
141
- end
142
-
143
99
  # @return [Redact]
144
100
  #
145
101
  sig { returns(T.nilable(Vonage::Redact)) }
@@ -161,13 +117,6 @@ module Vonage
161
117
  @sms ||= T.let(SMS.new(config), T.nilable(Vonage::SMS))
162
118
  end
163
119
 
164
- # @return [Subaccounts]
165
- #
166
- sig { returns(T.nilable(Vonage::Subaccounts)) }
167
- def subaccounts
168
- @subaccounts ||= T.let(Subaccounts.new(config), T.nilable(Vonage::Subaccounts))
169
- end
170
-
171
120
  # @return [TFA]
172
121
  #
173
122
  sig { returns(T.nilable(Vonage::TFA)) }
@@ -175,13 +124,6 @@ module Vonage
175
124
  @tfa ||= T.let(TFA.new(config), T.nilable(Vonage::TFA))
176
125
  end
177
126
 
178
- # @return [Users]
179
- #
180
- sig { returns(T.nilable(Vonage::Users)) }
181
- def users
182
- @users ||= T.let(Users.new(config), T.nilable(Vonage::Users))
183
- end
184
-
185
127
  # @return [Verify]
186
128
  #
187
129
  sig { returns(T.nilable(Vonage::Verify)) }
@@ -189,13 +131,6 @@ module Vonage
189
131
  @verify ||= T.let(Verify.new(config), T.nilable(Vonage::Verify))
190
132
  end
191
133
 
192
- # @return [Verify2]
193
- #
194
- sig { returns(T.nilable(Vonage::Verify2)) }
195
- def verify2
196
- @verify2 ||= T.let(Verify2.new(config), T.nilable(Vonage::Verify2))
197
- end
198
-
199
134
  # @return [Video]
200
135
  #
201
136
  sig { returns(T.nilable(Vonage::Video)) }
@@ -1,6 +1,6 @@
1
1
  # typed: strong
2
2
 
3
3
  module Vonage
4
- class ClientError < APIError
4
+ class ClientError < Error
5
5
  end
6
6
  end
data/lib/vonage/config.rb CHANGED
@@ -19,7 +19,6 @@ module Vonage
19
19
  self.signature_method = ENV['VONAGE_SIGNATURE_METHOD'] || 'md5hash'
20
20
  self.token = T.let(nil, T.nilable(String))
21
21
  self.video_host = 'video.api.vonage.com'
22
- self.vonage_host = 'api-eu.vonage.com'
23
22
  end
24
23
 
25
24
  # Merges the config with the given options hash.
@@ -131,11 +130,7 @@ module Vonage
131
130
 
132
131
  # @return [Vonage::Logger]
133
132
  #
134
- sig { params(logger: T.nilable(
135
- defined?(ActiveSupport::BroadcastLogger) ?
136
- T.any(::Logger, Vonage::Logger, ActiveSupport::BroadcastLogger)
137
- : T.any(::Logger, Vonage::Logger)
138
- )).returns(T.nilable(Vonage::Logger)) }
133
+ sig { params(logger: T.nilable(T.any(::Logger, Vonage::Logger))).returns(T.nilable(Vonage::Logger)) }
139
134
  def logger=(logger)
140
135
  @logger = T.let(Logger.new(logger), T.nilable(Vonage::Logger))
141
136
  end
@@ -206,9 +201,6 @@ module Vonage
206
201
 
207
202
  sig { returns(String) }
208
203
  attr_accessor :video_host
209
-
210
- sig { returns(String) }
211
- attr_accessor :vonage_host
212
204
 
213
205
  protected
214
206
 
@@ -9,8 +9,6 @@ module Vonage
9
9
 
10
10
  # Create an event.
11
11
  #
12
- # @deprecated Please use {Vonage::Conversation::Event#create} instead
13
- #
14
12
  # @option params [required, String] :type
15
13
  # Event type.
16
14
  #
@@ -31,14 +29,11 @@ module Vonage
31
29
  # @see https://developer.nexmo.com/api/conversation#createEvent
32
30
  #
33
31
  def create(conversation_id, params)
34
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation::Event#create` instead.')
35
32
  request('/beta/conversations/' + conversation_id + '/events', params: params, type: Post)
36
33
  end
37
34
 
38
35
  # List events.
39
36
  #
40
- # @deprecated Please use {Vonage::Conversation::Event#list} instead
41
- #
42
37
  # @param [String] conversation_id
43
38
  #
44
39
  # @option params [Boolean] :auto_advance
@@ -50,14 +45,11 @@ module Vonage
50
45
  # @see https://developer.nexmo.com/api/conversation#getEvents
51
46
  #
52
47
  def list(conversation_id, params = nil, auto_advance = true)
53
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation::Event#list` instead.')
54
48
  request('/beta/conversations/' + conversation_id + '/events', params: params)
55
49
  end
56
50
 
57
51
  # Retrieve an event.
58
52
  #
59
- # @deprecated Please use {Vonage::Conversation::Event#find} instead
60
- #
61
53
  # @param [String] conversation_id
62
54
  # @param [String] event_id
63
55
  #
@@ -66,14 +58,11 @@ module Vonage
66
58
  # @see https://developer.nexmo.com/api/conversation#getEvent
67
59
  #
68
60
  def get(conversation_id, event_id)
69
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation::Event#find` instead.')
70
61
  request('/beta/conversations/' + conversation_id + '/events/' + event_id.to_s)
71
62
  end
72
63
 
73
64
  # Delete an event.
74
65
  #
75
- # @deprecated Please use {Vonage::Conversation::Event#delete} instead
76
- #
77
66
  # @param [String] conversation_id
78
67
  # @param [String] event_id
79
68
  #
@@ -82,7 +71,6 @@ module Vonage
82
71
  # @see https://developer.nexmo.com/api/conversation#deleteEvent
83
72
  #
84
73
  def delete(conversation_id, event_id)
85
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation::Event#delete` instead.')
86
74
  request('/beta/conversations/' + conversation_id + '/events/' + event_id.to_s, type: Delete)
87
75
  end
88
76
  end
@@ -7,8 +7,6 @@ module Vonage
7
7
 
8
8
  # List legs.
9
9
  #
10
- # @deprecated
11
- #
12
10
  # @option params [Boolean] :auto_advance
13
11
  # Set this to `false` to not auto-advance through all the pages in the record
14
12
  # and collect all the data. The default is `true`.
@@ -18,14 +16,11 @@ module Vonage
18
16
  # @see https://developer.nexmo.com/api/conversation#listLegs
19
17
  #
20
18
  def list(params = nil, auto_advance = true)
21
- logger.info('This method is deprecated and will be removed in a future release.')
22
19
  request('/beta/legs', params: params)
23
20
  end
24
21
 
25
22
  # Delete a leg.
26
23
  #
27
- # @deprecated
28
- #
29
24
  # @param [String] leg_id
30
25
  #
31
26
  # @return [Response]
@@ -33,7 +28,6 @@ module Vonage
33
28
  # @see https://developer.nexmo.com/api/conversation#deleteLeg
34
29
  #
35
30
  def delete(leg_id)
36
- logger.info('This method is deprecated and will be removed in a future release.')
37
31
  request('/beta/legs/' + leg_id, type: Delete)
38
32
  end
39
33
  end
@@ -9,8 +9,6 @@ module Vonage
9
9
 
10
10
  # Create a member.
11
11
  #
12
- # @deprecated Please use {Vonage::Conversation::Member#create} instead
13
- #
14
12
  # @option params [String] :action
15
13
  # Invite or join a member to a conversation.
16
14
  # Must be one of: `invite` or `join`.
@@ -42,14 +40,11 @@ module Vonage
42
40
  # @see https://developer.nexmo.com/api/conversation#createMember
43
41
  #
44
42
  def create(conversation_id, params)
45
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation::Member#create` instead.')
46
43
  request('/beta/conversations/' + conversation_id + '/members', params: params, type: Post)
47
44
  end
48
45
 
49
46
  # List members.
50
47
  #
51
- # @deprecated Please use {Vonage::Conversation::Member#list} instead
52
- #
53
48
  # @param [String] conversation_id
54
49
  #
55
50
  # @option params [Boolean] :auto_advance
@@ -61,14 +56,11 @@ module Vonage
61
56
  # @see https://developer.nexmo.com/api/conversation#getMembers
62
57
  #
63
58
  def list(conversation_id, params = nil, auto_advance = true)
64
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation::Member#list` instead.')
65
59
  request('/beta/conversations/' + conversation_id + '/members', params: params)
66
60
  end
67
61
 
68
62
  # Retrieve a member.
69
63
  #
70
- # @deprecated Please use {Vonage::Conversation::Member#find} instead
71
- #
72
64
  # @param [String] conversation_id
73
65
  # @param [String] member_id
74
66
  #
@@ -77,14 +69,11 @@ module Vonage
77
69
  # @see https://developer.nexmo.com/api/conversation#getMember
78
70
  #
79
71
  def get(conversation_id, member_id)
80
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation::Member#find` instead.')
81
72
  request('/beta/conversations/' + conversation_id + '/members/' + member_id)
82
73
  end
83
74
 
84
75
  # Update a member.
85
76
  #
86
- # @deprecated Please use {Vonage::Conversation::Member#update} instead
87
- #
88
77
  # @option params [String] :action
89
78
  # Invite or join a member to a conversation.
90
79
  #
@@ -100,14 +89,11 @@ module Vonage
100
89
  # @see https://developer.nexmo.com/api/conversation#updateMember
101
90
  #
102
91
  def update(conversation_id, member_id, params)
103
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation::Member#update` instead.')
104
92
  request('/beta/conversations/' + conversation_id + '/members/' + member_id, params: params, type: Put)
105
93
  end
106
94
 
107
95
  # Delete a member.
108
96
  #
109
- # @deprecated
110
- #
111
97
  # @param [String] conversation_id
112
98
  # @param [String] member_id
113
99
  #
@@ -116,7 +102,6 @@ module Vonage
116
102
  # @see https://developer.nexmo.com/api/conversation#deleteMember
117
103
  #
118
104
  def delete(conversation_id, member_id)
119
- logger.info('This method is deprecated and will be removed in a future release.')
120
105
  request('/beta/conversations/' + conversation_id + '/members/' + member_id, type: Delete)
121
106
  end
122
107
  end
@@ -9,8 +9,6 @@ module Vonage
9
9
 
10
10
  # Create a user.
11
11
  #
12
- # @deprecated Please use {Vonage::Users#create} instead
13
- #
14
12
  # @option params [String] :name
15
13
  # Unique name for a user.
16
14
  #
@@ -28,14 +26,11 @@ module Vonage
28
26
  # @see https://developer.nexmo.com/api/conversation#createUser
29
27
  #
30
28
  def create(params)
31
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Users#create` instead.')
32
29
  request('/beta/users', params: params, type: Post)
33
30
  end
34
31
 
35
32
  # List users.
36
33
  #
37
- # @deprecated Please use {Vonage::Users#list} instead
38
- #
39
34
  # @option params [Boolean] :auto_advance
40
35
  # Set this to `false` to not auto-advance through all the pages in the record
41
36
  # and collect all the data. The default is `true`.
@@ -45,14 +40,11 @@ module Vonage
45
40
  # @see https://developer.nexmo.com/api/conversation#getUsers
46
41
  #
47
42
  def list(params = nil, auto_advance = true)
48
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Users#list` instead.')
49
43
  request('/beta/users', params: params)
50
44
  end
51
45
 
52
46
  # Retrieve a user.
53
47
  #
54
- # @deprecated Please use {Vonage::Users#find} instead
55
- #
56
48
  # @param [String] id
57
49
  #
58
50
  # @return [Response]
@@ -60,14 +52,11 @@ module Vonage
60
52
  # @see https://developer.nexmo.com/api/conversation#getUser
61
53
  #
62
54
  def get(id)
63
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Users#find` instead.')
64
55
  request('/beta/users/' + id)
65
56
  end
66
57
 
67
58
  # Update a user.
68
59
  #
69
- # @deprecated Please use {Vonage::Users#update} instead
70
- #
71
60
  # @option params [String] :name
72
61
  # Unique name for a user.
73
62
  #
@@ -90,14 +79,11 @@ module Vonage
90
79
  # @see https://developer.nexmo.com/api/conversation#updateUser
91
80
  #
92
81
  def update(id, params)
93
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Users#update` instead.')
94
82
  request('/beta/users/' + id, params: params, type: Put)
95
83
  end
96
84
 
97
85
  # Delete a user.
98
86
  #
99
- # @deprecated Please use {Vonage::Users#delete} instead
100
- #
101
87
  # @param [String] id
102
88
  #
103
89
  # @return [Response]
@@ -105,7 +91,6 @@ module Vonage
105
91
  # @see https://developer.nexmo.com/api/conversation#deleteUser
106
92
  #
107
93
  def delete(id)
108
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Users#delete` instead.')
109
94
  request('/beta/users/' + id, type: Delete)
110
95
  end
111
96
  end
@@ -11,8 +11,6 @@ module Vonage
11
11
 
12
12
  # Create a conversation.
13
13
  #
14
- # @deprecated Please use {Vonage::Conversation#create} instead
15
- #
16
14
  # @example
17
15
  # response = client.conversations.create(name: 'Example Conversation', display_name: 'Example Display Name')
18
16
  #
@@ -39,14 +37,11 @@ module Vonage
39
37
  #
40
38
  sig { params(params: T::Hash[Symbol, T.untyped]).returns(Vonage::Response) }
41
39
  def create(params)
42
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#create` instead.')
43
40
  request('/beta/conversations', params: params, type: Post)
44
41
  end
45
42
 
46
43
  # List all conversations associated with your application.
47
44
  #
48
- # @deprecated Please use {Vonage::Conversation#list} instead
49
- #
50
45
  # @example
51
46
  # response = client.conversations.list
52
47
  #
@@ -76,7 +71,6 @@ module Vonage
76
71
  #
77
72
  sig { params(params: T.nilable(T::Hash[Symbol, T.untyped]), auto_advance: T::Boolean).returns(Vonage::Response) }
78
73
  def list(params = nil, auto_advance = true)
79
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#list` instead.')
80
74
  if params && !params.key?(:auto_advance)
81
75
  params.merge!(auto_advance: true)
82
76
  end
@@ -86,8 +80,6 @@ module Vonage
86
80
 
87
81
  # Retrieve a conversation.
88
82
  #
89
- # @deprecated Please use {Vonage::Conversation#find} instead
90
- #
91
83
  # @example
92
84
  # response = client.conversations.get(id)
93
85
  #
@@ -99,14 +91,11 @@ module Vonage
99
91
  #
100
92
  sig { params(id: String).returns(Vonage::Response) }
101
93
  def get(id)
102
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#find` instead.')
103
94
  request('/beta/conversations/' + id)
104
95
  end
105
96
 
106
97
  # Update a conversation.
107
98
  #
108
- # @deprecated Please use {Vonage::Conversation#update} instead
109
- #
110
99
  # @example
111
100
  # response = client.conversations.update(id, display_name: 'Updated conversation')
112
101
  #
@@ -138,14 +127,11 @@ module Vonage
138
127
  params: T::Hash[Symbol, T.untyped]
139
128
  ).returns(Vonage::Response) }
140
129
  def update(id, params)
141
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#update` instead.')
142
130
  request('/beta/conversations/' + id, params: params, type: Put)
143
131
  end
144
132
 
145
133
  # Delete a conversation.
146
134
  #
147
- # @deprecated Please use {Vonage::Conversation#delete} instead
148
- #
149
135
  # @example
150
136
  # response = client.conversations.delete(id)
151
137
  #
@@ -157,14 +143,11 @@ module Vonage
157
143
  #
158
144
  sig { params(id: String).returns(Vonage::Response) }
159
145
  def delete(id)
160
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#delete` instead.')
161
146
  request('/beta/conversations/' + id, type: Delete)
162
147
  end
163
148
 
164
149
  # Record a conversation.
165
150
  #
166
- # @deprecated
167
- #
168
151
  # @example
169
152
  # response = client.conversations.record(id, action: 'start')
170
153
  #
@@ -195,17 +178,13 @@ module Vonage
195
178
  params: T::Hash[Symbol, T.untyped]
196
179
  ).returns(Vonage::Response) }
197
180
  def record(id, params)
198
- logger.info('This method is deprecated and will be removed in a future release.')
199
181
  request('/v1/conversations/' + id + '/record', params: params, type: Put)
200
182
  end
201
183
 
202
184
  # @return [Events]
203
185
  #
204
- # @deprecated Please use {Vonage::Conversation#event} instead
205
- #
206
186
  sig { returns(T.nilable(Vonage::Conversations::Events)) }
207
187
  def events
208
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#event` instead.')
209
188
  @events = T.let(@events, T.nilable(Vonage::Conversations::Events))
210
189
  @config = T.let(@config, T.nilable(Vonage::Config))
211
190
  @events ||= Events.new(@config)
@@ -213,33 +192,24 @@ module Vonage
213
192
 
214
193
  # @return [Legs]
215
194
  #
216
- # @deprecated
217
- #
218
195
  sig { returns(T.nilable(Vonage::Conversations::Legs)) }
219
196
  def legs
220
- logger.info('This method is deprecated and will be removed in a future release.')
221
197
  @legs = T.let(@legs, T.nilable(Vonage::Conversations::Legs))
222
198
  @legs ||= Legs.new(@config)
223
199
  end
224
200
 
225
201
  # @return [Members]
226
202
  #
227
- # @deprecated Please use {Vonage::Conversation#member} instead
228
- #
229
203
  sig { returns(T.nilable(Vonage::Conversations::Members)) }
230
204
  def members
231
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#member` instead.')
232
205
  @members = T.let(@members, T.nilable(Vonage::Conversations::Members))
233
206
  @members ||= Members.new(@config)
234
207
  end
235
208
 
236
209
  # @return [Users]
237
210
  #
238
- # @deprecated Please use {Vonage::Conversation#user} instead
239
- #
240
211
  sig { returns(T.nilable(Vonage::Conversations::Users)) }
241
212
  def users
242
- logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#user` instead.')
243
213
  @users = T.let(@users, T.nilable(Vonage::Conversations::Users))
244
214
  @users ||= Users.new(@config)
245
215
  end
data/lib/vonage/errors.rb CHANGED
@@ -1,25 +1,14 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
- require "json"
3
+ require 'json'
4
4
 
5
5
  module Vonage
6
6
  module Errors
7
7
  extend T::Sig
8
8
 
9
- sig do
10
- params(
11
- response:
12
- T.any(
13
- Net::HTTPUnauthorized,
14
- Net::HTTPClientError,
15
- Net::HTTPServerError,
16
- T.untyped
17
- )
18
- ).returns(Vonage::Error)
19
- end
9
+ sig {params(response: T.any(Net::HTTPUnauthorized, Net::HTTPClientError, Net::HTTPServerError, T.untyped)).returns(Vonage::Error)}
20
10
  def self.parse(response)
21
- exception_class =
22
- case response
11
+ exception_class = case response
23
12
  when Net::HTTPUnauthorized
24
13
  AuthenticationError
25
14
  when Net::HTTPClientError
@@ -27,40 +16,34 @@ module Vonage
27
16
  when Net::HTTPServerError
28
17
  ServerError
29
18
  else
30
- APIError
19
+ Error
31
20
  end
32
21
 
33
- message = response.content_type.to_s.include?("json") ? set_message(response) : ""
34
-
35
- exception_class.new(message, http_response: response)
36
- end
37
-
38
- def self.set_message(response)
39
- hash = ::JSON.parse(response.body)
40
-
41
- if hash.key?("error_title")
42
- hash["error_title"]
43
- elsif hash.key?("error-code-label")
44
- hash["error-code-label"]
45
- elsif hash.key?("description")
46
- hash["description"]
47
- elsif hash.key?("message")
48
- hash["message"]
49
- elsif problem_details?(hash)
50
- problem_details_message(hash)
51
- else
52
- ""
22
+ message = if response.content_type == 'application/json'
23
+ hash = ::JSON.parse(response.body)
24
+
25
+ if hash.key?('error_title')
26
+ hash['error_title']
27
+ elsif hash.key?('error-code-label')
28
+ hash['error-code-label']
29
+ elsif hash.key?('description')
30
+ hash['description']
31
+ elsif problem_details?(hash)
32
+ problem_details_message(hash)
33
+ end
53
34
  end
35
+
36
+ exception_class.new(message)
54
37
  end
55
38
 
56
39
  sig { params(hash: T::Hash[String, T.untyped]).returns(T::Boolean) }
57
40
  def self.problem_details?(hash)
58
- hash.key?("title") && hash.key?("detail") && hash.key?("type")
41
+ hash.key?('title') && hash.key?('detail') && hash.key?('type')
59
42
  end
60
43
 
61
44
  sig { params(hash: T::Hash[String, T.untyped]).returns(String) }
62
45
  def self.problem_details_message(hash)
63
- "#{hash["title"]}. #{hash["detail"]} See #{hash["type"]} for more info, or email support@vonage.com if you have any questions."
46
+ "#{hash['title']}. #{hash['detail']} See #{hash['type']} for more info, or email support@nexmo.com if you have any questions."
64
47
  end
65
48
  end
66
49
 
data/lib/vonage/gsm7.rb CHANGED
@@ -4,7 +4,7 @@ module Vonage
4
4
  module GSM7
5
5
  extend T::Sig
6
6
 
7
- CHARACTERS = "\n\f\r !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~ ¡£¤¥§¿ÄÅÆÇÉÑÖØÜßàäåæèéìñòöøùüΓΔΘΛΞΠΣΦΨΩ€"
7
+ CHARACTERS = "\n\f\r !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~ ¡£¤¥§¿ÄÅÆÉÑÖØÜßàäåæçèéìñòöøùüΓΔΘΛΞΠΣΦΨΩ€"
8
8
 
9
9
  REGEXP = /\A[#{Regexp.escape(CHARACTERS)}]*\z/
10
10
 
data/lib/vonage/jwt.rb CHANGED
@@ -39,22 +39,5 @@ module Vonage
39
39
  payload[:private_key] = private_key if private_key && !payload[:private_key]
40
40
  @token = Vonage::JWTBuilder.new(payload).jwt.generate
41
41
  end
42
-
43
- # Validate a JSON Web Token from a Vonage Webhook.
44
- #
45
- # Certain Vonage APIs include a JWT signed with a user's account signature secret in
46
- # the Authorization header of Webhook requests. This method can be used to verify that those requests originate
47
- # from the Vonage API.
48
- #
49
- # @param [String, required] :token The JWT from the Webhook's Authorization header
50
- # @param [String, required] :signature_secret The account signature secret
51
- #
52
- # @return [Boolean] true, if the JWT is verified, false otherwise
53
- #
54
- # @see https://developer.vonage.com/en/getting-started/concepts/webhooks#decoding-signed-webhooks
55
- #
56
- def self.verify_hs256_signature(token:, signature_secret:)
57
- verify_signature(token, signature_secret, 'HS256')
58
- end
59
42
  end
60
43
  end
@@ -5,10 +5,9 @@ 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),
9
- data: T.nilable(Hash)
8
+ object: T.any(T::Hash[T.untyped, T.untyped], URI::HTTPS, Net::HTTP::Post, Net::HTTP::Get)
10
9
  ).void }
11
- def update(object, data)
10
+ def update(object)
12
11
  return unless object.is_a?(Hash)
13
12
 
14
13
  @config = T.let(@config, T.nilable(Vonage::Config))