vonage 7.30.1 → 7.31.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efad4d967fe2d9c11b18957cf40e5300fe119db6c07d56af440c29868adfd5c2
4
- data.tar.gz: d14117d3e2e8f6532e37d141444278ed9b6280df5bc7e38254ac591cef325800
3
+ metadata.gz: eef9ba6a82f261b39300753a6a894de863fa511caeedbe4da526f19386310a5d
4
+ data.tar.gz: ecdb4a66e5ce1d811c9acaf65c87c6a7acf7c25ec547ae2be6f1089600088f45
5
5
  SHA512:
6
- metadata.gz: 76dde98be9a57eb38efcf2cc1fa450bd0ded1df1887f005eee178870338909b71069863bf80eaa501cb4efc2f3cda1ff06ebeed4d816c769b9b3810faf7db17f
7
- data.tar.gz: d6dc9f64e5f6a6503e6723cbe21692597d4605d046a5aa9986e0de85ef4421db38e5f6a5c2f7f474267899eae54bf41d0d6c729a9cf31cd339250b3ad312bf1b
6
+ metadata.gz: 88e3b48ab6f91e84397bcf2ec1ec4d05303bdb54fb6a911a835b494bae537984779875975903a5ebd5ebfad10ac148da95c427785cd27fc6d701397df7ef9558
7
+ data.tar.gz: 2fafc180379722a799ba71eaf5d3bcd08e992298e9ccc4f7503d5a07033498cad34e9fa3bbf23e955a7618f36b31b8f9a18ca16dad94aa0bc684beb1db0a2e20
data/lib/vonage/client.rb CHANGED
@@ -71,7 +71,7 @@ module Vonage
71
71
  end
72
72
 
73
73
  # @return [Meetings]
74
- #
74
+ # @deprecated
75
75
  sig { returns(T.nilable(Vonage::Meetings)) }
76
76
  def meetings
77
77
  @meetings ||= T.let(Meetings.new(config), T.nilable(Vonage::Meetings))
@@ -113,7 +113,7 @@ module Vonage
113
113
  end
114
114
 
115
115
  # @return [NumberInsight2]
116
- #
116
+ # @deprecated
117
117
  sig { returns(T.nilable(Vonage::NumberInsight2)) }
118
118
  def number_insight_2
119
119
  @number_insight_2 ||= T.let(NumberInsight2.new(config), T.nilable(Vonage::NumberInsight2))
@@ -134,7 +134,7 @@ module Vonage
134
134
  end
135
135
 
136
136
  # @return [ProactiveConnect]
137
- #
137
+ # @deprecated
138
138
  sig { returns(T.nilable(Vonage::ProactiveConnect)) }
139
139
  def proactive_connect
140
140
  @proactive_connect ||= T.let(ProactiveConnect.new(config), T.nilable(Vonage::ProactiveConnect))
data/lib/vonage/config.rb CHANGED
@@ -131,11 +131,6 @@ module Vonage
131
131
 
132
132
  # @return [Vonage::Logger]
133
133
  #
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)) }
139
134
  def logger=(logger)
140
135
  @logger = T.let(Logger.new(logger), T.nilable(Vonage::Logger))
141
136
  end
data/lib/vonage/keys.rb CHANGED
@@ -40,7 +40,8 @@ module Vonage
40
40
  'phone_number',
41
41
  'hashed_phone_number',
42
42
  'max_age',
43
- 'max_bitrate'
43
+ 'max_bitrate',
44
+ 'quantization_parameter'
44
45
  ]
45
46
  hash.transform_keys do |k|
46
47
  if exceptions.include?(k.to_s)
data/lib/vonage/logger.rb CHANGED
@@ -7,11 +7,6 @@ module Vonage
7
7
  class Logger
8
8
  extend T::Sig
9
9
 
10
- sig { params(logger: T.nilable(
11
- defined?(ActiveSupport::BroadcastLogger) ?
12
- T.any(::Logger, Vonage::Logger, ActiveSupport::BroadcastLogger)
13
- : T.any(::Logger, Vonage::Logger)
14
- )).void }
15
10
  def initialize(logger)
16
11
  @logger = logger || ::Logger.new(nil)
17
12
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Vonage
4
4
  class Messaging::Channels::MMS < Messaging::Message
5
- MESSAGE_TYPES = ['image', 'vcard', 'audio', 'video']
5
+ MESSAGE_TYPES = ['text', 'image', 'vcard', 'audio', 'video', 'file', 'content'].freeze
6
6
 
7
7
  attr_reader :data
8
8
 
@@ -29,8 +29,16 @@ module Vonage
29
29
  end
30
30
 
31
31
  def verify_message
32
- raise Vonage::ClientError.new(":message must be a Hash") unless message.is_a? Hash
33
- raise Vonage::ClientError.new(":url is required in :message") unless message[:url]
32
+ case type
33
+ when 'text'
34
+ raise Vonage::ClientError.new("Invalid parameter type. `:message` must be a String") unless message.is_a? String
35
+ when 'content'
36
+ raise Vonage::ClientError.new("Invalid parameter type. `:message` must be an Array") unless message.is_a? Array
37
+ raise Vonage::ClientError.new("Invalid parameter content. `:message` must not be empty") if message.empty?
38
+ else
39
+ raise Vonage::ClientError.new("Invalid parameter type. `:message` must be a Hash") unless message.is_a? Hash
40
+ raise Vonage::ClientError.new("Missing parameter. `:message` must contain a `:url` key") unless message[:url]
41
+ end
34
42
  end
35
43
  end
36
44
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Vonage
4
4
  class Messaging::Channels::RCS < Messaging::Message
5
- MESSAGE_TYPES = ['text', 'image', 'video', 'file', 'custom']
5
+ MESSAGE_TYPES = ['text', 'image', 'video', 'file', 'card', 'carousel', 'custom']
6
6
 
7
7
  attr_reader :data
8
8
 
@@ -32,7 +32,7 @@ module Vonage
32
32
  case type
33
33
  when 'text'
34
34
  raise Vonage::ClientError.new("Invalid parameter type. `:message` must be a String") unless message.is_a? String
35
- when 'custom'
35
+ when 'card', 'carousel', 'custom'
36
36
  raise Vonage::ClientError.new("Invalid parameter type. `:message` must be a Hash") unless message.is_a? Hash
37
37
  raise Vonage::ClientError.new("Invalid parameter content. `:message` must not be empty") if message.empty?
38
38
  else
@@ -3,6 +3,7 @@
3
3
 
4
4
  module Vonage
5
5
  class NumberInsight < Namespace
6
+ self.authentication = Basic
6
7
  # Provides basic number insight information about a number.
7
8
  #
8
9
  # @example
@@ -9,25 +9,10 @@ module Vonage
9
9
 
10
10
  self.request_body = JSON
11
11
 
12
- # Make fraud check requests with a phone number by looking up fraud score and/or by checking sim swap status.
13
- #
14
- # @example
15
- # response = client.number_insight_2.fraud_check(type: 'phone', phone: '447900000000', insights: ['fraud_score'])
16
- #
17
- # @param [required, String] :type The type of number to check.
18
- # Accepted value is “phone” when a phone number is provided.
19
- #
20
- # @param [required, String] :phone A single phone number that you need insight about in the E.164 format.
21
- #
22
- # @param [required, Array] :insights An array of strings indicating the fraud check insights required for the number.
23
- # Must be least one of: `fraud_score`, `sim_swap`
24
- #
25
- # @return [Response]
26
- #
27
- # @see https://developer.vonage.com/en/api/number-insight.v2#fraud_check
28
- #
12
+ # @deprecated
29
13
  sig { params(type: String, phone: String, insights: T::Array[String]).returns(Vonage::Response) }
30
14
  def fraud_check(type:, phone:, insights:)
15
+ logger.info('This method is deprecated and will be removed in a future release.')
31
16
  raise ArgumentError.new("`insights` must not be an empty") if insights.empty?
32
17
 
33
18
  request('/v2/ni', params: {type: type, phone: phone, insights: insights}, type: Post)
data/lib/vonage/sms.rb CHANGED
@@ -66,6 +66,9 @@ module Vonage
66
66
  # An optional string used to identify separate accounts using the SMS endpoint for billing purposes.
67
67
  # To use this feature, please email [support@nexmo.com](mailto:support@nexmo.com).
68
68
  #
69
+ # @option params [String] :trusted_number
70
+ # Setting this parameter to true overrides, on a per-message basis, any protections set up via Fraud Defender (Traffic Rules, SMS Burst Protection, AIT Protection).
71
+ #
69
72
  # @param [Hash] params
70
73
  #
71
74
  # @return [Response]
@@ -1,5 +1,5 @@
1
1
  # typed: strong
2
2
 
3
3
  module Vonage
4
- VERSION = '7.30.1'
4
+ VERSION = '7.31.0'
5
5
  end
@@ -59,7 +59,9 @@ module Vonage
59
59
  #
60
60
  # @param [optional, String] :multi_archive_tag
61
61
  #
62
- # @param [optional, String] :max_bitrate
62
+ # @param [optional, Number] :max_bitrate
63
+ #
64
+ # @param [optional, Number] :quantization_parameter
63
65
  #
64
66
  # @param [optional, Hash] :layout
65
67
  #
@@ -38,6 +38,7 @@ module Vonage
38
38
  # @option websocket [optional, Hash] :headers An object of key-value pairs of headers to be sent to your WebSocket server with each message, with a maximum length of 512 bytes.
39
39
  # @option websocket [optional, Integer] :audio_rate A number representing the audio sampling rate in Hz
40
40
  # - Must be one of: 8000, 16000
41
+ # @option websocket [optional, Boolean] :bidirectional Whether to send audio data from the WebSocket connection to a stream published in the session.
41
42
  #
42
43
  # @return [Response]
43
44
  #
@@ -67,7 +67,9 @@ module Vonage
67
67
  raise ClientError.new("Expected 'uri' value to be a valid URI") unless URI.parse(endpoint[:uri]).kind_of?(URI::Generic)
68
68
  raise ClientError.new("Expected 'content-type' parameter to be either 'audio/116;rate=16000' or 'audio/116;rate=8000") unless endpoint[:'content-type'] == 'audio/116;rate=16000' || endpoint[:'content-type'] == 'audio/116;rate=8000'
69
69
  when 'sip'
70
- raise ClientError.new("Expected 'uri' value to be a valid URI") unless URI.parse(endpoint[:uri]).kind_of?(URI::Generic)
70
+ raise ClientError.new("Expected 'uri' value to be a valid URI") unless URI.parse(endpoint[:uri]).kind_of?(URI::Generic) if endpoint[:uri]
71
+ raise ClientError.new("`uri` must not be combined with `user` and `domain`") if endpoint[:uri] && (endpoint[:user] || endpoint[:domain])
72
+ raise ClientError.new("You must provide both `user` and `domain`") if (endpoint[:user] && !endpoint[:domain]) || (endpoint[:domain] && !endpoint[:user])
71
73
  end
72
74
  end
73
75
 
@@ -208,10 +210,12 @@ module Vonage
208
210
 
209
211
  def sip_endpoint(endpoint_attrs)
210
212
  hash = {
211
- type: 'sip',
212
- uri: endpoint_attrs[:uri]
213
+ type: 'sip'
213
214
  }
214
215
 
216
+ hash.merge!(uri: endpoint_attrs[:uri]) if endpoint_attrs[:uri]
217
+ hash.merge!(user: endpoint_attrs[:user]) if endpoint_attrs[:user]
218
+ hash.merge!(domain: endpoint_attrs[:domain]) if endpoint_attrs[:domain]
215
219
  hash.merge!(headers: endpoint_attrs[:headers]) if endpoint_attrs[:headers]
216
220
  hash.merge!(standardHeaders: endpoint_attrs[:standardHeaders]) if endpoint_attrs[:standardHeaders]
217
221
 
@@ -3,16 +3,13 @@
3
3
 
4
4
  module Vonage
5
5
  class Voice::Actions::Stream
6
- attr_accessor :streamUrl, :level, :bargeIn, :loop, :eventOnCompletion, :eventUrl, :eventMethod
6
+ attr_accessor :streamUrl, :level, :bargeIn, :loop
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)
16
13
 
17
14
  after_initialize!
18
15
  end
@@ -31,18 +28,6 @@ module Vonage
31
28
  if self.loop
32
29
  verify_loop
33
30
  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
46
31
  end
47
32
 
48
33
  def verify_stream_url
@@ -69,28 +54,6 @@ module Vonage
69
54
  raise ClientError.new("Expected 'loop' value to be either 0 or a positive integer") unless self.loop >= 0
70
55
  end
71
56
 
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)
92
- end
93
-
94
57
  def action
95
58
  create_stream!(self)
96
59
  end
@@ -106,9 +69,6 @@ module Vonage
106
69
  ncco[0].merge!(level: builder.level) if builder.level
107
70
  ncco[0].merge!(bargeIn: builder.bargeIn) if (builder.bargeIn || builder.bargeIn == false)
108
71
  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
112
72
 
113
73
  ncco
114
74
  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, :eventOnCompletion, :eventUrl, :eventMethod
5
+ attr_accessor :text, :bargeIn, :loop, :level, :language, :style, :premium
6
6
 
7
7
  def initialize(attributes= {})
8
8
  @text = attributes.fetch(:text)
@@ -12,9 +12,6 @@ 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)
18
15
 
19
16
  after_initialize!
20
17
  end
@@ -39,18 +36,6 @@ module Vonage
39
36
  if self.premium || self.premium == false
40
37
  verify_premium
41
38
  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
54
39
  end
55
40
 
56
41
  def verify_barge_in
@@ -73,28 +58,6 @@ module Vonage
73
58
  raise ClientError.new("Expected 'premium' value to be a Boolean") unless self.premium == true || self.premium == false
74
59
  end
75
60
 
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
-
98
61
  def action
99
62
  create_talk!(self)
100
63
  end
@@ -113,9 +76,6 @@ module Vonage
113
76
  ncco[0].merge!(language: builder.language) if builder.language
114
77
  ncco[0].merge!(style: builder.style) if builder.style
115
78
  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
119
79
 
120
80
  ncco
121
81
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vonage
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.30.1
4
+ version: 7.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vonage