twilio-ruby 5.0.0.rc17 → 5.0.0.rc18
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 +6 -0
- data/lib/twilio-ruby/framework/exception.rb +1 -1
- data/lib/twilio-ruby/jwt/access_token.rb +20 -19
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/jwt/access_token_spec.rb +26 -22
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65bf4f480d461395082b21dc0dea663fde225fde
|
4
|
+
data.tar.gz: 9c61dd3a358db1dafbcae422a23e4a3aa53a9f9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6cebe289074228b30df754605c9bc9d8fa9a4e00bc0a0f9965e90e3f7f5f69dc6378dee0e1a8f41a1909ecf9ea9aaf474899afa54afb9d1132e3e113107e84f
|
7
|
+
data.tar.gz: 96a39ab02766a8d277c8387a02815149f4498a1ba3654ced411967f54411766e00017d56b8d979ba8c676d9c8bdf0952e745e59085456041b0ec5bfb632a0910
|
data/CHANGES.md
CHANGED
@@ -52,25 +52,6 @@ module Twilio
|
|
52
52
|
to_jwt
|
53
53
|
end
|
54
54
|
|
55
|
-
class ConversationsGrant
|
56
|
-
attr_accessor :configuration_profile_sid
|
57
|
-
|
58
|
-
def key
|
59
|
-
'rtc'
|
60
|
-
end
|
61
|
-
|
62
|
-
def payload
|
63
|
-
payload = {}
|
64
|
-
|
65
|
-
if configuration_profile_sid
|
66
|
-
payload[:configuration_profile_sid] = configuration_profile_sid
|
67
|
-
end
|
68
|
-
|
69
|
-
payload
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
55
|
class IpMessagingGrant
|
75
56
|
attr_accessor :service_sid,
|
76
57
|
:endpoint_id,
|
@@ -162,6 +143,26 @@ module Twilio
|
|
162
143
|
payload
|
163
144
|
end
|
164
145
|
end
|
146
|
+
|
147
|
+
class VideoGrant
|
148
|
+
attr_accessor :room
|
149
|
+
|
150
|
+
def key
|
151
|
+
'video'
|
152
|
+
end
|
153
|
+
|
154
|
+
def payload
|
155
|
+
payload = {}
|
156
|
+
|
157
|
+
if room
|
158
|
+
payload[:room] = room
|
159
|
+
end
|
160
|
+
|
161
|
+
payload
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
|
165
166
|
end
|
166
167
|
end
|
167
168
|
end
|
data/lib/twilio-ruby/version.rb
CHANGED
@@ -42,25 +42,6 @@ describe Twilio::JWT::AccessToken do
|
|
42
42
|
expect(payload['grants']['identity']).to eq('abc')
|
43
43
|
end
|
44
44
|
|
45
|
-
it 'should be able to add conversation grant' do
|
46
|
-
scat = Twilio::JWT::AccessToken.new 'AC123', 'SK123','secret'
|
47
|
-
scat.add_grant(Twilio::JWT::AccessToken::ConversationsGrant.new)
|
48
|
-
|
49
|
-
token = scat.to_s
|
50
|
-
expect(token).not_to be_nil
|
51
|
-
payload, header = JWT.decode token, 'secret'
|
52
|
-
|
53
|
-
expect(payload['iss']).to eq('SK123')
|
54
|
-
expect(payload['sub']).to eq('AC123')
|
55
|
-
expect(payload['exp']).not_to be_nil
|
56
|
-
expect(payload['exp']).to be >= Time.now.to_i
|
57
|
-
expect(payload['jti']).not_to be_nil
|
58
|
-
expect(payload['jti']).to start_with payload['iss']
|
59
|
-
expect(payload['grants']).not_to be_nil
|
60
|
-
expect(payload['grants'].count).to eq(1)
|
61
|
-
expect(payload['grants']['rtc']).not_to be_nil
|
62
|
-
end
|
63
|
-
|
64
45
|
it 'should be able to add endpoint grants' do
|
65
46
|
scat = Twilio::JWT::AccessToken.new 'AC123', 'SK123','secret'
|
66
47
|
|
@@ -119,7 +100,7 @@ describe Twilio::JWT::AccessToken do
|
|
119
100
|
|
120
101
|
it 'should add rest grants' do
|
121
102
|
scat = Twilio::JWT::AccessToken.new 'AC123', 'SK123','secret'
|
122
|
-
scat.add_grant(Twilio::JWT::AccessToken::
|
103
|
+
scat.add_grant(Twilio::JWT::AccessToken::VideoGrant.new)
|
123
104
|
scat.add_grant(Twilio::JWT::AccessToken::IpMessagingGrant.new)
|
124
105
|
|
125
106
|
token = scat.to_s
|
@@ -134,7 +115,7 @@ describe Twilio::JWT::AccessToken do
|
|
134
115
|
expect(payload['jti']).to start_with payload['iss']
|
135
116
|
expect(payload['grants']).not_to be_nil
|
136
117
|
expect(payload['grants'].count).to eq(2)
|
137
|
-
expect(payload['grants']['
|
118
|
+
expect(payload['grants']['video']).not_to be_nil
|
138
119
|
expect(payload['grants']['ip_messaging']).not_to be_nil
|
139
120
|
end
|
140
121
|
|
@@ -163,4 +144,27 @@ describe Twilio::JWT::AccessToken do
|
|
163
144
|
expect(payload['grants']['voice']['outgoing']['params']['foo']).to eq('bar')
|
164
145
|
end
|
165
146
|
|
166
|
-
|
147
|
+
it 'should add video grant' do
|
148
|
+
scat = Twilio::JWT::AccessToken.new 'AC123', 'SK123','secret'
|
149
|
+
vg = Twilio::JWT::AccessToken::VideoGrant.new
|
150
|
+
vg.room = 'room'
|
151
|
+
|
152
|
+
scat.add_grant(vg)
|
153
|
+
|
154
|
+
token = scat.to_s
|
155
|
+
expect(token).not_to be_nil
|
156
|
+
payload, header = JWT.decode token, 'secret'
|
157
|
+
|
158
|
+
expect(payload['iss']).to eq('SK123')
|
159
|
+
expect(payload['sub']).to eq('AC123')
|
160
|
+
expect(payload['exp']).not_to be_nil
|
161
|
+
expect(payload['exp']).to be >= Time.now.to_i
|
162
|
+
expect(payload['jti']).not_to be_nil
|
163
|
+
expect(payload['jti']).to start_with payload['iss']
|
164
|
+
expect(payload['grants']).not_to be_nil
|
165
|
+
expect(payload['grants'].count).to eq(1)
|
166
|
+
expect(payload['grants']['video']).not_to be_nil
|
167
|
+
expect(payload['grants']['video']['room']).to eq('room')
|
168
|
+
end
|
169
|
+
|
170
|
+
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: 5.0.0.
|
4
|
+
version: 5.0.0.rc18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Benton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.1.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
26
|
version: 2.1.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jwt
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.0'
|
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: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: faraday
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0.9'
|
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: '0.9'
|
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
|
@@ -391,27 +391,27 @@ licenses:
|
|
391
391
|
metadata: {}
|
392
392
|
post_install_message:
|
393
393
|
rdoc_options:
|
394
|
-
- --line-numbers
|
395
|
-
- --inline-source
|
396
|
-
- --title
|
394
|
+
- "--line-numbers"
|
395
|
+
- "--inline-source"
|
396
|
+
- "--title"
|
397
397
|
- twilio-ruby
|
398
|
-
- --main
|
398
|
+
- "--main"
|
399
399
|
- README.md
|
400
400
|
require_paths:
|
401
401
|
- lib
|
402
402
|
required_ruby_version: !ruby/object:Gem::Requirement
|
403
403
|
requirements:
|
404
|
-
- -
|
404
|
+
- - ">="
|
405
405
|
- !ruby/object:Gem::Version
|
406
406
|
version: 1.9.3
|
407
407
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
408
408
|
requirements:
|
409
|
-
- -
|
409
|
+
- - ">"
|
410
410
|
- !ruby/object:Gem::Version
|
411
411
|
version: 1.3.1
|
412
412
|
requirements: []
|
413
413
|
rubyforge_project:
|
414
|
-
rubygems_version: 2.
|
414
|
+
rubygems_version: 2.6.8
|
415
415
|
signing_key:
|
416
416
|
specification_version: 4
|
417
417
|
summary: A simple library for communicating with the Twilio REST API, building TwiML,
|