twilio-ruby 4.11.1 → 4.12.1
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/CHANGES.md +7 -0
- data/issue_template.md +25 -0
- data/lib/twilio-ruby/util/access_token.rb +35 -1
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/util/access_token_spec.rb +25 -0
- metadata +20 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9291a8f4dc70b794d8283de8570ef748ee625e74
|
4
|
+
data.tar.gz: 2c58fb91308924fe85dd255492ce139d916c875c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9630046dbd44aab682d5f008803048151d82bf7daeb0736cf35ec80f62e7310c9c4b0f2eddcc3961c1a3e1692265e5e5a45eba362cd84c395025c56eeae65718
|
7
|
+
data.tar.gz: 02e88f75a6cc3bf6a14930f82a3b5715ca20466bbaaceffcb34c3020031d17a5e45aeb92aa06f36f324c7a6ed7e4a57dca7772ab8d85946a8002048c532ee4eb
|
data/CHANGES.md
CHANGED
data/issue_template.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
*Note: These issues are for bugs and feature requests for the helper libraries. If you need help or support, please email help@twilio.com and one of our experts will assist you!*
|
2
|
+
|
3
|
+
|
4
|
+
**Version:**
|
5
|
+
**API Subdomain (api/taskrouter/ip_messaging):**
|
6
|
+
|
7
|
+
### Code Snippet
|
8
|
+
```ruby
|
9
|
+
# paste code here
|
10
|
+
```
|
11
|
+
|
12
|
+
### Exception / Log
|
13
|
+
```
|
14
|
+
<place exception / log here>
|
15
|
+
```
|
16
|
+
|
17
|
+
### Steps to Reproduce
|
18
|
+
1.
|
19
|
+
2.
|
20
|
+
3.
|
21
|
+
|
22
|
+
|
23
|
+
### Feature Request
|
24
|
+
_If this is a feature request, make sure you search Issues for an existing request before creating a new one!_
|
25
|
+
|
@@ -26,7 +26,6 @@ module Twilio
|
|
26
26
|
now = Time.now.to_i - 1
|
27
27
|
headers = {
|
28
28
|
'cty' => 'twilio-fpa;v=1',
|
29
|
-
'typ' => 'JWT'
|
30
29
|
}
|
31
30
|
|
32
31
|
grants = {}
|
@@ -101,6 +100,41 @@ module Twilio
|
|
101
100
|
|
102
101
|
end
|
103
102
|
|
103
|
+
class VoiceGrant
|
104
|
+
attr_accessor :outgoing_application_sid,
|
105
|
+
:outgoing_application_params,
|
106
|
+
:push_credential_sid,
|
107
|
+
:endpoint_id
|
108
|
+
|
109
|
+
def key
|
110
|
+
'voice'
|
111
|
+
end
|
112
|
+
|
113
|
+
def payload
|
114
|
+
payload = {}
|
115
|
+
|
116
|
+
if outgoing_application_sid
|
117
|
+
outgoing = {}
|
118
|
+
outgoing[:application_sid] = outgoing_application_sid
|
119
|
+
if outgoing_application_params
|
120
|
+
outgoing[:params] = outgoing_application_params
|
121
|
+
end
|
122
|
+
|
123
|
+
payload[:outgoing] = outgoing
|
124
|
+
end
|
125
|
+
|
126
|
+
if push_credential_sid
|
127
|
+
payload[:push_credential_sid] = push_credential_sid
|
128
|
+
end
|
129
|
+
|
130
|
+
if endpoint_id
|
131
|
+
payload[:endpoint_id] = endpoint_id
|
132
|
+
end
|
133
|
+
|
134
|
+
payload
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
104
138
|
end
|
105
139
|
end
|
106
140
|
end
|
data/lib/twilio-ruby/version.rb
CHANGED
@@ -111,4 +111,29 @@ describe Twilio::Util::AccessToken do
|
|
111
111
|
expect(payload['grants']['ip_messaging']).not_to be_nil
|
112
112
|
end
|
113
113
|
|
114
|
+
it 'should add programmable voice grant' do
|
115
|
+
scat = Twilio::Util::AccessToken.new 'AC123', 'SK123','secret'
|
116
|
+
pvg = Twilio::Util::AccessToken::VoiceGrant.new
|
117
|
+
pvg.outgoing_application_sid = 'AP123'
|
118
|
+
pvg.outgoing_application_params = { :foo => 'bar' }
|
119
|
+
|
120
|
+
scat.add_grant(pvg)
|
121
|
+
|
122
|
+
token = scat.to_s
|
123
|
+
expect(token).not_to be_nil
|
124
|
+
payload, header = JWT.decode token, 'secret'
|
125
|
+
|
126
|
+
expect(payload['iss']).to eq('SK123')
|
127
|
+
expect(payload['sub']).to eq('AC123')
|
128
|
+
expect(payload['exp']).not_to be_nil
|
129
|
+
expect(payload['exp']).to be >= Time.now.to_i
|
130
|
+
expect(payload['jti']).not_to be_nil
|
131
|
+
expect(payload['jti']).to start_with payload['iss']
|
132
|
+
expect(payload['grants']).not_to be_nil
|
133
|
+
expect(payload['grants'].count).to eq(1)
|
134
|
+
expect(payload['grants']['voice']).not_to be_nil
|
135
|
+
expect(payload['grants']['voice']['outgoing']['application_sid']).to eq('AP123')
|
136
|
+
expect(payload['grants']['voice']['outgoing']['params']['foo']).to eq('bar')
|
137
|
+
end
|
138
|
+
|
114
139
|
end
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twilio-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Benton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.3.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: 1.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: builder
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 2.1.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.1.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: jwt
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.5'
|
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
68
|
version: '1.5'
|
69
69
|
description: A simple library for communicating with the Twilio REST API, building
|
@@ -76,8 +76,8 @@ extra_rdoc_files:
|
|
76
76
|
- README.md
|
77
77
|
- LICENSE.md
|
78
78
|
files:
|
79
|
-
- .gitignore
|
80
|
-
- .travis.yml
|
79
|
+
- ".gitignore"
|
80
|
+
- ".travis.yml"
|
81
81
|
- AUTHORS.md
|
82
82
|
- CHANGES.md
|
83
83
|
- Gemfile
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- examples/examples.rb
|
131
131
|
- examples/print-call-log.rb
|
132
132
|
- examples/taskrouter.examples.rb
|
133
|
+
- issue_template.md
|
133
134
|
- lib/rack/twilio_webhook_authentication.rb
|
134
135
|
- lib/twilio-ruby.rb
|
135
136
|
- lib/twilio-ruby/rest/accounts.rb
|
@@ -285,27 +286,27 @@ licenses:
|
|
285
286
|
metadata: {}
|
286
287
|
post_install_message:
|
287
288
|
rdoc_options:
|
288
|
-
- --line-numbers
|
289
|
-
- --inline-source
|
290
|
-
- --title
|
289
|
+
- "--line-numbers"
|
290
|
+
- "--inline-source"
|
291
|
+
- "--title"
|
291
292
|
- twilio-ruby
|
292
|
-
- --main
|
293
|
+
- "--main"
|
293
294
|
- README.md
|
294
295
|
require_paths:
|
295
296
|
- lib
|
296
297
|
required_ruby_version: !ruby/object:Gem::Requirement
|
297
298
|
requirements:
|
298
|
-
- -
|
299
|
+
- - ">="
|
299
300
|
- !ruby/object:Gem::Version
|
300
301
|
version: 1.9.3
|
301
302
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
302
303
|
requirements:
|
303
|
-
- -
|
304
|
+
- - ">="
|
304
305
|
- !ruby/object:Gem::Version
|
305
306
|
version: '0'
|
306
307
|
requirements: []
|
307
308
|
rubyforge_project:
|
308
|
-
rubygems_version: 2.
|
309
|
+
rubygems_version: 2.5.1
|
309
310
|
signing_key:
|
310
311
|
specification_version: 4
|
311
312
|
summary: A simple library for communicating with the Twilio REST API, building TwiML,
|