vonage 7.8.2 → 7.9.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: 263068d03f9527437cbee45239f7d51da8800b0003930002f6d10c6843f12828
4
- data.tar.gz: 5fdcc6879830f92cabe656c05e050eacc9616f2b135af2ca7f128d57cef6fded
3
+ metadata.gz: 9d8620ac3418486f818675d3b75efdf29a572c38100d00aeb8f36ab36aae4fb0
4
+ data.tar.gz: 7c1f845f11ba6b1eb625cdf20b703c2b19af2f789dd41e5368ce99465eab2d05
5
5
  SHA512:
6
- metadata.gz: 1beea2eeef06d2b8c9e6153fe5f356981e285f7c96bd8b3674af1ca09ae2fb606627c619bdaeec0803911590149fa63f6e581d59a03b7245b6f89e1ef914dac5
7
- data.tar.gz: 12ce327c5db5735e357c5ad39f0ab850f0e3f490dc71cfb65065a0b61ad6586821ce70a79101e1448c2df62995b546285af3d6a8c255c3a89cad615b8c36b0fb
6
+ metadata.gz: 04e95b2647f1d19323fa512b803de87baa245379957fa051c3b13cb12571bf5cb93e735aa28ef332b47f5cf1ccaded503f628b88ee73856ab1e94ee09573d175
7
+ data.tar.gz: 37ae894d0413c3b72d4c9d8d65462fcb5853740cd8bfcc254f4701fd1529dc3fc3a66fed0888db1e8b0de2ea28461cb4822d7e7e3f06ba5a5db53fce202c4ab3
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Vonage
4
4
  class Messaging::Channels::Viber < Messaging::Message
5
- MESSAGE_TYPES = ['text', 'image']
5
+ MESSAGE_TYPES = ['text', 'image', 'video', 'file']
6
6
 
7
7
  attr_reader :data
8
8
 
@@ -33,6 +33,13 @@ module Vonage
33
33
  when 'image'
34
34
  raise Vonage::ClientError.new(":message must be a Hash") unless message.is_a? Hash
35
35
  raise Vonage::ClientError.new(":url is required in :message") unless message[:url]
36
+ when 'video'
37
+ raise Vonage::ClientError.new(":message must be a Hash") unless message.is_a? Hash
38
+ raise Vonage::ClientError.new(":url is required in :message") unless message[:url]
39
+ raise Vonage::ClientError.new(":thumb_url is required in :message") unless message[:thumb_url]
40
+ when 'file'
41
+ raise Vonage::ClientError.new(":message must be a Hash") unless message.is_a? Hash
42
+ raise Vonage::ClientError.new(":url is required in :message") unless message[:url]
36
43
  end
37
44
  end
38
45
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Vonage
4
4
  class Messaging::Channels::WhatsApp < Messaging::Message
5
- MESSAGE_TYPES = ['text', 'image', 'audio', 'video', 'file', 'template', 'custom']
5
+ MESSAGE_TYPES = ['text', 'image', 'audio', 'video', 'file', 'template', 'sticker', 'custom']
6
6
 
7
7
  attr_reader :data
8
8
 
@@ -35,6 +35,8 @@ module Vonage
35
35
  raise Vonage::ClientError.new(":name is required in :template") unless message[:name]
36
36
  raise Vonage::ClientError.new(":whatsapp is required in :opts") unless opts[:whatsapp]
37
37
  raise Vonage::ClientError.new(":locale is required in :whatsapp") unless opts[:whatsapp][:locale]
38
+ when 'sticker'
39
+ raise Vonage::ClientError.new(":message must contain either :id or :url") unless message.has_key?(:id) ^ message.has_key?(:url)
38
40
  when 'custom'
39
41
  raise Vonage::ClientError.new(":message must be a Hash") unless message.is_a? Hash
40
42
  else
@@ -5,6 +5,8 @@ module Vonage
5
5
  class Numbers < Namespace
6
6
  include Keys
7
7
 
8
+ self.authentication = Basic
9
+
8
10
  self.host = :rest_host
9
11
 
10
12
  # Retrieve all the inbound numbers associated with your Vonage account.
@@ -52,7 +54,7 @@ module Vonage
52
54
  # @see https://developer.nexmo.com/api/developer/numbers#getOwnedNumbers
53
55
  #
54
56
  def list(params = nil)
55
- request('/account/numbers', params: params, response_class: ListResponse)
57
+ request("/account/numbers", params: params, response_class: ListResponse)
56
58
  end
57
59
 
58
60
  # Retrieve inbound numbers that are available for the specified country.
@@ -100,7 +102,7 @@ module Vonage
100
102
  # @see https://developer.nexmo.com/api/developer/numbers#getAvailableNumbers
101
103
  #
102
104
  def search(params)
103
- request('/number/search', params: params, response_class: ListResponse)
105
+ request("/number/search", params: params, response_class: ListResponse)
104
106
  end
105
107
 
106
108
  # Request to purchase a specific inbound number.
@@ -125,7 +127,12 @@ module Vonage
125
127
  # @see https://developer.nexmo.com/api/developer/numbers#buyANumber
126
128
  #
127
129
  def buy(params)
128
- request('/number/buy', params: params, type: Post, response_class: Response)
130
+ request(
131
+ "/number/buy",
132
+ params: params,
133
+ type: Post,
134
+ response_class: Response
135
+ )
129
136
  end
130
137
 
131
138
  # Cancel your subscription for a specific inbound number.
@@ -150,7 +157,12 @@ module Vonage
150
157
  # @see https://developer.nexmo.com/api/developer/numbers#cancelANumber
151
158
  #
152
159
  def cancel(params)
153
- request('/number/cancel', params: params, type: Post, response_class: Response)
160
+ request(
161
+ "/number/cancel",
162
+ params: params,
163
+ type: Post,
164
+ response_class: Response
165
+ )
154
166
  end
155
167
 
156
168
  # Change the behaviour of a number that you own.
@@ -198,14 +210,25 @@ module Vonage
198
210
  # @see https://developer.nexmo.com/api/developer/numbers#updateANumber
199
211
  #
200
212
  def update(params)
201
- request('/number/update', params: camelcase(params), type: Post, response_class: Response)
213
+ request(
214
+ "/number/update",
215
+ params: camelcase(params),
216
+ type: Post,
217
+ response_class: Response
218
+ )
202
219
  end
203
220
 
204
221
  private
205
222
 
206
223
  # A specific implementation of iterable_request for Numbers, because the Numbers API
207
224
  # handles pagination differently to other Vonage APIs
208
- def iterable_request(path, response: nil, response_class: nil, params: {}, &block)
225
+ def iterable_request(
226
+ path,
227
+ response: nil,
228
+ response_class: nil,
229
+ params: {},
230
+ &block
231
+ )
209
232
  response = parse(response, response_class)
210
233
  params[:index] = 1 unless params.has_key?(:index)
211
234
  size = params.fetch(:size, 10)
@@ -1,5 +1,5 @@
1
1
  # typed: strong
2
2
 
3
3
  module Vonage
4
- VERSION = '7.8.2'
4
+ VERSION = "7.9.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vonage
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.8.2
4
+ version: 7.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vonage
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-04 00:00:00.000000000 Z
11
+ date: 2023-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vonage-jwt
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
192
  - !ruby/object:Gem::Version
193
193
  version: '0'
194
194
  requirements: []
195
- rubygems_version: 3.4.1
195
+ rubygems_version: 3.4.10
196
196
  signing_key:
197
197
  specification_version: 4
198
198
  summary: This is the Ruby Server SDK for Vonage APIs. To use it you'll need a Vonage