twilio-ruby 5.63.0 → 5.65.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test-and-deploy.yml +27 -3
  3. data/.rubocop.yml +1 -1
  4. data/.rubocop_todo.yml +84 -21
  5. data/CHANGES.md +79 -0
  6. data/Makefile +1 -4
  7. data/README.md +3 -2
  8. data/lib/rack/twilio_webhook_authentication.rb +25 -1
  9. data/lib/twilio-ruby/rest/api/v2010/account/call/siprec.rb +7 -0
  10. data/lib/twilio-ruby/rest/api/v2010/account/call/stream.rb +674 -0
  11. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +26 -0
  12. data/lib/twilio-ruby/rest/conversations/v1/address_configuration.rb +447 -0
  13. data/lib/twilio-ruby/rest/conversations/v1.rb +17 -0
  14. data/lib/twilio-ruby/rest/conversations.rb +9 -0
  15. data/lib/twilio-ruby/rest/fax/v1/fax.rb +0 -77
  16. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +33 -18
  17. data/lib/twilio-ruby/rest/insights/v1/conference/conference_participant.rb +474 -0
  18. data/lib/twilio-ruby/rest/insights/v1/conference.rb +512 -0
  19. data/lib/twilio-ruby/rest/insights/v1.rb +16 -0
  20. data/lib/twilio-ruby/rest/insights.rb +8 -0
  21. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +7 -0
  22. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +75 -18
  23. data/lib/twilio-ruby/rest/supersim/v1/esim_profile.rb +372 -0
  24. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +71 -30
  25. data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +1 -1
  26. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +9 -9
  27. data/lib/twilio-ruby/rest/supersim/v1.rb +16 -0
  28. data/lib/twilio-ruby/rest/supersim.rb +9 -0
  29. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +130 -8
  30. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +7 -0
  31. data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +16 -6
  32. data/lib/twilio-ruby/rest/verify/v2/service.rb +8 -2
  33. data/lib/twilio-ruby/rest/verify/v2/template.rb +1 -1
  34. data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +89 -21
  35. data/lib/twilio-ruby/rest/verify.rb +2 -2
  36. data/lib/twilio-ruby/rest/video/v1/room.rb +7 -4
  37. data/lib/twilio-ruby/version.rb +1 -1
  38. data/sonar-project.properties +1 -1
  39. data/twilio-ruby.gemspec +0 -1
  40. metadata +7 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 582f6e6561bd6ee40a9aadaefc0e2550df5d565f
4
- data.tar.gz: 8ec0f4c692bd66e1da3a7ea99d58f4ddaa8b6d0c
3
+ metadata.gz: 2e90fafb6816881836f5ceb1a9e9fbf4c8ab7b1f
4
+ data.tar.gz: 8506a936bb4d704851066cc99577b3a897a4c61a
5
5
  SHA512:
6
- metadata.gz: 5864ca88585ee5e2f4952218d1c85180caac3e0b0c4361836e8cc850c2e1fc716f20d0fcd931df29e03e05e54ad4c5bb9c93d46eda5e6e94f8d3aee5a6aa0e64
7
- data.tar.gz: 26560b4c09aa1161baac7ba7ac3c83bebe154b4a923e71e550e03742614c1d51e4ef086b747e83645c27f2092eb05a8c811f23f0f7636f0b8f6e191407513fa0
6
+ metadata.gz: 6ed63525ff5e54ea2002e696432752125a26a80a3d0a73959d98e96247e09e9845906bc62d9b86a5026eef22fc05a36ab1dc3555d30c91db0ef3a442e78d18a8
7
+ data.tar.gz: cef0e7825363d18d6dae30e3ab444a9e1bd8187dcc46361f99c51d0258b161b693a4cbe600a259342109ef591f7649c4dc6ed7ad54788a119b4e27e4b3e3c29a
@@ -17,11 +17,12 @@ jobs:
17
17
  timeout-minutes: 20
18
18
  strategy:
19
19
  matrix:
20
- ruby: [ 2.4, 2.5, 2.6, 2.7, '3.0', ruby-head, jruby-9.2 ]
21
- continue-on-error: ${{ matrix.ruby == 'ruby-head' }}
20
+ ruby: [ '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', 'ruby-head', 'jruby-9.2' ]
22
21
  steps:
23
22
  - name: Checkout twilio-ruby
24
23
  uses: actions/checkout@v2
24
+ with:
25
+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
25
26
 
26
27
  - name: Set up Ruby
27
28
  uses: ruby/setup-ruby@v1
@@ -29,11 +30,34 @@ jobs:
29
30
  ruby-version: ${{ matrix.ruby }}
30
31
  bundler-cache: true
31
32
 
33
+ # Excludes incompatible versions of ruby
34
+ - name: Set up linter
35
+ run: bundle add rubocop --version "~> 1.24.1" --group "development" --skip-install
36
+ if: ${{ matrix.ruby != '2.4' }}
37
+
32
38
  - run: bundle install --with development
33
39
  - run: bundle exec rake install
40
+
41
+ - name: Run linter
42
+ run: bundle exec rubocop -d --cache true --parallel
43
+ if: ${{ matrix.ruby != '2.4' }}
44
+
34
45
  - name: Run Unit Tests
35
46
  run: make test
36
47
 
48
+ - name: Fix code coverage paths
49
+ if: ${{ (github.event_name == 'pull_request' || github.ref_type == 'branch') && matrix.ruby == '3.0' && !github.event.pull_request.head.repo.fork }}
50
+ working-directory: ./coverage
51
+ run: |
52
+ sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.json
53
+
54
+ - name: SonarCloud Scan
55
+ if: ${{ (github.event_name == 'pull_request' || github.ref_type == 'branch') && matrix.ruby == '3.0' && !github.event.pull_request.head.repo.fork }}
56
+ uses: SonarSource/sonarcloud-github-action@master
57
+ env:
58
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
59
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
60
+
37
61
  deploy:
38
62
  name: Deploy
39
63
  if: success() && github.ref_type == 'tag'
@@ -91,7 +115,7 @@ jobs:
91
115
  env:
92
116
  SLACK_COLOR: failure
93
117
  SLACK_ICON_EMOJI: ':github:'
94
- SLACK_MESSAGE: ${{ format('Tests *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }}
118
+ SLACK_MESSAGE: ${{ format('Test *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }}
95
119
  SLACK_TITLE: Action Failure - ${{ github.repository }}
96
120
  SLACK_USERNAME: GitHub Actions
97
121
  SLACK_MSG_AUTHOR: twilio-dx
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.4
4
+ TargetRubyVersion: 2.5
5
5
  Exclude:
6
6
  - 'lib/twilio-ruby/rest/**/*'
7
7
  - 'spec/integration/**/*'
data/.rubocop_todo.yml CHANGED
@@ -1,14 +1,14 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-04-29 14:57:47 -0500 using RuboCop version 0.82.0.
3
+ # on 2022-01-13 21:45:15 UTC using RuboCop version 1.24.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
9
+ # Offense count: 2
10
10
  # Cop supports --auto-correct.
11
- # Configuration parameters: TreatCommentsAsGroupSeparators, Include.
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
12
  # Include: **/*.gemspec
13
13
  Gemspec/OrderedDependencies:
14
14
  Exclude:
@@ -28,13 +28,6 @@ Layout/EmptyLineAfterGuardClause:
28
28
  - 'lib/rack/twilio_webhook_authentication.rb'
29
29
  - 'lib/twilio-ruby/framework/serialize.rb'
30
30
 
31
- # Offense count: 1
32
- # Cop supports --auto-correct.
33
- # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
34
- Layout/ExtraSpacing:
35
- Exclude:
36
- - 'twilio-ruby.gemspec'
37
-
38
31
  # Offense count: 2
39
32
  # Cop supports --auto-correct.
40
33
  # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
@@ -53,6 +46,24 @@ Layout/SpaceInsideHashLiteralBraces:
53
46
  - 'spec/jwt/access_token_spec.rb'
54
47
  - 'spec/jwt/client_capability_spec.rb'
55
48
 
49
+ # Offense count: 3
50
+ # Configuration parameters: AllowedMethods.
51
+ # AllowedMethods: enums
52
+ Lint/ConstantDefinitionInBlock:
53
+ Exclude:
54
+ - 'spec/jwt/client_capability_spec.rb'
55
+ - 'spec/rest/client_spec.rb'
56
+
57
+ # Offense count: 1
58
+ Lint/MissingSuper:
59
+ Exclude:
60
+ - 'lib/twilio-ruby/framework/rest/error.rb'
61
+
62
+ # Offense count: 1
63
+ Lint/SelfAssignment:
64
+ Exclude:
65
+ - 'lib/twilio-ruby/framework/rest/version.rb'
66
+
56
67
  # Offense count: 1
57
68
  # Cop supports --auto-correct.
58
69
  # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
@@ -70,6 +81,7 @@ Lint/UnusedMethodArgument:
70
81
  - 'spec/holodeck/holodeck.rb'
71
82
 
72
83
  # Offense count: 1
84
+ # Cop supports --auto-correct.
73
85
  # Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
74
86
  Lint/UselessAccessModifier:
75
87
  Exclude:
@@ -80,8 +92,14 @@ Lint/UselessAssignment:
80
92
  Exclude:
81
93
  - 'spec/rack/twilio_webhook_authentication_spec.rb'
82
94
 
95
+ # Offense count: 6
96
+ # Configuration parameters: Max, CountKeywordArgs.
97
+ Metrics/ParameterLists:
98
+ MaxOptionalParameters: 6
99
+
83
100
  # Offense count: 1
84
- # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
101
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
102
+ # CheckDefinitionPathHierarchyRoots: lib, spec, test, src
85
103
  # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
86
104
  Naming/FileName:
87
105
  Exclude:
@@ -89,20 +107,28 @@ Naming/FileName:
89
107
 
90
108
  # Offense count: 2
91
109
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
92
- # AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
110
+ # AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
93
111
  Naming/MethodParameterName:
94
112
  Exclude:
95
113
  - 'lib/twilio-ruby/security/request_validator.rb'
96
114
 
97
115
  # Offense count: 19
98
- # Configuration parameters: EnforcedStyle.
116
+ # Configuration parameters: EnforcedStyle, AllowedIdentifiers.
99
117
  # SupportedStyles: snake_case, camelCase
100
118
  Naming/VariableName:
101
119
  Exclude:
102
120
  - 'spec/jwt/client_capability_spec.rb'
103
121
  - 'spec/jwt/task_router_spec.rb'
104
122
 
105
- # Offense count: 39
123
+ # Offense count: 3
124
+ # Cop supports --auto-correct.
125
+ Style/CaseLikeIf:
126
+ Exclude:
127
+ - 'lib/twilio-ruby/framework/serialize.rb'
128
+ - 'lib/twilio-ruby/jwt/task_router.rb'
129
+
130
+ # Offense count: 40
131
+ # Configuration parameters: AllowedConstants.
106
132
  Style/Documentation:
107
133
  Enabled: false
108
134
 
@@ -119,28 +145,36 @@ Style/ExpandPathArguments:
119
145
  - 'spec/spec_helper.rb'
120
146
  - 'twilio-ruby.gemspec'
121
147
 
122
- # Offense count: 23
148
+ # Offense count: 24
123
149
  # Cop supports --auto-correct.
124
150
  # Configuration parameters: EnforcedStyle.
125
151
  # SupportedStyles: always, always_true, never
126
152
  Style/FrozenStringLiteralComment:
127
153
  Enabled: false
128
154
 
155
+ # Offense count: 1
156
+ # Cop supports --auto-correct.
157
+ Style/GlobalStdStream:
158
+ Exclude:
159
+ - 'spec/rest/client_spec.rb'
160
+
129
161
  # Offense count: 3
130
162
  # Configuration parameters: MinBodyLength.
131
163
  Style/GuardClause:
132
164
  Exclude:
133
165
  - 'lib/twilio-ruby/framework/rest/page.rb'
134
166
 
135
- # Offense count: 1
167
+ # Offense count: 2
136
168
  # Cop supports --auto-correct.
137
- # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
169
+ # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
138
170
  # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
171
+ # SupportedShorthandSyntax: always, never
139
172
  Style/HashSyntax:
140
173
  Exclude:
174
+ - 'Gemfile'
141
175
  - 'spec/jwt/access_token_spec.rb'
142
176
 
143
- # Offense count: 12
177
+ # Offense count: 13
144
178
  # Cop supports --auto-correct.
145
179
  Style/IfUnlessModifier:
146
180
  Exclude:
@@ -150,6 +184,20 @@ Style/IfUnlessModifier:
150
184
  - 'lib/twilio-ruby/jwt/client_capability.rb'
151
185
  - 'lib/twilio-ruby/jwt/jwt.rb'
152
186
 
187
+ # Offense count: 3
188
+ # Cop supports --auto-correct.
189
+ Style/RedundantAssignment:
190
+ Exclude:
191
+ - 'lib/twilio-ruby/jwt/access_token.rb'
192
+ - 'lib/twilio-ruby/jwt/client_capability.rb'
193
+ - 'lib/twilio-ruby/jwt/task_router.rb'
194
+
195
+ # Offense count: 2
196
+ # Cop supports --auto-correct.
197
+ Style/RedundantFileExtensionInRequire:
198
+ Exclude:
199
+ - 'spec/spec_helper.rb'
200
+
153
201
  # Offense count: 4
154
202
  # Cop supports --auto-correct.
155
203
  Style/RedundantFreeze:
@@ -173,15 +221,30 @@ Style/RegexpLiteral:
173
221
  - 'lib/twilio-ruby/framework/rest/version.rb'
174
222
  - 'spec/rack/twilio_webhook_authentication_spec.rb'
175
223
 
176
- # Offense count: 5
224
+ # Offense count: 12
225
+ # Cop supports --auto-correct.
226
+ # Configuration parameters: Mode.
227
+ Style/StringConcatenation:
228
+ Exclude:
229
+ - 'examples/print_call_log.rb'
230
+ - 'lib/twilio-ruby/framework/request.rb'
231
+ - 'lib/twilio-ruby/framework/rest/error.rb'
232
+ - 'lib/twilio-ruby/framework/serialize.rb'
233
+ - 'lib/twilio-ruby/http/http_client.rb'
234
+ - 'lib/twilio-ruby/jwt/client_capability.rb'
235
+ - 'spec/framework/request_spec.rb'
236
+ - 'spec/spec_helper.rb'
237
+
238
+ # Offense count: 7
177
239
  # Cop supports --auto-correct.
178
240
  # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
179
241
  # SupportedStyles: single_quotes, double_quotes
180
242
  Style/StringLiterals:
181
243
  Exclude:
244
+ - 'Gemfile'
182
245
  - 'spec/framework/serialize_spec.rb'
183
246
 
184
- # Offense count: 14
247
+ # Offense count: 15
185
248
  # Cop supports --auto-correct.
186
249
  # Configuration parameters: AllowNamedUnderscoreVariables.
187
250
  Style/TrailingUnderscoreVariable:
@@ -190,7 +253,7 @@ Style/TrailingUnderscoreVariable:
190
253
  - 'spec/jwt/client_capability_spec.rb'
191
254
  - 'spec/jwt/task_router_spec.rb'
192
255
 
193
- # Offense count: 15
256
+ # Offense count: 16
194
257
  # Cop supports --auto-correct.
195
258
  # Configuration parameters: MinSize, WordRegex.
196
259
  # SupportedStyles: percent, brackets
data/CHANGES.md CHANGED
@@ -1,6 +1,85 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2022-02-23] Version 5.65.0
5
+ ---------------------------
6
+ **Api**
7
+ - Add `uri` to `stream` resource
8
+ - Add A2P Registration Fee category (`a2p-registration-fee`) to usage records
9
+ - Detected a bug and removed optional boolean include_soft_deleted parameter to retrieve soft deleted recordings. **(breaking change)**
10
+ - Add optional boolean include_soft_deleted parameter to retrieve soft deleted recordings.
11
+
12
+ **Numbers**
13
+ - Unrevert valid_until and sort filter params added to List Bundles resource
14
+ - Revert valid_until and sort filter params added to List Bundles resource
15
+ - Update sorting params added to List Bundles resource in the previous release
16
+
17
+ **Preview**
18
+ - Moved `web_channels` from preview to beta under `flex-api` **(breaking change)**
19
+
20
+ **Taskrouter**
21
+ - Add `ETag` as Response Header to List of Task, Reservation & Worker
22
+
23
+ **Verify**
24
+ - Remove outdated documentation commentary to contact sales. Product is already in public beta.
25
+ - Add optional `metadata` to factors.
26
+
27
+ **Twiml**
28
+ - Add new Polly Neural voices
29
+
30
+
31
+ [2022-02-09] Version 5.64.0
32
+ ---------------------------
33
+ **Library - Chore**
34
+ - [PR #594](https://github.com/twilio/twilio-ruby/pull/594): upgrade supported language versions. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
35
+
36
+ **Api**
37
+ - Add `stream` resource
38
+
39
+ **Conversations**
40
+ - Fixed DELETE request to accept "sid_like" params in Address Configuration resources **(breaking change)**
41
+ - Expose Address Configuration resource for `sms` and `whatsapp`
42
+
43
+ **Fax**
44
+ - Removed deprecated Programmable Fax Create and Update methods **(breaking change)**
45
+
46
+ **Insights**
47
+ - Rename `call_state` to `call_status` and remove `whisper` in conference participant summary **(breaking change)**
48
+
49
+ **Numbers**
50
+ - Expose valid_until filters as part of provisionally-approved compliance feature on the List Bundles resource
51
+
52
+ **Supersim**
53
+ - Fix typo in Fleet resource docs
54
+ - Updated documentation for the Fleet resource indicating that fields related to commands have been deprecated and to use sms_command fields instead.
55
+ - Add support for setting and reading `ip_commands_url` and `ip_commands_method` on Fleets resource for helper libraries
56
+ - Changed `sim` property in requests to create an SMS Command made to the /SmsCommands to accept SIM UniqueNames in addition to SIDs
57
+
58
+ **Verify**
59
+ - Update list attempts API to include new filters and response fields.
60
+
61
+
62
+ [2022-01-26] Version 5.63.1
63
+ ---------------------------
64
+ **Library - Fix**
65
+ - [PR #590](https://github.com/twilio/twilio-ruby/pull/590): Validate signatures in Rack middleware for non-form-data payloads. Thanks to [@gabrielg](https://github.com/gabrielg)!
66
+
67
+ **Library - Chore**
68
+ - [PR #589](https://github.com/twilio/twilio-ruby/pull/589): Add sonarcloud analysis. Thanks to [@BrimmingDev](https://github.com/BrimmingDev)!
69
+ - [PR #588](https://github.com/twilio/twilio-ruby/pull/588): support for rubocop linting on ruby-head. Thanks to [@Hunga1](https://github.com/Hunga1)!
70
+
71
+ **Insights**
72
+ - Added new endpoint to fetch Conference Participant Summary
73
+ - Added new endpoint to fetch Conference Summary
74
+
75
+ **Messaging**
76
+ - Add government_entity parameter to brand apis
77
+
78
+ **Verify**
79
+ - Add Access Token fetch endpoint to retrieve a previously created token.
80
+ - Add Access Token payload to the Access Token creation endpoint, including a unique Sid, so it's addressable while it's TTL is valid.
81
+
82
+
4
83
  [2022-01-12] Version 5.63.0
5
84
  ---------------------------
6
85
  **Library - Feature**
data/Makefile CHANGED
@@ -6,12 +6,9 @@ githooks:
6
6
  install:
7
7
  bundle install --with development; bundle exec rake install
8
8
 
9
- test: lint
9
+ test:
10
10
  bundle exec rake spec
11
11
 
12
- lint:
13
- bundle exec rubocop -d --cache true --parallel
14
-
15
12
  docs:
16
13
  bundle exec yard doc --output-dir ./doc
17
14
 
data/README.md CHANGED
@@ -25,6 +25,7 @@ This library supports the following Ruby implementations:
25
25
  * Ruby 2.6
26
26
  * Ruby 2.7
27
27
  * Ruby 3.0
28
+ * Ruby 3.1
28
29
 
29
30
  ### Migrating from 4.x
30
31
 
@@ -35,13 +36,13 @@ This library supports the following Ruby implementations:
35
36
  To install using [Bundler][bundler] grab the latest stable version:
36
37
 
37
38
  ```ruby
38
- gem 'twilio-ruby', '~> 5.63.0'
39
+ gem 'twilio-ruby', '~> 5.65.0'
39
40
  ```
40
41
 
41
42
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
42
43
 
43
44
  ```bash
44
- gem install twilio-ruby -v 5.63.0
45
+ gem install twilio-ruby -v 5.65.0
45
46
  ```
46
47
 
47
48
  To build and install the development branch yourself from the latest source:
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'rack/media_type'
4
+
3
5
  module Rack
4
6
  # Middleware that authenticates webhooks from Twilio using the request
5
7
  # validator.
@@ -19,6 +21,10 @@ module Rack
19
21
  # doesn't validate then the middleware responds immediately with a 403 status.
20
22
 
21
23
  class TwilioWebhookAuthentication
24
+ # Rack's FORM_DATA_MEDIA_TYPES can be modified to taste, so we're slightly
25
+ # more conservative in what we consider form data.
26
+ FORM_URLENCODED_MEDIA_TYPE = Rack::MediaType.type('application/x-www-form-urlencoded')
27
+
22
28
  def initialize(app, auth_token, *paths, &auth_token_lookup)
23
29
  @app = app
24
30
  @auth_token = auth_token
@@ -30,7 +36,7 @@ module Rack
30
36
  return @app.call(env) unless env['PATH_INFO'].match(@path_regex)
31
37
  request = Rack::Request.new(env)
32
38
  original_url = request.url
33
- params = request.post? ? request.POST : {}
39
+ params = extract_params!(request)
34
40
  auth_token = @auth_token || get_auth_token(params['AccountSid'])
35
41
  validator = Twilio::Security::RequestValidator.new(auth_token)
36
42
  signature = env['HTTP_X_TWILIO_SIGNATURE'] || ''
@@ -44,5 +50,23 @@ module Rack
44
50
  ]
45
51
  end
46
52
  end
53
+
54
+ # Extract the params from the the request that we can use to determine the
55
+ # signature. This _may_ modify the passed in request since it may read/rewind
56
+ # the body.
57
+ def extract_params!(request)
58
+ return {} unless request.post?
59
+
60
+ if request.media_type == FORM_URLENCODED_MEDIA_TYPE
61
+ request.POST
62
+ else
63
+ request.body.rewind
64
+ body = request.body.read
65
+ request.body.rewind
66
+ body
67
+ end
68
+ end
69
+
70
+ private :extract_params!
47
71
  end
48
72
  end
@@ -578,6 +578,7 @@ module Twilio
578
578
  'name' => payload['name'],
579
579
  'status' => payload['status'],
580
580
  'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
581
+ 'uri' => payload['uri'],
581
582
  }
582
583
 
583
584
  # Context
@@ -637,6 +638,12 @@ module Twilio
637
638
  @properties['date_updated']
638
639
  end
639
640
 
641
+ ##
642
+ # @return [String] The URI of the resource, relative to `https://api.twilio.com`
643
+ def uri
644
+ @properties['uri']
645
+ end
646
+
640
647
  ##
641
648
  # Update the SiprecInstance
642
649
  # @param [siprec.UpdateStatus] status The status. Must have the value `stopped`