Skip to content

Commit

Permalink
Merge branch 'main' into tc/faraday-2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
childish-sambino authored Mar 24, 2022
2 parents f2b3ac8 + 06fb9a7 commit 299bb1c
Show file tree
Hide file tree
Showing 103 changed files with 8,894 additions and 854 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
timeout-minutes: 20
strategy:
matrix:
ruby: [ 2.4, 2.5, 2.6, 2.7, '3.0', ruby-head, jruby-9.2 ]
ruby: [ '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', 'ruby-head', 'jruby-9.2' ]
steps:
- name: Checkout twilio-ruby
uses: actions/checkout@v2
Expand Down Expand Up @@ -105,6 +105,11 @@ jobs:
gem build *.gemspec
gem push *.gem
- name: Submit metric to Datadog
uses: sendgrid/dx-automator/actions/datadog-release-metric@main
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}

notify-on-failure:
name: Slack notify on failure
if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
Expand All @@ -115,7 +120,7 @@ jobs:
env:
SLACK_COLOR: failure
SLACK_ICON_EMOJI: ':github:'
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) }}
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) }}
SLACK_TITLE: Action Failure - ${{ github.repository }}
SLACK_USERNAME: GitHub Actions
SLACK_MSG_AUTHOR: twilio-dx
Expand Down
130 changes: 130 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,136 @@
twilio-ruby changelog
=====================

[2022-03-23] Version 5.66.0
---------------------------
**Api**
- Change `stream` url parameter to non optional
- Add `verify-totp` and `verify-whatsapp-conversations-business-initiated` categories to `usage_record` API

**Chat**
- Added v3 Channel update endpoint to support Public to Private channel migration

**Flex**
- Private Beta release of the Interactions API to support the upcoming release of Flex Conversations at the end of Q1 2022.
- Adding `channel_configs` object to Flex Configuration

**Media**
- Add max_duration param to PlayerStreamer

**Supersim**
- Remove Commands resource, use SmsCommands resource instead **(breaking change)**

**Taskrouter**
- Add limits to `split_by_wait_time` for Cumulative Statistics Endpoint

**Video**
- Change recording `status_callback_method` type from `enum` to `http_method` **(breaking change)**
- Add `status_callback` and `status_callback_method` to composition
- Add `status_callback` and `status_callback_method` to recording


[2022-03-09] Version 5.65.1
---------------------------
**Library - Fix**
- [PR #602](https://github.com/twilio/twilio-ruby/pull/602): don't load webhook authentication if Rack not present. Thanks to [@philnash](https://github.com/philnash)!

**Library - Chore**
- [PR #599](https://github.com/twilio/twilio-ruby/pull/599): push Datadog Release Metric upon deploy success. Thanks to [@eshanholtz](https://github.com/eshanholtz)!

**Api**
- Add optional boolean include_soft_deleted parameter to retrieve soft deleted recordings

**Chat**
- Add `X-Twilio-Wehook-Enabled` header to `delete` method in UserChannel resource

**Numbers**
- Expose `failure_reason` in the Supporting Documents resources

**Verify**
- Add optional `metadata` parameter to "verify challenge" endpoint, so the SDK/App can attach relevant information from the device when responding to challenges.
- remove beta feature flag to list atempt api operations.
- Add `ttl` and `date_created` properties to `AccessTokens`.


[2022-02-23] Version 5.65.0
---------------------------
**Api**
- Add `uri` to `stream` resource
- Add A2P Registration Fee category (`a2p-registration-fee`) to usage records
- Detected a bug and removed optional boolean include_soft_deleted parameter to retrieve soft deleted recordings. **(breaking change)**
- Add optional boolean include_soft_deleted parameter to retrieve soft deleted recordings.

**Numbers**
- Unrevert valid_until and sort filter params added to List Bundles resource
- Revert valid_until and sort filter params added to List Bundles resource
- Update sorting params added to List Bundles resource in the previous release

**Preview**
- Moved `web_channels` from preview to beta under `flex-api` **(breaking change)**

**Taskrouter**
- Add `ETag` as Response Header to List of Task, Reservation & Worker

**Verify**
- Remove outdated documentation commentary to contact sales. Product is already in public beta.
- Add optional `metadata` to factors.

**Twiml**
- Add new Polly Neural voices


[2022-02-09] Version 5.64.0
---------------------------
**Library - Chore**
- [PR #594](https://github.com/twilio/twilio-ruby/pull/594): upgrade supported language versions. Thanks to [@childish-sambino](https://github.com/childish-sambino)!

**Api**
- Add `stream` resource

**Conversations**
- Fixed DELETE request to accept "sid_like" params in Address Configuration resources **(breaking change)**
- Expose Address Configuration resource for `sms` and `whatsapp`

**Fax**
- Removed deprecated Programmable Fax Create and Update methods **(breaking change)**

**Insights**
- Rename `call_state` to `call_status` and remove `whisper` in conference participant summary **(breaking change)**

**Numbers**
- Expose valid_until filters as part of provisionally-approved compliance feature on the List Bundles resource

**Supersim**
- Fix typo in Fleet resource docs
- Updated documentation for the Fleet resource indicating that fields related to commands have been deprecated and to use sms_command fields instead.
- Add support for setting and reading `ip_commands_url` and `ip_commands_method` on Fleets resource for helper libraries
- Changed `sim` property in requests to create an SMS Command made to the /SmsCommands to accept SIM UniqueNames in addition to SIDs

**Verify**
- Update list attempts API to include new filters and response fields.


[2022-01-26] Version 5.63.1
---------------------------
**Library - Fix**
- [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)!

**Library - Chore**
- [PR #589](https://github.com/twilio/twilio-ruby/pull/589): Add sonarcloud analysis. Thanks to [@BrimmingDev](https://github.com/BrimmingDev)!
- [PR #588](https://github.com/twilio/twilio-ruby/pull/588): support for rubocop linting on ruby-head. Thanks to [@Hunga1](https://github.com/Hunga1)!

**Insights**
- Added new endpoint to fetch Conference Participant Summary
- Added new endpoint to fetch Conference Summary

**Messaging**
- Add government_entity parameter to brand apis

**Verify**
- Add Access Token fetch endpoint to retrieve a previously created token.
- Add Access Token payload to the Access Token creation endpoint, including a unique Sid, so it's addressable while it's TTL is valid.


[2022-01-12] Version 5.63.0
---------------------------
**Library - Feature**
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This library supports the following Ruby implementations:
* Ruby 2.6
* Ruby 2.7
* Ruby 3.0
* Ruby 3.1

### Migrating from 4.x

Expand All @@ -35,13 +36,13 @@ This library supports the following Ruby implementations:
To install using [Bundler][bundler] grab the latest stable version:

```ruby
gem 'twilio-ruby', '~> 5.63.0'
gem 'twilio-ruby', '~> 5.66.0'
```

To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:

```bash
gem install twilio-ruby -v 5.63.0
gem install twilio-ruby -v 5.66.0
```

To build and install the development branch yourself from the latest source:
Expand Down
26 changes: 25 additions & 1 deletion lib/rack/twilio_webhook_authentication.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'rack/media_type'

module Rack
# Middleware that authenticates webhooks from Twilio using the request
# validator.
Expand All @@ -19,6 +21,10 @@ module Rack
# doesn't validate then the middleware responds immediately with a 403 status.

class TwilioWebhookAuthentication
# Rack's FORM_DATA_MEDIA_TYPES can be modified to taste, so we're slightly
# more conservative in what we consider form data.
FORM_URLENCODED_MEDIA_TYPE = Rack::MediaType.type('application/x-www-form-urlencoded')

def initialize(app, auth_token, *paths, &auth_token_lookup)
@app = app
@auth_token = auth_token
Expand All @@ -30,7 +36,7 @@ def call(env)
return @app.call(env) unless env['PATH_INFO'].match(@path_regex)
request = Rack::Request.new(env)
original_url = request.url
params = request.post? ? request.POST : {}
params = extract_params!(request)
auth_token = @auth_token || get_auth_token(params['AccountSid'])
validator = Twilio::Security::RequestValidator.new(auth_token)
signature = env['HTTP_X_TWILIO_SIGNATURE'] || ''
Expand All @@ -44,5 +50,23 @@ def call(env)
]
end
end

# Extract the params from the the request that we can use to determine the
# signature. This _may_ modify the passed in request since it may read/rewind
# the body.
def extract_params!(request)
return {} unless request.post?

if request.media_type == FORM_URLENCODED_MEDIA_TYPE
request.POST
else
request.body.rewind
body = request.body.read
request.body.rewind
body
end
end

private :extract_params!
end
end
2 changes: 1 addition & 1 deletion lib/twilio-ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
require 'json'

require 'twilio-ruby/version' unless defined?(Twilio::VERSION)
require 'rack/twilio_webhook_authentication'
require 'rack/twilio_webhook_authentication' if defined?(Rack)

require 'twilio-ruby/util'
require 'twilio-ruby/security/request_validator'
Expand Down
26 changes: 26 additions & 0 deletions lib/twilio-ruby/rest/api/v2010/account/call.rb
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ def initialize(version, account_sid, sid)
@events = nil
@payments = nil
@siprec = nil
@streams = nil
end

##
Expand Down Expand Up @@ -617,6 +618,24 @@ def siprec(sid=:unset)
@siprec
end

##
# Access the streams
# @return [StreamList]
# @return [StreamContext] if sid was passed.
def streams(sid=:unset)
raise ArgumentError, 'sid cannot be nil' if sid.nil?

if sid != :unset
return StreamContext.new(@version, @solution[:account_sid], @solution[:sid], sid, )
end

unless @streams
@streams = StreamList.new(@version, account_sid: @solution[:account_sid], call_sid: @solution[:sid], )
end

@streams
end

##
# Provide a user friendly representation
def to_s
Expand Down Expand Up @@ -958,6 +977,13 @@ def siprec
context.siprec
end

##
# Access the streams
# @return [streams] streams
def streams
context.streams
end

##
# Provide a user friendly representation
def to_s
Expand Down
4 changes: 2 additions & 2 deletions lib/twilio-ruby/rest/api/v2010/account/call/payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def initialize(version, account_sid: nil, call_sid: nil)
# @param [String] min_postal_code_length A positive integer that is used to
# validate the length of the `PostalCode` inputted by the user. User must enter
# this many digits.
# @param [Hash] parameter A single level JSON string that is required when
# accepting certain information specific only to ACH payments. The information
# @param [Hash] parameter A single-level JSON object used to pass custom
# parameters to payment processors. (Required for ACH payments). The information
# that has to be included here depends on the <Pay> Connector. {Read
# more}[https://www.twilio.com/console/voice/pay-connectors].
# @param [String] payment_connector This is the unique name corresponding to the
Expand Down
7 changes: 7 additions & 0 deletions lib/twilio-ruby/rest/api/v2010/account/call/siprec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ def initialize(version, payload, account_sid: nil, call_sid: nil, sid: nil)
'name' => payload['name'],
'status' => payload['status'],
'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
'uri' => payload['uri'],
}

# Context
Expand Down Expand Up @@ -637,6 +638,12 @@ def date_updated
@properties['date_updated']
end

##
# @return [String] The URI of the resource, relative to `https://api.twilio.com`
def uri
@properties['uri']
end

##
# Update the SiprecInstance
# @param [siprec.UpdateStatus] status The status. Must have the value `stopped`
Expand Down
Loading

0 comments on commit 299bb1c

Please sign in to comment.