twilio-ruby 5.0.0.rc14 → 5.0.0.rc15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9211a021f399ed356530eff15db5a4bf4f413767
4
- data.tar.gz: 875e85e3705723ac5639ed8b171f2bee92b1432b
3
+ metadata.gz: 3d8eb2cbec1f4bf001328a11a0b0cc2643a17666
4
+ data.tar.gz: f775163bf96b146bc0be87f1a8e3efca0138e41f
5
5
  SHA512:
6
- metadata.gz: 85baeb0d8ec8d4fe6ce0e828055615a4772998145a0fde5608d9f412f2e7330223315aeedad491f8247be15100bc9c67f6976aaad1f18932b31db81324d1302e
7
- data.tar.gz: e7857cd7165efd56bdf6b436292d8ed94f4fdf84c885f59df9ea312ff2febd08fbdf470a0d2306169d5090780b5f605ad6f25c3e7b00472e48a540923c352683
6
+ metadata.gz: 66e51f81601e8a67623189ed867f8a48aa731c7fa8206e860cfee1525995f0382d5a6d1cfbd337a6cb2bf5799afd2e342518aeeee501d1a548dde1668a627c62
7
+ data.tar.gz: 863439cd078a96c34c5e2b5a8be3ac33541a4ffe3e6a3fdeb0e514c4371dbf9b09ba35e9ef249ceafb5e20c879c2541dae366b46def33259f421e9c350a8819d
data/CHANGES.md CHANGED
@@ -1,6 +1,13 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ Version 5.0.0-rc9
5
+ -------------
6
+
7
+ Release September 1, 2016
8
+
9
+ - Add voice grant.
10
+
4
11
  Version 5.0.0-rc8
5
12
  -------------
6
13
 
@@ -41,7 +48,7 @@ Release January 29, 2016
41
48
  - Fully configurable and swappable HTTP Client interfaces
42
49
  - Normalization of mounts -> endpoints relations, with first-class unified support for subdomains and multi-version support
43
50
  - Fixed URL pathing of subresources, preventing edge case errors with path building via mounting
44
- - Proper serialization/deserialization of types (integers, dates, etc.)
51
+ - Proper serialization/deserialization of types (integers, dates, etc.)
45
52
 
46
53
  Version 4.2.0
47
54
  -------------
data/README.md CHANGED
@@ -11,13 +11,13 @@ A module for using the Twilio REST API and generating valid [TwiML](http://www.t
11
11
  To install using [Bundler][bundler] grab the latest stable version:
12
12
 
13
13
  ```ruby
14
- gem 'twilio-ruby', '~> 5.0.0.rc14'
14
+ gem 'twilio-ruby', '~> 5.0.0.rc15'
15
15
  ```
16
16
 
17
17
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
18
18
 
19
19
  ```bash
20
- gem install twilio-ruby -v 5.0.0.rc14
20
+ gem install twilio-ruby -v 5.0.0.rc15
21
21
  ```
22
22
 
23
23
  To build and install the development branch yourself from the latest source:
@@ -25,8 +25,7 @@ module Twilio
25
25
  def to_jwt(algorithm='HS256')
26
26
  now = Time.now.to_i - 1
27
27
  headers = {
28
- cty: 'twilio-fpa;v=1',
29
- typ: 'JWT'
28
+ cty: 'twilio-fpa;v=1'
30
29
  }
31
30
 
32
31
  grants = {}
@@ -106,6 +105,41 @@ module Twilio
106
105
 
107
106
  end
108
107
 
108
+ class VoiceGrant
109
+ attr_accessor :outgoing_application_sid,
110
+ :outgoing_application_params,
111
+ :push_credential_sid,
112
+ :endpoint_id
113
+
114
+ def key
115
+ 'voice'
116
+ end
117
+
118
+ def payload
119
+ payload = {}
120
+
121
+ if outgoing_application_sid
122
+ outgoing = {}
123
+ outgoing[:application_sid] = outgoing_application_sid
124
+ if outgoing_application_params
125
+ outgoing[:params] = outgoing_application_params
126
+ end
127
+
128
+ payload[:outgoing] = outgoing
129
+ end
130
+
131
+ if push_credential_sid
132
+ payload[:push_credential_sid] = push_credential_sid
133
+ end
134
+
135
+ if endpoint_id
136
+ payload[:endpoint_id] = endpoint_id
137
+ end
138
+
139
+ payload
140
+ end
141
+ end
142
+
109
143
  end
110
144
  end
111
145
  end
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '5.0.0.rc14'
2
+ VERSION = '5.0.0.rc15'
3
3
  end
@@ -111,4 +111,29 @@ describe Twilio::JWT::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::JWT::AccessToken.new 'AC123', 'SK123','secret'
116
+ pvg = Twilio::JWT::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: 5.0.0.rc14
4
+ version: 5.0.0.rc15
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-08-05 00:00:00.000000000 Z
11
+ date: 2016-09-01 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
@@ -362,27 +362,27 @@ licenses:
362
362
  metadata: {}
363
363
  post_install_message:
364
364
  rdoc_options:
365
- - --line-numbers
366
- - --inline-source
367
- - --title
365
+ - "--line-numbers"
366
+ - "--inline-source"
367
+ - "--title"
368
368
  - twilio-ruby
369
- - --main
369
+ - "--main"
370
370
  - README.md
371
371
  require_paths:
372
372
  - lib
373
373
  required_ruby_version: !ruby/object:Gem::Requirement
374
374
  requirements:
375
- - - '>='
375
+ - - ">="
376
376
  - !ruby/object:Gem::Version
377
377
  version: 1.9.3
378
378
  required_rubygems_version: !ruby/object:Gem::Requirement
379
379
  requirements:
380
- - - '>'
380
+ - - ">"
381
381
  - !ruby/object:Gem::Version
382
382
  version: 1.3.1
383
383
  requirements: []
384
384
  rubyforge_project:
385
- rubygems_version: 2.0.14
385
+ rubygems_version: 2.5.1
386
386
  signing_key:
387
387
  specification_version: 4
388
388
  summary: A simple library for communicating with the Twilio REST API, building TwiML,