nexmo 4.3.1 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +3 -2
- data/lib/nexmo.rb +17 -3
- data/lib/nexmo/version.rb +1 -1
- data/nexmo.gemspec +9 -2
- data/spec/nexmo_spec.rb +31 -5
- metadata +21 -21
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YTcwZjhmNDAzMmRlNzBmOTg3NGFjOWZiNTlhYWE5NThmNmYzZGMxYw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2448fcd0dd372bc17dbe5100b1999ae4ccb384d7
|
4
|
+
data.tar.gz: b3e127871d56b44e756467da7421047fb33faf71
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NTY2ZTI0MDgzNjNiMjYwNDBlYzlkYWYzOWM1YzVkOTdlNzQ4OWUwYzFlM2M5
|
11
|
-
ODI5Y2IwZTAyY2VmZDU1Y2FiMjcyZTRkNjEwY2MzYWI2ZmE1YzI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NzAyZTY1YmMyNTMyNGJhNTIyZmY0YjlhNjU0Mjk4YzU4NzQ0NDAwZTEzYzU5
|
14
|
-
YzliYTZhMmU4MGNhY2MwZThhOGFjZWY3NThjZmUwNzdiZDIxMGM0ZTUzMzIw
|
15
|
-
M2Y0N2YwYzE0NTY4ZDQyY2U4Y2VjZmQzOGJkODZjMTcyYmY1ZjQ=
|
6
|
+
metadata.gz: 9b20d4793fdf3a9ed86b5c0956297ce0c6c730e41375d45f9bf0c7682a6db2e7d321f22b276a0a61b31119373d81c5f8b1e06d601293d07634781edba6504708
|
7
|
+
data.tar.gz: a093d20819277d9da65131d9486784b86891201db9bf61fd811da315ae736efb62723700932b598177a8d66d4be9f426aec3e6dadcc79d8039cf60ce694f1f92
|
data/README.md
CHANGED
@@ -257,10 +257,11 @@ Docs: [https://docs.nexmo.com/tools/application-api/api-reference#delete](https:
|
|
257
257
|
```ruby
|
258
258
|
client = Nexmo::Client.new(signature_secret: 'secret')
|
259
259
|
|
260
|
-
if client.check_signature(request.
|
260
|
+
if client.check_signature(request.GET)
|
261
261
|
# valid signature
|
262
|
-
else
|
262
|
+
else
|
263
263
|
# invalid signature
|
264
|
+
end
|
264
265
|
```
|
265
266
|
|
266
267
|
Docs: [https://docs.nexmo.com/messaging/signing-messages](https://docs.nexmo.com/messaging/signing-messages?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library)
|
data/lib/nexmo.rb
CHANGED
@@ -30,10 +30,10 @@ module Nexmo
|
|
30
30
|
|
31
31
|
@sns_host = options.fetch(:sns_host) { 'sns.nexmo.com' }
|
32
32
|
|
33
|
-
@user_agent = "ruby
|
33
|
+
@user_agent = "nexmo-ruby/#{VERSION} ruby/#{RUBY_VERSION}"
|
34
34
|
|
35
35
|
if options.key?(:app_name) && options.key?(:app_version)
|
36
|
-
@user_agent << "
|
36
|
+
@user_agent << " #{options[:app_name]}/#{options[:app_version]}"
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -200,13 +200,27 @@ module Nexmo
|
|
200
200
|
end
|
201
201
|
|
202
202
|
def get_basic_number_insight(params)
|
203
|
-
get(@api_host, '/
|
203
|
+
get(@api_host, '/ni/basic/json', params)
|
204
|
+
end
|
205
|
+
|
206
|
+
def get_standard_number_insight(params)
|
207
|
+
get(@api_host, '/ni/standard/json', params)
|
204
208
|
end
|
205
209
|
|
206
210
|
def get_number_insight(params)
|
211
|
+
Kernel.warn "#{self.class}##{__method__} is deprecated (use #get_standard_number_insight instead)."
|
212
|
+
|
207
213
|
get(@api_host, '/number/lookup/json', params)
|
208
214
|
end
|
209
215
|
|
216
|
+
def get_advanced_number_insight(params)
|
217
|
+
get(@api_host, '/ni/advanced/json', params)
|
218
|
+
end
|
219
|
+
|
220
|
+
def get_advanced_async_number_insight(params)
|
221
|
+
get(@api_host, '/ni/advanced/async/json', params)
|
222
|
+
end
|
223
|
+
|
210
224
|
def request_number_insight(params)
|
211
225
|
post(@host, '/ni/json', params)
|
212
226
|
end
|
data/lib/nexmo/version.rb
CHANGED
data/nexmo.gemspec
CHANGED
@@ -13,8 +13,15 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.files = Dir.glob('{lib,spec}/**/*') + %w(LICENSE.txt README.md nexmo.gemspec)
|
14
14
|
s.required_ruby_version = '>= 1.9.3'
|
15
15
|
s.add_dependency('jwt')
|
16
|
-
s.add_development_dependency('rake', '~>
|
17
|
-
s.add_development_dependency('webmock', '~> 1.18')
|
16
|
+
s.add_development_dependency('rake', '~> 11.0')
|
18
17
|
s.add_development_dependency('minitest', '~> 5.0')
|
18
|
+
|
19
|
+
if RUBY_VERSION == '1.9.3'
|
20
|
+
s.add_development_dependency('addressable', '< 2.5.0')
|
21
|
+
s.add_development_dependency('webmock', '~> 1.0')
|
22
|
+
else
|
23
|
+
s.add_development_dependency('webmock', '~> 2.0')
|
24
|
+
end
|
25
|
+
|
19
26
|
s.require_path = 'lib'
|
20
27
|
end
|
data/spec/nexmo_spec.rb
CHANGED
@@ -343,17 +343,43 @@ describe 'Nexmo::Client' do
|
|
343
343
|
|
344
344
|
describe 'get_basic_number_insight method' do
|
345
345
|
it 'fetches the number format resource and returns the response object' do
|
346
|
-
expect_get "#@api_base_url/
|
346
|
+
expect_get "#@api_base_url/ni/basic/json?api_key=#@api_key&api_secret=#@api_secret&number=447525856424"
|
347
347
|
|
348
348
|
@client.get_basic_number_insight(number: '447525856424').must_equal(@response_object)
|
349
349
|
end
|
350
350
|
end
|
351
351
|
|
352
|
+
describe 'get_standard_insight method' do
|
353
|
+
it 'fetches the number lookup resource and returns the response object' do
|
354
|
+
expect_get "#@api_base_url/ni/standard/json?api_key=#@api_key&api_secret=#@api_secret&number=447525856424"
|
355
|
+
|
356
|
+
@client.get_standard_number_insight(number: '447525856424').must_equal(@response_object)
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
352
360
|
describe 'get_number_insight method' do
|
353
361
|
it 'fetches the number lookup resource and returns the response object' do
|
354
362
|
expect_get "#@api_base_url/number/lookup/json?api_key=#@api_key&api_secret=#@api_secret&number=447525856424"
|
355
363
|
|
356
|
-
|
364
|
+
Kernel.stub :warn, proc { |message| message.must_match(/get_number_insight is deprecated/) } do
|
365
|
+
@client.get_number_insight(number: '447525856424').must_equal(@response_object)
|
366
|
+
end
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
370
|
+
describe 'get_advanced_number_insight method' do
|
371
|
+
it 'fetches the ni advanced resource and returns the response object' do
|
372
|
+
expect_get "#@api_base_url/ni/advanced/json?api_key=#@api_key&api_secret=#@api_secret&number=447525856424"
|
373
|
+
|
374
|
+
@client.get_advanced_number_insight(number: '447525856424').must_equal(@response_object)
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
describe 'get_advanced_async_number_insight method' do
|
379
|
+
it 'fetches the ni advanced async resource and returns the response object' do
|
380
|
+
expect_get "#@api_base_url/ni/advanced/async/json?api_key=#@api_key&api_secret=#@api_secret&number=447525856424"
|
381
|
+
|
382
|
+
@client.get_advanced_async_number_insight(number: '447525856424').must_equal(@response_object)
|
357
383
|
end
|
358
384
|
end
|
359
385
|
|
@@ -512,7 +538,7 @@ describe 'Nexmo::Client' do
|
|
512
538
|
end
|
513
539
|
|
514
540
|
it 'includes a user-agent header with the library version number and ruby version number' do
|
515
|
-
headers = {'User-Agent' => "ruby
|
541
|
+
headers = {'User-Agent' => "nexmo-ruby/#{Nexmo::VERSION} ruby/#{RUBY_VERSION}"}
|
516
542
|
|
517
543
|
stub_request(:get, /#{@base_url}/).with(headers: headers).to_return(@response_body)
|
518
544
|
|
@@ -522,7 +548,7 @@ describe 'Nexmo::Client' do
|
|
522
548
|
it 'provides options for application name and version to be included in the user-agent header' do
|
523
549
|
app_name, app_version = 'ExampleApp', 'X.Y.Z'
|
524
550
|
|
525
|
-
headers = {'User-Agent' => "ruby
|
551
|
+
headers = {'User-Agent' => "nexmo-ruby/#{Nexmo::VERSION} ruby/#{RUBY_VERSION} #{app_name}/#{app_version}"}
|
526
552
|
|
527
553
|
stub_request(:get, /#{@base_url}/).with(headers: headers).to_return(@response_body)
|
528
554
|
|
@@ -540,7 +566,7 @@ describe 'Nexmo::Client' do
|
|
540
566
|
end
|
541
567
|
|
542
568
|
it 'provides an option for specifying a different api hostname to connect to' do
|
543
|
-
expect_get "https://debug.example.com/
|
569
|
+
expect_get "https://debug.example.com/ni/basic/json?api_key=#@api_key&api_secret=#@api_secret&number=447525856424"
|
544
570
|
|
545
571
|
@client = Nexmo::Client.new(key: @api_key, secret: @api_secret, api_host: 'debug.example.com')
|
546
572
|
|
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexmo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Craft
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '11.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '11.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '5.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: webmock
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '2.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '2.0'
|
69
69
|
description: Nexmo Client Library for Ruby
|
70
70
|
email:
|
71
71
|
- mail@timcraft.com
|
@@ -96,17 +96,17 @@ require_paths:
|
|
96
96
|
- lib
|
97
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - ">="
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: 1.9.3
|
102
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
|
-
- -
|
104
|
+
- - ">="
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.5.1
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: This is the Ruby client library for Nexmo's API. To use it you'll need a
|