vonage 7.35.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 (132) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +87 -880
  3. data/lib/vonage/account.rb +0 -2
  4. data/lib/vonage/applications.rb +4 -12
  5. data/lib/vonage/basic.rb +1 -1
  6. data/lib/vonage/bearer_token.rb +1 -1
  7. data/lib/vonage/client.rb +0 -72
  8. data/lib/vonage/client_error.rb +1 -1
  9. data/lib/vonage/config.rb +1 -7
  10. data/lib/vonage/conversations/events.rb +0 -12
  11. data/lib/vonage/conversations/legs.rb +0 -6
  12. data/lib/vonage/conversations/members.rb +0 -15
  13. data/lib/vonage/conversations/users.rb +0 -15
  14. data/lib/vonage/conversations.rb +0 -30
  15. data/lib/vonage/conversions.rb +0 -2
  16. data/lib/vonage/errors.rb +20 -37
  17. data/lib/vonage/gsm7.rb +1 -1
  18. data/lib/vonage/http.rb +3 -3
  19. data/lib/vonage/jwt.rb +0 -17
  20. data/lib/vonage/key_secret_params.rb +2 -3
  21. data/lib/vonage/keys.rb +1 -17
  22. data/lib/vonage/logger.rb +3 -0
  23. data/lib/vonage/messaging/channels/messenger.rb +0 -2
  24. data/lib/vonage/messaging/channels/mms.rb +3 -13
  25. data/lib/vonage/messaging/channels/sms.rb +0 -2
  26. data/lib/vonage/messaging/channels/viber.rb +2 -11
  27. data/lib/vonage/messaging/channels/whats_app.rb +1 -5
  28. data/lib/vonage/messaging/message.rb +1 -4
  29. data/lib/vonage/messaging.rb +4 -43
  30. data/lib/vonage/namespace.rb +68 -137
  31. data/lib/vonage/number_insight.rb +0 -1
  32. data/lib/vonage/numbers.rb +17 -40
  33. data/lib/vonage/server_error.rb +1 -1
  34. data/lib/vonage/signature.rb +6 -29
  35. data/lib/vonage/sms.rb +20 -25
  36. data/lib/vonage/verify.rb +0 -2
  37. data/lib/vonage/version.rb +1 -1
  38. data/lib/vonage/video/archives.rb +58 -35
  39. data/lib/vonage/video/list_response.rb +11 -0
  40. data/lib/vonage/video/moderation.rb +22 -7
  41. data/lib/vonage/video/signals.rb +9 -4
  42. data/lib/vonage/video/streams.rb +12 -6
  43. data/lib/vonage/video.rb +13 -56
  44. data/lib/vonage/voice/actions/connect.rb +9 -45
  45. data/lib/vonage/voice/actions/conversation.rb +4 -10
  46. data/lib/vonage/voice/actions/input.rb +3 -26
  47. data/lib/vonage/voice/actions/notify.rb +3 -8
  48. data/lib/vonage/voice/actions/pay.rb +107 -0
  49. data/lib/vonage/voice/actions/record.rb +4 -52
  50. data/lib/vonage/voice/actions/stream.rb +3 -7
  51. data/lib/vonage/voice/actions/talk.rb +4 -29
  52. data/lib/vonage/voice/ncco.rb +1 -3
  53. data/lib/vonage/voice/talk.rb +1 -11
  54. data/lib/vonage/voice.rb +0 -24
  55. data/lib/vonage.rb +0 -4
  56. data/vonage.gemspec +1 -3
  57. metadata +12 -116
  58. data/lib/vonage/api_error.rb +0 -33
  59. data/lib/vonage/basic_and_bearer_token.rb +0 -18
  60. data/lib/vonage/basic_and_signature.rb +0 -22
  61. data/lib/vonage/conversation/event/list_response.rb +0 -11
  62. data/lib/vonage/conversation/event.rb +0 -108
  63. data/lib/vonage/conversation/list_response.rb +0 -11
  64. data/lib/vonage/conversation/member/list_response.rb +0 -11
  65. data/lib/vonage/conversation/member.rb +0 -134
  66. data/lib/vonage/conversation/user/conversations_list_response.rb +0 -11
  67. data/lib/vonage/conversation/user/sessions_list_response.rb +0 -11
  68. data/lib/vonage/conversation/user.rb +0 -67
  69. data/lib/vonage/conversation.rb +0 -164
  70. data/lib/vonage/identity_insights/insights_builder.rb +0 -75
  71. data/lib/vonage/identity_insights.rb +0 -75
  72. data/lib/vonage/meetings/applications.rb +0 -28
  73. data/lib/vonage/meetings/dial_in_numbers/list_response.rb +0 -11
  74. data/lib/vonage/meetings/dial_in_numbers.rb +0 -26
  75. data/lib/vonage/meetings/recordings.rb +0 -42
  76. data/lib/vonage/meetings/rooms/list_response.rb +0 -11
  77. data/lib/vonage/meetings/rooms.rb +0 -167
  78. data/lib/vonage/meetings/sessions/list_response.rb +0 -11
  79. data/lib/vonage/meetings/sessions.rb +0 -31
  80. data/lib/vonage/meetings/themes/list_response.rb +0 -11
  81. data/lib/vonage/meetings/themes.rb +0 -239
  82. data/lib/vonage/meetings.rb +0 -50
  83. data/lib/vonage/messaging/channels/rcs.rb +0 -44
  84. data/lib/vonage/network_authentication/client_authentication.rb +0 -39
  85. data/lib/vonage/network_authentication/server_authentication.rb +0 -47
  86. data/lib/vonage/network_authentication.rb +0 -22
  87. data/lib/vonage/network_number_verification.rb +0 -92
  88. data/lib/vonage/network_sim_swap.rb +0 -84
  89. data/lib/vonage/number_insight_2.rb +0 -21
  90. data/lib/vonage/proactive_connect/events/list_response.rb +0 -11
  91. data/lib/vonage/proactive_connect/events.rb +0 -71
  92. data/lib/vonage/proactive_connect/item.rb +0 -116
  93. data/lib/vonage/proactive_connect/items/file_response.rb +0 -32
  94. data/lib/vonage/proactive_connect/items/list_response.rb +0 -11
  95. data/lib/vonage/proactive_connect/items.rb +0 -116
  96. data/lib/vonage/proactive_connect/list.rb +0 -186
  97. data/lib/vonage/proactive_connect/lists/list_response.rb +0 -11
  98. data/lib/vonage/proactive_connect/lists.rb +0 -38
  99. data/lib/vonage/proactive_connect.rb +0 -43
  100. data/lib/vonage/subaccounts/balance_transfers/list_response.rb +0 -11
  101. data/lib/vonage/subaccounts/credit_transfers/list_response.rb +0 -11
  102. data/lib/vonage/subaccounts/list_response.rb +0 -15
  103. data/lib/vonage/subaccounts.rb +0 -203
  104. data/lib/vonage/users/list_response.rb +0 -11
  105. data/lib/vonage/users.rb +0 -156
  106. data/lib/vonage/verify2/channels/email.rb +0 -36
  107. data/lib/vonage/verify2/channels/silent_auth.rb +0 -46
  108. data/lib/vonage/verify2/channels/sms.rb +0 -63
  109. data/lib/vonage/verify2/channels/voice.rb +0 -32
  110. data/lib/vonage/verify2/channels/whats_app.rb +0 -45
  111. data/lib/vonage/verify2/channels/whats_app_interactive.rb +0 -32
  112. data/lib/vonage/verify2/start_verification_options.rb +0 -63
  113. data/lib/vonage/verify2/template_fragments/list_response.rb +0 -11
  114. data/lib/vonage/verify2/template_fragments.rb +0 -125
  115. data/lib/vonage/verify2/templates/list_response.rb +0 -11
  116. data/lib/vonage/verify2/templates.rb +0 -86
  117. data/lib/vonage/verify2/workflow.rb +0 -39
  118. data/lib/vonage/verify2/workflow_builder.rb +0 -25
  119. data/lib/vonage/verify2.rb +0 -112
  120. data/lib/vonage/video/archives/list_response.rb +0 -11
  121. data/lib/vonage/video/broadcasts/list_response.rb +0 -11
  122. data/lib/vonage/video/broadcasts.rb +0 -75
  123. data/lib/vonage/video/captions.rb +0 -67
  124. data/lib/vonage/video/connections/list_response.rb +0 -11
  125. data/lib/vonage/video/connections.rb +0 -29
  126. data/lib/vonage/video/renders/list_response.rb +0 -11
  127. data/lib/vonage/video/renders.rb +0 -107
  128. data/lib/vonage/video/sip.rb +0 -48
  129. data/lib/vonage/video/streams/list_response.rb +0 -11
  130. data/lib/vonage/video/web_socket.rb +0 -62
  131. data/lib/vonage/voice/actions/transfer.rb +0 -83
  132. data/lib/vonage/voice/actions/wait.rb +0 -43
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Vonage
5
5
  class Voice::Actions::Input
6
- attr_accessor :type, :dtmf, :speech, :eventUrl, :eventMethod, :mode
6
+ attr_accessor :type, :dtmf, :speech, :eventUrl, :eventMethod
7
7
 
8
8
  def initialize(attributes = {})
9
9
  @type = attributes.fetch(:type)
@@ -11,7 +11,6 @@ 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)
15
14
 
16
15
  after_initialize!
17
16
  end
@@ -34,10 +33,6 @@ module Vonage
34
33
  if self.eventMethod
35
34
  validate_event_method
36
35
  end
37
-
38
- if self.mode
39
- validate_mode
40
- end
41
36
  end
42
37
 
43
38
  def validate_type
@@ -85,23 +80,12 @@ module Vonage
85
80
  if self.speech[:maxDuration]
86
81
  raise ClientError.new("Expected 'maxDuration' to not be more than 60 seconds") unless self.speech[:maxDuration] <= 60 && self.speech[:maxDuration] >= 0
87
82
  end
88
-
89
- if self.speech[:provider]
90
- valid_providers = ['google']
91
-
92
- raise ClientError.new("Invalid 'provider' value, must be one of: #{valid_providers.join(', ')}") unless valid_providers.include?(self.speech[:provider])
93
- raise ClientError.new("The `providerOptions` parameter is required when specifying a `provider`") unless self.speech[:providerOptions]
94
- end
95
83
  end
96
84
 
97
85
  def validate_event_url
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
101
-
102
- uri = URI.parse(self.eventUrl[0])
86
+ uri = URI.parse(self.eventUrl)
103
87
 
104
- raise ClientError.new("Invalid 'eventUrl' value, array must contain a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
88
+ raise ClientError.new("Invalid 'eventUrl' value, must be a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
105
89
 
106
90
  self.eventUrl
107
91
  end
@@ -112,12 +96,6 @@ module Vonage
112
96
  raise ClientError.new("Invalid 'eventMethod' value. must be either: 'GET' or 'POST'") unless valid_methods.include?(self.eventMethod.upcase)
113
97
  end
114
98
 
115
- def validate_mode
116
- valid_modes = ['asyncronous']
117
-
118
- raise ClientError.new("Invalid 'mode' value, must be asyncronous'") unless valid_modes.include?(self.mode)
119
- end
120
-
121
99
  def action
122
100
  create_input!(self)
123
101
  end
@@ -134,7 +112,6 @@ module Vonage
134
112
  ncco[0].merge!(speech: builder.speech) if builder.speech
135
113
  ncco[0].merge!(eventUrl: builder.eventUrl) if builder.eventUrl
136
114
  ncco[0].merge!(eventMethod: builder.eventMethod) if builder.eventMethod
137
- ncco[0].merge!(mode: builder.mode) if builder.mode
138
115
 
139
116
  ncco
140
117
  end
@@ -22,15 +22,10 @@ module Vonage
22
22
  end
23
23
 
24
24
  def validate_event_url
25
- event_url = self.eventUrl
25
+ uri = URI.parse(self.eventUrl[0])
26
26
 
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)
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)
34
29
 
35
30
  self.eventUrl
36
31
  end
@@ -0,0 +1,107 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+ module Vonage
4
+ class Voice::Actions::Pay
5
+ attr_accessor :amount, :currency, :eventUrl, :prompts, :voice
6
+
7
+ def initialize(attributes= {})
8
+ @amount = attributes.fetch(:amount)
9
+ @currency = attributes.fetch(:currency, nil)
10
+ @eventUrl = attributes.fetch(:eventUrl, nil)
11
+ @prompts = attributes.fetch(:prompts, nil)
12
+ @voice = attributes.fetch(:voice, nil)
13
+
14
+ after_initialize!
15
+ end
16
+
17
+ def action
18
+ create_pay!(self)
19
+ end
20
+
21
+ def create_pay!(builder)
22
+ ncco = [
23
+ {
24
+ action: 'pay',
25
+ amount: builder.amount
26
+ }
27
+ ]
28
+
29
+ ncco[0].merge!(currency: builder.currency) if builder.currency
30
+ ncco[0].merge!(eventUrl: builder.eventUrl) if builder.eventUrl
31
+ ncco[0].merge!(prompts: builder.prompts) if builder.prompts
32
+ ncco[0].merge!(voice: builder.voice) if builder.voice
33
+
34
+ ncco
35
+ end
36
+
37
+ private
38
+
39
+ def after_initialize!
40
+ verify_amount
41
+
42
+ if self.eventUrl
43
+ verify_event_url
44
+ end
45
+
46
+ if self.prompts
47
+ verify_prompts
48
+ end
49
+
50
+ if self.voice
51
+ verify_voice
52
+ end
53
+ end
54
+
55
+ def verify_amount
56
+ verify_amount_class
57
+ verify_amount_value
58
+ end
59
+
60
+ def verify_event_url
61
+ raise ClientError.new("Expected 'eventUrl' parameter to be an Array containing a single string item") unless self.eventUrl.is_a?(Array)
62
+
63
+ uri = URI.parse(self.eventUrl[0])
64
+
65
+ raise ClientError.new("Invalid 'eventUrl' value, must be a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
66
+ end
67
+
68
+ def verify_prompts
69
+ verify_prompts_structure
70
+ verify_prompts_values
71
+ end
72
+
73
+ def verify_voice
74
+ verify_voice_structure
75
+ verify_voice_style if self.voice[:style]
76
+ end
77
+
78
+ def verify_amount_class
79
+ raise ClientError.new("Invalid 'amount' value, must be a float") unless self.amount.is_a?(Float)
80
+ end
81
+
82
+ def verify_amount_value
83
+ raise ClientError.new("Invalid 'amount' value, must be greater than 0") unless self.amount > 0
84
+ end
85
+
86
+ def verify_prompts_structure
87
+ raise ClientError.new("Invalid 'prompt', must be an array of at least one hash") unless self.prompts.is_a?(Array) && !self.prompts.empty? && self.prompts.all?(Hash)
88
+ end
89
+
90
+ def verify_prompts_values
91
+ self.prompts.each do |prompt|
92
+ prompt_keys = prompt.keys
93
+ [:type, :text, :errors].each do |key|
94
+ raise ClientError.new("Invalid 'prompt', '#{key}' is required") unless prompt_keys.include?(key)
95
+ end
96
+ end
97
+ end
98
+
99
+ def verify_voice_structure
100
+ raise ClientError.new("Expected 'voice' value to be a Hash") unless self.voice.is_a?(Hash)
101
+ end
102
+
103
+ def verify_voice_style
104
+ raise ClientError.new("Expected 'style' value to be an Integer") unless self.voice[:style].is_a?(Integer)
105
+ end
106
+ end
107
+ 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, :transcription
6
+ attr_accessor :format, :split, :channels, :endOnSilence, :endOnKey, :timeOut, :beepStart, :eventUrl, :eventMethod
7
7
 
8
8
  def initialize(attributes = {})
9
9
  @format = attributes.fetch(:format, nil)
@@ -15,7 +15,6 @@ 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)
19
18
 
20
19
  after_initialize!
21
20
  end
@@ -56,10 +55,6 @@ module Vonage
56
55
  if self.eventMethod
57
56
  validate_event_method
58
57
  end
59
-
60
- if self.transcription
61
- validate_transcription
62
- end
63
58
  end
64
59
 
65
60
  def validate_format
@@ -95,13 +90,9 @@ module Vonage
95
90
  end
96
91
 
97
92
  def validate_event_url
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
93
+ uri = URI.parse(self.eventUrl)
101
94
 
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)
95
+ raise ClientError.new("Invalid 'eventUrl' value, must be a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
105
96
 
106
97
  self.eventUrl
107
98
  end
@@ -109,45 +100,7 @@ module Vonage
109
100
  def validate_event_method
110
101
  valid_methods = ['GET', 'POST']
111
102
 
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
103
+ raise ClientError.new("Invalid 'eventMethod' value. must be either: 'GET' or 'POST'") unless valid_methods.include?(self.eventMethod.upcase)
151
104
  end
152
105
 
153
106
  def action
@@ -170,7 +123,6 @@ module Vonage
170
123
  ncco[0].merge!(beepStart: builder.beepStart) if builder.beepStart
171
124
  ncco[0].merge!(eventUrl: builder.eventUrl) if builder.eventUrl
172
125
  ncco[0].merge!(eventMethod: builder.eventMethod) if builder.eventMethod
173
- ncco[0].merge!(transcription: builder.transcription) if builder.transcription
174
126
 
175
127
  ncco
176
128
  end
@@ -31,13 +31,9 @@ module Vonage
31
31
  end
32
32
 
33
33
  def verify_stream_url
34
- stream_url = self.streamUrl
34
+ raise ClientError.new("Expected 'streamUrl' parameter to be an Array containing a single string item") unless self.streamUrl.is_a?(Array)
35
35
 
36
- unless stream_url.is_a?(Array) && stream_url.length == 1 && stream_url[0].is_a?(String)
37
- raise ClientError.new("Expected 'streamUrl' parameter to be an Array containing a single string item")
38
- end
39
-
40
- uri = URI.parse(stream_url[0])
36
+ uri = URI.parse(self.streamUrl[0])
41
37
 
42
38
  raise ClientError.new("Invalid 'streamUrl' value, must be a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
43
39
  end
@@ -51,7 +47,7 @@ module Vonage
51
47
  end
52
48
 
53
49
  def verify_loop
54
- raise ClientError.new("Expected 'loop' value to be either 0 or a positive integer") unless self.loop >= 0
50
+ raise ClientError.new("Expected 'loop' value to be either 1 or 0") unless self.loop == 1 || self.loop == 0
55
51
  end
56
52
 
57
53
  def action
@@ -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, :provider, :providerOptions
5
+ attr_accessor :text, :bargeIn, :loop, :level, :language, :style
6
6
 
7
7
  def initialize(attributes= {})
8
8
  @text = attributes.fetch(:text)
@@ -11,15 +11,12 @@ module Vonage
11
11
  @level = attributes.fetch(:level, nil)
12
12
  @language = attributes.fetch(:language, nil)
13
13
  @style = attributes.fetch(:style, nil)
14
- @premium = attributes.fetch(:premium, nil)
15
- @provider = attributes.fetch(:provider, nil)
16
- @providerOptions = attributes.fetch(:providerOptions, nil)
17
14
 
18
15
  after_initialize!
19
16
  end
20
17
 
21
18
  def after_initialize!
22
- if self.bargeIn || self.bargeIn == false
19
+ if self.bargeIn
23
20
  verify_barge_in
24
21
  end
25
22
 
@@ -34,14 +31,6 @@ module Vonage
34
31
  if self.style
35
32
  verify_style
36
33
  end
37
-
38
- if self.premium || self.premium == false
39
- verify_premium
40
- end
41
-
42
- if self.provider
43
- verify_provider
44
- end
45
34
  end
46
35
 
47
36
  def verify_barge_in
@@ -49,7 +38,7 @@ module Vonage
49
38
  end
50
39
 
51
40
  def verify_loop
52
- raise ClientError.new("Expected 'loop' value to be either 0 or a positive integer") unless self.loop >= 0
41
+ raise ClientError.new("Expected 'loop' value to be either 1 or 0") unless self.loop == 1 || self.loop == 0
53
42
  end
54
43
 
55
44
  def verify_level
@@ -60,17 +49,6 @@ module Vonage
60
49
  raise ClientError.new("Expected 'style' value to be an Integer") unless self.style.is_a?(Integer)
61
50
  end
62
51
 
63
- def verify_premium
64
- raise ClientError.new("Expected 'premium' value to be a Boolean") unless self.premium == true || self.premium == false
65
- end
66
-
67
- def verify_provider
68
- valid_providers = ['google']
69
-
70
- raise ClientError.new("Invalid 'provider' value, must be one of: #{valid_providers.join(', ')}") unless valid_providers.include?(self.provider)
71
- raise ClientError.new("The `providerOptions` parameter is required when specifying a `provider`") unless self.providerOptions
72
- end
73
-
74
52
  def action
75
53
  create_talk!(self)
76
54
  end
@@ -88,11 +66,8 @@ module Vonage
88
66
  ncco[0].merge!(level: builder.level) if builder.level
89
67
  ncco[0].merge!(language: builder.language) if builder.language
90
68
  ncco[0].merge!(style: builder.style) if builder.style
91
- ncco[0].merge!(premium: builder.premium) if (builder.premium || builder.premium == false)
92
- ncco[0].merge!(provider: builder.provider) if builder.provider
93
- ncco[0].merge!(providerOptions: builder.providerOptions) if builder.providerOptions
94
69
 
95
70
  ncco
96
71
  end
97
72
  end
98
- end
73
+ end
@@ -10,9 +10,7 @@ module Vonage
10
10
  notify: Vonage::Voice::Actions::Notify,
11
11
  record: Vonage::Voice::Actions::Record,
12
12
  stream: Vonage::Voice::Actions::Stream,
13
- talk: Vonage::Voice::Actions::Talk,
14
- wait: Vonage::Voice::Actions::Wait,
15
- transfer: Vonage::Voice::Actions::Transfer
13
+ talk: Vonage::Voice::Actions::Talk
16
14
  }
17
15
 
18
16
  class << self
@@ -12,18 +12,8 @@ module Vonage
12
12
  # @option params [required, String] :text
13
13
  # The text to read.
14
14
  #
15
- # @option params [String] :language
16
- # The language to use. See {https://developer.vonage.com/en/api/voice#startTalk-req-body} for a list of valid language codes.
17
- #
18
- # @option params [Integer] :style
19
- # The vocal style, as identified by an assigned integer.
20
- # See {https://developer.vonage.com/en/voice/voice-api/concepts/text-to-speech#supported-languages} for a list of available styles.
21
- #
22
- # @option params [Boolean] :premium
23
- # Set to `true` to use the premium version of the specified style if available, otherwise the standard version will be used.
24
- #
25
15
  # @option params [String] :voice_name
26
- # The voice & language to use. [DEPRECATED: use `language` and `style` instead].
16
+ # The voice & language to use.
27
17
  #
28
18
  # @option params [Integer] :loop
29
19
  # The number of times to repeat the text the file, 0 for infinite.
data/lib/vonage/voice.rb CHANGED
@@ -18,8 +18,6 @@ module Vonage
18
18
  #
19
19
  # @option params [required, Array<Hash>] :to
20
20
  # Connect to a Phone (PSTN) number, SIP Endpoint, Websocket, or VBC extension.
21
- # The `to` Hash can contain a number of different properties depending on the `type`.
22
- # See the API reference for specific details.
23
21
  #
24
22
  # @option params [Hash] :from
25
23
  # Connect to a Phone (PSTN) number. Should not be set if **:random_from_number** is **true**
@@ -50,17 +48,6 @@ module Vonage
50
48
  # @option params [String] :machine_detection
51
49
  # Configure the behavior when Vonage detects that the call is answered by voicemail.
52
50
  #
53
- # @option params [Hash] :advanced_machine_detection
54
- # Configure the behavior of Vonage's advanced machine detection. Overrides machine_detection if both are set.
55
- # Hash with three possible properties:
56
- # - :behavior [String]: Must be one of `continue` or `hangup`. When hangup is used, the call will be terminated if a
57
- # machine is detected. When continue is used, the call will continue even if a machine is detected.
58
- # - :mode [String]: Must be one of `detect` or `detect_beep`. Detect if machine answered and sends a human or
59
- # machine status in the webhook payload. When set to `detect_beep`, the system also attempts to detect
60
- # voice mail beep and sends an additional parameter `sub_state` in the webhook with the value `beep_start`.
61
- # - :beep_timeout [Integer]: Min: 45, Max: 120. Maximum time in seconds Vonage should wait for a machine beep
62
- # to be detected. A machine event with `sub_state` set to `beep_timeout` will be sent if the timeout is exceeded.
63
- #
64
51
  # @option params [Integer] :length_timer
65
52
  # Set the number of seconds that elapse before Vonage hangs up after the call state changes to in_progress.
66
53
  #
@@ -281,16 +268,5 @@ module Vonage
281
268
  def dtmf
282
269
  @dtmf ||= DTMF.new(@config)
283
270
  end
284
-
285
- # Validate a JSON Web Token from a Voice API Webhook.
286
- #
287
- # @param [String, required] :token The JWT from the Webhook's Authorization header
288
- # @param [String, optional] :signature_secret The account signature secret. Required, unless `signature_secret`
289
- # is set in `Config`
290
- #
291
- # @return [Boolean] true, if the JWT is verified, false otherwise
292
- def verify_webhook_token(token:, signature_secret: @config.signature_secret)
293
- JWT.verify_hs256_signature(token: token, signature_secret: signature_secret)
294
- end
295
271
  end
296
272
  end
data/lib/vonage.rb CHANGED
@@ -7,16 +7,12 @@ module Vonage
7
7
  loader = Zeitwerk::Loader.new
8
8
  loader.tag = File.basename(__FILE__, '.rb')
9
9
  loader.inflector.inflect({
10
- 'api_error' => 'APIError',
11
10
  'dtmf' => 'DTMF',
12
11
  'gsm7' => 'GSM7',
13
12
  'http' => 'HTTP',
14
13
  'json' => 'JSON',
15
14
  'jwt' => 'JWT',
16
- 'rcs' => 'RCS',
17
- 'sip' => 'SIP',
18
15
  'sms' => 'SMS',
19
- 'network_sim_swap' => 'NetworkSIMSwap',
20
16
  'mms' => 'MMS',
21
17
  'tfa' => 'TFA',
22
18
  'version' => 'VERSION',
data/vonage.gemspec CHANGED
@@ -12,11 +12,9 @@ Gem::Specification.new do |s|
12
12
  s.summary = 'This is the Ruby Server SDK for Vonage APIs. To use it you\'ll need a Vonage account. Sign up for free at https://www.vonage.com'
13
13
  s.files = Dir.glob('lib/**/*.rb') + %w(LICENSE.txt README.md vonage.gemspec)
14
14
  s.required_ruby_version = '>= 2.5.0'
15
- s.add_dependency('vonage-jwt', '~> 0.2.0')
15
+ s.add_dependency('vonage-jwt', '~> 0.1.0')
16
16
  s.add_dependency('zeitwerk', '~> 2', '>= 2.2')
17
17
  s.add_dependency('sorbet-runtime', '~> 0.5')
18
- s.add_dependency('multipart-post', '~> 2.0')
19
- s.add_dependency('net-http-persistent', '~> 4.0', '>= 4.0.2')
20
18
  s.add_runtime_dependency('rexml')
21
19
  s.add_runtime_dependency('phonelib')
22
20
  s.require_path = 'lib'