nexmo 5.1.1 → 5.2.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 +4 -4
- data/README.md +12 -0
- data/lib/nexmo.rb +5 -0
- data/lib/nexmo/authentication/abstract.rb +7 -0
- data/lib/nexmo/authentication/bearer_token.rb +11 -0
- data/lib/nexmo/authentication/key_secret_params.rb +10 -0
- data/lib/nexmo/authentication/key_secret_query.rb +18 -0
- data/lib/nexmo/call_dtmf.rb +2 -2
- data/lib/nexmo/call_stream.rb +2 -2
- data/lib/nexmo/call_talk.rb +2 -2
- data/lib/nexmo/calls.rb +2 -2
- data/lib/nexmo/client.rb +4 -0
- data/lib/nexmo/files.rb +2 -2
- data/lib/nexmo/namespace.rb +11 -9
- data/lib/nexmo/params.rb +9 -0
- data/lib/nexmo/redact.rb +19 -0
- data/lib/nexmo/version.rb +1 -1
- data/nexmo.gemspec +1 -1
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a75b2e071168d3e90be330542e75ef9ec3169f45
|
4
|
+
data.tar.gz: ee5a64fa8f7249c8d07664fd8edec0165e722c8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddf564d5563ef4f9f29603c2932ed50bc336efdc4526fdf169ba4c2dcf4b569d5a7a27df77ce0064b6e4b5d6c45266d6eac815e770aba8f200b3794cc21b4753
|
7
|
+
data.tar.gz: 72cbc7f778f491e88fd1991afb66932fb40efd4eddb1215ddcfcf3fe48c677a9dba5871bb89ce0681c52e6340308c822cca5cad3bb219dd22edf33017c90dc17
|
data/README.md
CHANGED
@@ -14,6 +14,7 @@ need a Nexmo account. Sign up [for free at nexmo.com][signup].
|
|
14
14
|
* [Number Insight API](#number-insight-api)
|
15
15
|
* [Application API](#application-api)
|
16
16
|
* [Numbers API](#numbers-api)
|
17
|
+
* [Redact API](#redact-api)
|
17
18
|
* [Logging](#logging)
|
18
19
|
* [JWT authentication](#jwt-authentication)
|
19
20
|
* [Webhook signatures](#webhook-signatures)
|
@@ -357,6 +358,17 @@ client.numbers.update(country: 'GB', msisdn: '447700900000', voice_callback_type
|
|
357
358
|
Docs: [https://developer.nexmo.com/api/developer/numbers#update-a-number](https://developer.nexmo.com/api/developer/numbers?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#update-a-number)
|
358
359
|
|
359
360
|
|
361
|
+
## Redact API
|
362
|
+
|
363
|
+
### Redact a specific message
|
364
|
+
|
365
|
+
```ruby
|
366
|
+
client.redact.transaction(id: '00A0B0C0', product: 'sms')
|
367
|
+
```
|
368
|
+
|
369
|
+
Docs: [https://developer.nexmo.com/api/redact#transaction](https://developer.nexmo.com/api/redact?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#transaction)
|
370
|
+
|
371
|
+
|
360
372
|
## Logging
|
361
373
|
|
362
374
|
Use the logger option or attribute writer method to specify a logger. For example:
|
data/lib/nexmo.rb
CHANGED
@@ -9,6 +9,10 @@ require 'nexmo/errors/error'
|
|
9
9
|
require 'nexmo/errors/client_error'
|
10
10
|
require 'nexmo/errors/server_error'
|
11
11
|
require 'nexmo/errors/authentication_error'
|
12
|
+
require 'nexmo/authentication/abstract'
|
13
|
+
require 'nexmo/authentication/bearer_token'
|
14
|
+
require 'nexmo/authentication/key_secret_params'
|
15
|
+
require 'nexmo/authentication/key_secret_query'
|
12
16
|
require 'nexmo/key_value_logger'
|
13
17
|
require 'nexmo/namespace'
|
14
18
|
require 'nexmo/client'
|
@@ -26,5 +30,6 @@ require 'nexmo/number_insight'
|
|
26
30
|
require 'nexmo/numbers'
|
27
31
|
require 'nexmo/pricing_types'
|
28
32
|
require 'nexmo/pricing'
|
33
|
+
require 'nexmo/redact'
|
29
34
|
require 'nexmo/sms'
|
30
35
|
require 'nexmo/verify'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Nexmo
|
2
|
+
class KeySecretQuery < AbstractAuthentication
|
3
|
+
def update(object)
|
4
|
+
return unless object.is_a?(URI)
|
5
|
+
|
6
|
+
object.query = Params.join(object.query, params)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def params
|
12
|
+
{
|
13
|
+
api_key: @client.api_key,
|
14
|
+
api_secret: @client.api_secret
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/nexmo/call_dtmf.rb
CHANGED
data/lib/nexmo/call_stream.rb
CHANGED
data/lib/nexmo/call_talk.rb
CHANGED
data/lib/nexmo/calls.rb
CHANGED
data/lib/nexmo/client.rb
CHANGED
data/lib/nexmo/files.rb
CHANGED
data/lib/nexmo/namespace.rb
CHANGED
@@ -21,8 +21,8 @@ module Nexmo
|
|
21
21
|
'api.nexmo.com'
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
25
|
-
|
24
|
+
def authentication
|
25
|
+
@authentication ||= KeySecretParams.new(@client)
|
26
26
|
end
|
27
27
|
|
28
28
|
def json_body?
|
@@ -36,20 +36,22 @@ module Nexmo
|
|
36
36
|
def request(path, params: nil, type: Get, &block)
|
37
37
|
uri = URI('https://' + host + path)
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
params[:api_secret] = @client.api_secret
|
43
|
-
end
|
39
|
+
params ||= {}
|
40
|
+
|
41
|
+
authentication.update(params)
|
44
42
|
|
45
|
-
unless type::REQUEST_HAS_BODY || params.
|
43
|
+
unless type::REQUEST_HAS_BODY || params.empty?
|
46
44
|
uri.query = Params.encode(params)
|
47
45
|
end
|
48
46
|
|
47
|
+
authentication.update(uri)
|
48
|
+
|
49
49
|
message = type.new(uri.request_uri)
|
50
|
-
|
50
|
+
|
51
51
|
message['User-Agent'] = @client.user_agent
|
52
52
|
|
53
|
+
authentication.update(message)
|
54
|
+
|
53
55
|
encode_body(params, message) if type::REQUEST_HAS_BODY
|
54
56
|
|
55
57
|
logger.info('Nexmo API request', method: message.method, path: uri.path)
|
data/lib/nexmo/params.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'cgi'
|
2
3
|
|
3
4
|
module Nexmo
|
@@ -6,6 +7,14 @@ module Nexmo
|
|
6
7
|
params.flat_map { |k, vs| Array(vs).map { |v| "#{escape(k)}=#{escape(v)}" } }.join('&')
|
7
8
|
end
|
8
9
|
|
10
|
+
def self.join(string, params)
|
11
|
+
encoded = encode(params)
|
12
|
+
|
13
|
+
return encoded if string.nil?
|
14
|
+
|
15
|
+
string + '&' + encoded
|
16
|
+
end
|
17
|
+
|
9
18
|
private
|
10
19
|
|
11
20
|
def self.escape(component)
|
data/lib/nexmo/redact.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Nexmo
|
4
|
+
class Redact < Namespace
|
5
|
+
def transaction(params)
|
6
|
+
request('/v1/redact/transaction', params: params, type: Post)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def authentication
|
12
|
+
@authentication ||= KeySecretQuery.new(@client)
|
13
|
+
end
|
14
|
+
|
15
|
+
def json_body?
|
16
|
+
true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/nexmo/version.rb
CHANGED
data/nexmo.gemspec
CHANGED
@@ -13,7 +13,7 @@ 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 = '>= 2.0.0'
|
15
15
|
s.add_dependency('jwt')
|
16
|
-
s.add_development_dependency('rake')
|
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')
|
19
19
|
s.require_path = 'lib'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexmo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.2.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-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '12.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: '0'
|
40
|
+
version: '12.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,6 +79,10 @@ files:
|
|
79
79
|
- lib/nexmo/account.rb
|
80
80
|
- lib/nexmo/alerts.rb
|
81
81
|
- lib/nexmo/applications.rb
|
82
|
+
- lib/nexmo/authentication/abstract.rb
|
83
|
+
- lib/nexmo/authentication/bearer_token.rb
|
84
|
+
- lib/nexmo/authentication/key_secret_params.rb
|
85
|
+
- lib/nexmo/authentication/key_secret_query.rb
|
82
86
|
- lib/nexmo/call_dtmf.rb
|
83
87
|
- lib/nexmo/call_stream.rb
|
84
88
|
- lib/nexmo/call_talk.rb
|
@@ -101,6 +105,7 @@ files:
|
|
101
105
|
- lib/nexmo/params.rb
|
102
106
|
- lib/nexmo/pricing.rb
|
103
107
|
- lib/nexmo/pricing_types.rb
|
108
|
+
- lib/nexmo/redact.rb
|
104
109
|
- lib/nexmo/signature.rb
|
105
110
|
- lib/nexmo/sms.rb
|
106
111
|
- lib/nexmo/user_agent.rb
|