nexmo 5.2.0 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +5 -7
- data/lib/nexmo.rb +2 -0
- data/lib/nexmo/account.rb +2 -6
- data/lib/nexmo/alerts.rb +2 -6
- data/lib/nexmo/applications.rb +2 -6
- data/lib/nexmo/authentication/bearer_token.rb +1 -1
- data/lib/nexmo/call_dtmf.rb +4 -10
- data/lib/nexmo/call_stream.rb +4 -10
- data/lib/nexmo/call_talk.rb +4 -10
- data/lib/nexmo/calls.rb +5 -16
- data/lib/nexmo/client.rb +10 -4
- data/lib/nexmo/files.rb +4 -7
- data/lib/nexmo/form_data.rb +7 -0
- data/lib/nexmo/json.rb +11 -0
- data/lib/nexmo/messages.rb +2 -6
- data/lib/nexmo/namespace.rb +52 -52
- data/lib/nexmo/numbers.rb +2 -6
- data/lib/nexmo/pricing.rb +2 -6
- data/lib/nexmo/redact.rb +4 -10
- data/lib/nexmo/signature.rb +1 -11
- data/lib/nexmo/sms.rb +2 -6
- data/lib/nexmo/version.rb +1 -1
- data/nexmo.gemspec +2 -2
- metadata +10 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9af851979d214537f3ff6b20fa11f051b848d05b0a5d8fee7a7691f6b3e708d8
|
4
|
+
data.tar.gz: cdf846e2d27f25daf2e911107c4b4e5e0f351a2d561b3c8522798a0a716f96e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 546a5945d546ab3382ef76f3c91543aaec2fb26f98ac361ce58be747b47ec8b8c83f3ad4ed20722ba50fa85a70bcaf05f25545437735b9830711e59f430ae812
|
7
|
+
data.tar.gz: 83fcd3552be7a52eebf7a9fbbb034b74cde86fa9a112d53325b43784311140ab25acebeae3029734c4e71ddd97dbde69ad8a0ca645eb6985434468776a90d1d1
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ need a Nexmo account. Sign up [for free at nexmo.com][signup].
|
|
24
24
|
|
25
25
|
## Requirements
|
26
26
|
|
27
|
-
Nexmo Ruby supports CRuby 2.
|
27
|
+
Nexmo Ruby supports CRuby 2.1.0+ and JRuby 9k.
|
28
28
|
|
29
29
|
|
30
30
|
## Installation
|
@@ -144,7 +144,7 @@ Docs: [https://developer.nexmo.com/api/voice#modify-an-existing-call](https://de
|
|
144
144
|
```ruby
|
145
145
|
stream_url = 'https://nexmo-community.github.io/ncco-examples/assets/voice_api_audio_streaming.mp3'
|
146
146
|
|
147
|
-
response = client.stream.start(uuid, stream_url: stream_url)
|
147
|
+
response = client.calls.stream.start(uuid, stream_url: [stream_url])
|
148
148
|
```
|
149
149
|
|
150
150
|
Docs: [https://developer.nexmo.com/api/voice#stream-an-audio-file-to-an-active-call](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#stream-an-audio-file-to-an-active-call)
|
@@ -176,7 +176,7 @@ Docs: [https://developer.nexmo.com/api/voice#stop-sending-a-synthesized-speech-m
|
|
176
176
|
### Send DTMF tones to a call
|
177
177
|
|
178
178
|
```ruby
|
179
|
-
response = client.dtmf.send(uuid, digits: '1234')
|
179
|
+
response = client.calls.dtmf.send(uuid, digits: '1234')
|
180
180
|
```
|
181
181
|
|
182
182
|
Docs: [https://developer.nexmo.com/api/voice#send-dual-tone-multi-frequency-dtmf-tones-to-an-active-call](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#send-dual-tone-multi-frequency-dtmf-tones-to-an-active-call)
|
@@ -391,7 +391,7 @@ To disable logging set the logger to `nil`.
|
|
391
391
|
By default the library generates a short lived JWT per request.
|
392
392
|
|
393
393
|
To generate a long lived JWT for multiple requests or to specify JWT claims
|
394
|
-
directly call `Nexmo::JWT.generate` to generate a token, and set the
|
394
|
+
directly call `Nexmo::JWT.generate` to generate a token, and set the token
|
395
395
|
attribute on the client object. For example:
|
396
396
|
|
397
397
|
```ruby
|
@@ -404,9 +404,7 @@ claims = {
|
|
404
404
|
|
405
405
|
private_key = File.read('path/to/private.key')
|
406
406
|
|
407
|
-
|
408
|
-
|
409
|
-
client.auth_token = auth_token
|
407
|
+
client.token = Nexmo::JWT.generate(claims, private_key)
|
410
408
|
````
|
411
409
|
|
412
410
|
|
data/lib/nexmo.rb
CHANGED
data/lib/nexmo/account.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Nexmo
|
4
4
|
class Account < Namespace
|
5
|
+
self.host = 'rest.nexmo.com'
|
6
|
+
|
5
7
|
def balance
|
6
8
|
request('/account/get-balance')
|
7
9
|
end
|
@@ -13,11 +15,5 @@ module Nexmo
|
|
13
15
|
def topup(params)
|
14
16
|
request('/account/top-up', params: params, type: Post)
|
15
17
|
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def host
|
20
|
-
'rest.nexmo.com'
|
21
|
-
end
|
22
18
|
end
|
23
19
|
end
|
data/lib/nexmo/alerts.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Nexmo
|
4
4
|
class Alerts < Namespace
|
5
|
+
self.host = 'rest.nexmo.com'
|
6
|
+
|
5
7
|
def list
|
6
8
|
request('/sc/us/alert/opt-in/query/json')
|
7
9
|
end
|
@@ -15,11 +17,5 @@ module Nexmo
|
|
15
17
|
def send(params)
|
16
18
|
request('/sc/us/alert/json', params: params, type: Post)
|
17
19
|
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def host
|
22
|
-
'rest.nexmo.com'
|
23
|
-
end
|
24
20
|
end
|
25
21
|
end
|
data/lib/nexmo/applications.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Nexmo
|
4
4
|
class Applications < Namespace
|
5
|
+
self.request_body = JSON
|
6
|
+
|
5
7
|
def create(params)
|
6
8
|
request('/v1/applications', params: params, type: Post)
|
7
9
|
end
|
@@ -21,11 +23,5 @@ module Nexmo
|
|
21
23
|
def delete(id)
|
22
24
|
request('/v1/applications/' + id, type: Delete)
|
23
25
|
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def json_body?
|
28
|
-
true
|
29
|
-
end
|
30
26
|
end
|
31
27
|
end
|
data/lib/nexmo/call_dtmf.rb
CHANGED
@@ -2,18 +2,12 @@
|
|
2
2
|
|
3
3
|
module Nexmo
|
4
4
|
class CallDTMF < Namespace
|
5
|
-
|
6
|
-
request('/v1/calls/' + id + '/dtmf', params: params, type: Put)
|
7
|
-
end
|
5
|
+
self.authentication = BearerToken
|
8
6
|
|
9
|
-
|
7
|
+
self.request_body = JSON
|
10
8
|
|
11
|
-
def
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def json_body?
|
16
|
-
true
|
9
|
+
def send(id, params)
|
10
|
+
request('/v1/calls/' + id + '/dtmf', params: params, type: Put)
|
17
11
|
end
|
18
12
|
end
|
19
13
|
end
|
data/lib/nexmo/call_stream.rb
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
module Nexmo
|
4
4
|
class CallStream < Namespace
|
5
|
+
self.authentication = BearerToken
|
6
|
+
|
7
|
+
self.request_body = JSON
|
8
|
+
|
5
9
|
def start(id, params)
|
6
10
|
request('/v1/calls/' + id + '/stream', params: params, type: Put)
|
7
11
|
end
|
@@ -9,15 +13,5 @@ module Nexmo
|
|
9
13
|
def stop(id)
|
10
14
|
request('/v1/calls/' + id + '/stream', type: Delete)
|
11
15
|
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def authentication
|
16
|
-
@authentication ||= BearerToken.new(@client)
|
17
|
-
end
|
18
|
-
|
19
|
-
def json_body?
|
20
|
-
true
|
21
|
-
end
|
22
16
|
end
|
23
17
|
end
|
data/lib/nexmo/call_talk.rb
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
module Nexmo
|
4
4
|
class CallTalk < Namespace
|
5
|
+
self.authentication = BearerToken
|
6
|
+
|
7
|
+
self.request_body = JSON
|
8
|
+
|
5
9
|
def start(id, params)
|
6
10
|
request('/v1/calls/' + id + '/talk', params: params, type: Put)
|
7
11
|
end
|
@@ -9,15 +13,5 @@ module Nexmo
|
|
9
13
|
def stop(id)
|
10
14
|
request('/v1/calls/' + id + '/talk', type: Delete)
|
11
15
|
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def authentication
|
16
|
-
@authentication ||= BearerToken.new(@client)
|
17
|
-
end
|
18
|
-
|
19
|
-
def json_body?
|
20
|
-
true
|
21
|
-
end
|
22
16
|
end
|
23
17
|
end
|
data/lib/nexmo/calls.rb
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
module Nexmo
|
4
4
|
class Calls < Namespace
|
5
|
+
self.authentication = BearerToken
|
6
|
+
|
7
|
+
self.request_body = JSON
|
8
|
+
|
5
9
|
def create(params)
|
6
10
|
request('/v1/calls', params: params, type: Post)
|
7
11
|
end
|
@@ -38,12 +42,7 @@ module Nexmo
|
|
38
42
|
update(id, action: 'unearmuff')
|
39
43
|
end
|
40
44
|
|
41
|
-
def transfer(id, destination:
|
42
|
-
# Ruby 2.0.0 does not support the syntax for required keyword arguments
|
43
|
-
# that was introduced in Ruby 2.1. The following line and the nil default
|
44
|
-
# can be removed when dropping support for Ruby 2.0.0.
|
45
|
-
raise ArgumentError, 'missing keyword: destination' if destination.nil?
|
46
|
-
|
45
|
+
def transfer(id, destination:)
|
47
46
|
update(id, action: 'transfer', destination: destination)
|
48
47
|
end
|
49
48
|
|
@@ -58,15 +57,5 @@ module Nexmo
|
|
58
57
|
def dtmf
|
59
58
|
@dtmf ||= CallDTMF.new(@client)
|
60
59
|
end
|
61
|
-
|
62
|
-
private
|
63
|
-
|
64
|
-
def authentication
|
65
|
-
@authentication ||= BearerToken.new(@client)
|
66
|
-
end
|
67
|
-
|
68
|
-
def json_body?
|
69
|
-
true
|
70
|
-
end
|
71
60
|
end
|
72
61
|
end
|
data/lib/nexmo/client.rb
CHANGED
@@ -7,8 +7,8 @@ module Nexmo
|
|
7
7
|
attr_writer :signature_secret
|
8
8
|
attr_writer :application_id
|
9
9
|
attr_writer :private_key
|
10
|
+
attr_writer :token
|
10
11
|
attr_accessor :user_agent
|
11
|
-
attr_accessor :auth_token
|
12
12
|
|
13
13
|
def initialize(options = {})
|
14
14
|
@api_key = options[:api_key] || ENV['NEXMO_API_KEY']
|
@@ -21,6 +21,8 @@ module Nexmo
|
|
21
21
|
|
22
22
|
@private_key = options[:private_key]
|
23
23
|
|
24
|
+
@token = nil
|
25
|
+
|
24
26
|
@user_agent = UserAgent.string(options[:app_name], options[:app_version])
|
25
27
|
|
26
28
|
self.logger = options[:logger] || (defined?(Rails.logger) && Rails.logger)
|
@@ -34,10 +36,14 @@ module Nexmo
|
|
34
36
|
@logger = Nexmo::KeyValueLogger.new(logger)
|
35
37
|
end
|
36
38
|
|
37
|
-
def
|
38
|
-
token
|
39
|
+
def token
|
40
|
+
@token || JWT.generate({application_id: application_id}, private_key)
|
41
|
+
end
|
42
|
+
|
43
|
+
def auth_token=(auth_token)
|
44
|
+
Kernel.warn "#{self.class}##{__method__} is deprecated (use #token= instead)"
|
39
45
|
|
40
|
-
|
46
|
+
@token = auth_token
|
41
47
|
end
|
42
48
|
|
43
49
|
def api_key
|
data/lib/nexmo/files.rb
CHANGED
@@ -2,8 +2,11 @@
|
|
2
2
|
|
3
3
|
module Nexmo
|
4
4
|
class Files < Namespace
|
5
|
+
self.authentication = BearerToken
|
6
|
+
|
5
7
|
def get(id)
|
6
|
-
request('/v1/files/' + id.split('/').last)
|
8
|
+
response = request('/v1/files/' + id.split('/').last)
|
9
|
+
response.body
|
7
10
|
end
|
8
11
|
|
9
12
|
def save(id, filename)
|
@@ -15,11 +18,5 @@ module Nexmo
|
|
15
18
|
end
|
16
19
|
end
|
17
20
|
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def authentication
|
22
|
-
@authentication ||= BearerToken.new(@client)
|
23
|
-
end
|
24
21
|
end
|
25
22
|
end
|
data/lib/nexmo/json.rb
ADDED
data/lib/nexmo/messages.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Nexmo
|
4
4
|
class Messages < Namespace
|
5
|
+
self.host = 'rest.nexmo.com'
|
6
|
+
|
5
7
|
def get(id)
|
6
8
|
request('/search/message', params: {id: id})
|
7
9
|
end
|
@@ -13,11 +15,5 @@ module Nexmo
|
|
13
15
|
def rejections(params)
|
14
16
|
request('/search/rejections', params: params)
|
15
17
|
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def host
|
20
|
-
'rest.nexmo.com'
|
21
|
-
end
|
22
18
|
end
|
23
19
|
end
|
data/lib/nexmo/namespace.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'net/http'
|
2
3
|
require 'json'
|
3
4
|
|
@@ -6,38 +7,53 @@ module Nexmo
|
|
6
7
|
def initialize(client)
|
7
8
|
@client = client
|
8
9
|
|
9
|
-
@
|
10
|
+
@host = self.class.host
|
11
|
+
|
12
|
+
@http = Net::HTTP.new(@host, Net::HTTP.https_default_port)
|
10
13
|
@http.use_ssl = true
|
11
14
|
end
|
12
15
|
|
13
|
-
|
16
|
+
def self.host
|
17
|
+
@host ||= 'api.nexmo.com'
|
18
|
+
end
|
14
19
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
20
|
+
def self.host=(host)
|
21
|
+
@host = host
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.authentication
|
25
|
+
@authentication ||= KeySecretParams
|
26
|
+
end
|
19
27
|
|
20
|
-
def
|
21
|
-
|
28
|
+
def self.authentication=(authentication)
|
29
|
+
@authentication = authentication
|
22
30
|
end
|
23
31
|
|
24
|
-
def
|
25
|
-
@
|
32
|
+
def self.request_body
|
33
|
+
@request_body ||= FormData
|
26
34
|
end
|
27
35
|
|
28
|
-
def
|
29
|
-
|
36
|
+
def self.request_body=(request_body)
|
37
|
+
@request_body = request_body
|
30
38
|
end
|
31
39
|
|
40
|
+
private
|
41
|
+
|
42
|
+
Get = Net::HTTP::Get
|
43
|
+
Put = Net::HTTP::Put
|
44
|
+
Post = Net::HTTP::Post
|
45
|
+
Delete = Net::HTTP::Delete
|
46
|
+
|
32
47
|
def logger
|
33
48
|
@client.logger
|
34
49
|
end
|
35
50
|
|
36
51
|
def request(path, params: nil, type: Get, &block)
|
37
|
-
uri = URI('https://' + host + path)
|
52
|
+
uri = URI('https://' + @host + path)
|
38
53
|
|
39
54
|
params ||= {}
|
40
55
|
|
56
|
+
authentication = self.class.authentication.new(@client)
|
41
57
|
authentication.update(params)
|
42
58
|
|
43
59
|
unless type::REQUEST_HAS_BODY || params.empty?
|
@@ -52,56 +68,31 @@ module Nexmo
|
|
52
68
|
|
53
69
|
authentication.update(message)
|
54
70
|
|
55
|
-
|
71
|
+
self.class.request_body.update(message, params) if type::REQUEST_HAS_BODY
|
56
72
|
|
57
73
|
logger.info('Nexmo API request', method: message.method, path: uri.path)
|
58
74
|
|
59
|
-
response = @http.request(message)
|
75
|
+
response = @http.request(message, &block)
|
60
76
|
|
61
|
-
|
62
|
-
end
|
77
|
+
log_response_info(response)
|
63
78
|
|
64
|
-
|
65
|
-
if json_body?
|
66
|
-
message['Content-Type'] = 'application/json'
|
67
|
-
message.body = JSON.generate(params)
|
68
|
-
else
|
69
|
-
message.form_data = params
|
70
|
-
end
|
71
|
-
end
|
79
|
+
return if block
|
72
80
|
|
73
|
-
|
74
|
-
logger.info('Nexmo API response',
|
75
|
-
host: host,
|
76
|
-
status: response.code,
|
77
|
-
type: response.content_type,
|
78
|
-
length: response.content_length,
|
79
|
-
trace_id: response['x-nexmo-trace-id'])
|
81
|
+
logger.debug(response.body)
|
80
82
|
|
83
|
+
parse(response)
|
84
|
+
end
|
85
|
+
|
86
|
+
def parse(response)
|
81
87
|
case response
|
82
88
|
when Net::HTTPNoContent
|
83
89
|
:no_content
|
84
90
|
when Net::HTTPSuccess
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
def parse_success(response)
|
92
|
-
if response['Content-Type'].split(';').first == 'application/json'
|
93
|
-
JSON.parse(response.body, object_class: Nexmo::Entity)
|
94
|
-
elsif block_given?
|
95
|
-
yield response
|
96
|
-
else
|
97
|
-
response.body
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def handle_error(response)
|
102
|
-
logger.debug(response.body)
|
103
|
-
|
104
|
-
case response
|
91
|
+
if response['Content-Type'].split(';').first == 'application/json'
|
92
|
+
::JSON.parse(response.body, object_class: Nexmo::Entity)
|
93
|
+
else
|
94
|
+
response
|
95
|
+
end
|
105
96
|
when Net::HTTPUnauthorized
|
106
97
|
raise AuthenticationError
|
107
98
|
when Net::HTTPClientError
|
@@ -112,5 +103,14 @@ module Nexmo
|
|
112
103
|
raise Error
|
113
104
|
end
|
114
105
|
end
|
106
|
+
|
107
|
+
def log_response_info(response)
|
108
|
+
logger.info('Nexmo API response',
|
109
|
+
host: @host,
|
110
|
+
status: response.code,
|
111
|
+
type: response.content_type,
|
112
|
+
length: response.content_length,
|
113
|
+
trace_id: response['x-nexmo-trace-id'])
|
114
|
+
end
|
115
115
|
end
|
116
116
|
end
|
data/lib/nexmo/numbers.rb
CHANGED
@@ -4,6 +4,8 @@ module Nexmo
|
|
4
4
|
class Numbers < Namespace
|
5
5
|
include Keys
|
6
6
|
|
7
|
+
self.host = 'rest.nexmo.com'
|
8
|
+
|
7
9
|
def list(params = nil)
|
8
10
|
request('/account/numbers', params: params)
|
9
11
|
end
|
@@ -23,11 +25,5 @@ module Nexmo
|
|
23
25
|
def update(params)
|
24
26
|
request('/number/update', params: camelcase(params), type: Post)
|
25
27
|
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def host
|
30
|
-
'rest.nexmo.com'
|
31
|
-
end
|
32
28
|
end
|
33
29
|
end
|
data/lib/nexmo/pricing.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Nexmo
|
4
4
|
class Pricing < Namespace
|
5
|
+
self.host = 'rest.nexmo.com'
|
6
|
+
|
5
7
|
def initialize(client, type: nil)
|
6
8
|
raise ArgumentError if type.nil?
|
7
9
|
|
@@ -23,11 +25,5 @@ module Nexmo
|
|
23
25
|
def prefix(prefix)
|
24
26
|
request('/account/get-prefix-pricing/outbound/' + @type, params: {prefix: prefix})
|
25
27
|
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def host
|
30
|
-
'rest.nexmo.com'
|
31
|
-
end
|
32
28
|
end
|
33
29
|
end
|
data/lib/nexmo/redact.rb
CHANGED
@@ -2,18 +2,12 @@
|
|
2
2
|
|
3
3
|
module Nexmo
|
4
4
|
class Redact < Namespace
|
5
|
-
|
6
|
-
request('/v1/redact/transaction', params: params, type: Post)
|
7
|
-
end
|
5
|
+
self.authentication = KeySecretQuery
|
8
6
|
|
9
|
-
|
7
|
+
self.request_body = JSON
|
10
8
|
|
11
|
-
def
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def json_body?
|
16
|
-
true
|
9
|
+
def transaction(params)
|
10
|
+
request('/v1/redact/transaction', params: params, type: Post)
|
17
11
|
end
|
18
12
|
end
|
19
13
|
end
|
data/lib/nexmo/signature.rb
CHANGED
@@ -8,7 +8,7 @@ module Nexmo
|
|
8
8
|
|
9
9
|
signature = params.delete('sig')
|
10
10
|
|
11
|
-
secure_compare(signature, digest(params, secret))
|
11
|
+
::JWT::SecurityUtils.secure_compare(signature, digest(params, secret))
|
12
12
|
end
|
13
13
|
|
14
14
|
def initialize(client)
|
@@ -21,16 +21,6 @@ module Nexmo
|
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
-
if defined?(::JWT::SecurityUtils) # ruby-jwt v2
|
25
|
-
def self.secure_compare(left, right)
|
26
|
-
::JWT::SecurityUtils.secure_compare(left, right)
|
27
|
-
end
|
28
|
-
else
|
29
|
-
def self.secure_compare(left, right)
|
30
|
-
::JWT.secure_compare(left, right)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
24
|
def self.digest(params, secret)
|
35
25
|
md5 = Digest::MD5.new
|
36
26
|
|
data/lib/nexmo/sms.rb
CHANGED
data/lib/nexmo/version.rb
CHANGED
data/nexmo.gemspec
CHANGED
@@ -11,8 +11,8 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.description = 'Nexmo Client Library for Ruby'
|
12
12
|
s.summary = 'This is the Ruby client library for Nexmo\'s API. To use it you\'ll need a Nexmo account. Sign up for free at https://www.nexmo.com'
|
13
13
|
s.files = Dir.glob('{lib,spec}/**/*') + %w(LICENSE.txt README.md nexmo.gemspec)
|
14
|
-
s.required_ruby_version = '>= 2.
|
15
|
-
s.add_dependency('jwt')
|
14
|
+
s.required_ruby_version = '>= 2.1.0'
|
15
|
+
s.add_dependency('jwt', '~> 2')
|
16
16
|
s.add_development_dependency('rake', '~> 12.0')
|
17
17
|
s.add_development_dependency('minitest', '~> 5.0')
|
18
18
|
s.add_development_dependency('webmock', '~> 3.0')
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexmo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.3.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: 2018-
|
11
|
+
date: 2018-08-01 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
|
-
version: '
|
19
|
+
version: '2'
|
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
|
-
version: '
|
26
|
+
version: '2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,6 +95,8 @@ files:
|
|
95
95
|
- lib/nexmo/errors/error.rb
|
96
96
|
- lib/nexmo/errors/server_error.rb
|
97
97
|
- lib/nexmo/files.rb
|
98
|
+
- lib/nexmo/form_data.rb
|
99
|
+
- lib/nexmo/json.rb
|
98
100
|
- lib/nexmo/jwt.rb
|
99
101
|
- lib/nexmo/key_value_logger.rb
|
100
102
|
- lib/nexmo/keys.rb
|
@@ -124,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
126
|
requirements:
|
125
127
|
- - ">="
|
126
128
|
- !ruby/object:Gem::Version
|
127
|
-
version: 2.
|
129
|
+
version: 2.1.0
|
128
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
131
|
requirements:
|
130
132
|
- - ">="
|
@@ -132,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
134
|
version: '0'
|
133
135
|
requirements: []
|
134
136
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.6
|
137
|
+
rubygems_version: 2.7.6
|
136
138
|
signing_key:
|
137
139
|
specification_version: 4
|
138
140
|
summary: This is the Ruby client library for Nexmo's API. To use it you'll need a
|