twilio-ruby 5.61.0 → 5.63.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/{deploy.yml → test-and-deploy.yml} +55 -18
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/CHANGES.md +98 -0
- data/Makefile +3 -3
- data/README.md +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +3 -3
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +19 -5
- data/lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb +269 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +8 -0
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +14 -0
- data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +31 -6
- data/lib/twilio-ruby/rest/insights/v1/setting.rb +215 -0
- data/lib/twilio-ruby/rest/insights/v1.rb +7 -0
- data/lib/twilio-ruby/rest/insights.rb +6 -0
- data/lib/twilio-ruby/rest/media/v1/media_processor.rb +14 -1
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration/brand_vetting.rb +84 -3
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +24 -2
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb +80 -0
- data/lib/twilio-ruby/rest/supersim/v1/ip_command.rb +416 -0
- data/lib/twilio-ruby/rest/supersim/v1.rb +16 -0
- data/lib/twilio-ruby/rest/supersim.rb +9 -0
- data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +8 -2
- data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +12 -2
- data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +2 -2
- data/lib/twilio-ruby/rest/video/v1/composition.rb +7 -0
- data/lib/twilio-ruby/rest/video/v1/recording.rb +7 -0
- data/lib/twilio-ruby/rest/video/v1/room/recording.rb +7 -0
- data/lib/twilio-ruby/rest/video/v1/room.rb +34 -1
- data/lib/twilio-ruby/rest/voice/v1/archived_call.rb +184 -0
- data/lib/twilio-ruby/rest/voice/v1.rb +21 -0
- data/lib/twilio-ruby/rest/voice.rb +8 -0
- data/lib/twilio-ruby/rest/wireless/v1/sim.rb +4 -4
- data/lib/twilio-ruby/twiml/voice_response.rb +613 -36
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +7 -9
- data/.github/workflows/test.yml +0 -51
- data/.yardoc/checksums +0 -532
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 582f6e6561bd6ee40a9aadaefc0e2550df5d565f
|
4
|
+
data.tar.gz: 8ec0f4c692bd66e1da3a7ea99d58f4ddaa8b6d0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5864ca88585ee5e2f4952218d1c85180caac3e0b0c4361836e8cc850c2e1fc716f20d0fcd931df29e03e05e54ad4c5bb9c93d46eda5e6e94f8d3aee5a6aa0e64
|
7
|
+
data.tar.gz: 26560b4c09aa1161baac7ba7ac3c83bebe154b4a923e71e550e03742614c1d51e4ef086b747e83645c27f2092eb05a8c811f23f0f7636f0b8f6e191407513fa0
|
@@ -1,17 +1,57 @@
|
|
1
|
-
name: Deploy
|
1
|
+
name: Test and Deploy
|
2
2
|
on:
|
3
3
|
push:
|
4
|
-
|
5
|
-
|
4
|
+
branches: [ '*' ]
|
5
|
+
tags: [ '*' ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ main ]
|
8
|
+
schedule:
|
9
|
+
# Run automatically at 8AM PST Monday-Friday
|
10
|
+
- cron: '0 15 * * 1-5'
|
6
11
|
workflow_dispatch:
|
7
12
|
|
8
13
|
jobs:
|
14
|
+
test:
|
15
|
+
name: Test
|
16
|
+
runs-on: ubuntu-latest
|
17
|
+
timeout-minutes: 20
|
18
|
+
strategy:
|
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' }}
|
22
|
+
steps:
|
23
|
+
- name: Checkout twilio-ruby
|
24
|
+
uses: actions/checkout@v2
|
25
|
+
|
26
|
+
- name: Set up Ruby
|
27
|
+
uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{ matrix.ruby }}
|
30
|
+
bundler-cache: true
|
31
|
+
|
32
|
+
- run: bundle install --with development
|
33
|
+
- run: bundle exec rake install
|
34
|
+
- name: Run Unit Tests
|
35
|
+
run: make test
|
36
|
+
|
9
37
|
deploy:
|
10
|
-
name: Deploy
|
38
|
+
name: Deploy
|
39
|
+
if: success() && github.ref_type == 'tag'
|
40
|
+
needs: [ test ]
|
11
41
|
runs-on: ubuntu-latest
|
12
42
|
steps:
|
13
43
|
- name: Checkout twilio-ruby
|
14
44
|
uses: actions/checkout@v2
|
45
|
+
with:
|
46
|
+
fetch-depth: 0
|
47
|
+
|
48
|
+
- name: Set up Ruby
|
49
|
+
uses: ruby/setup-ruby@v1
|
50
|
+
with:
|
51
|
+
ruby-version: 2.4
|
52
|
+
bundler-cache: true
|
53
|
+
|
54
|
+
- run: bundle install
|
15
55
|
|
16
56
|
- name: Login to Docker Hub
|
17
57
|
uses: docker/login-action@v1
|
@@ -23,20 +63,17 @@ jobs:
|
|
23
63
|
- name: Get tagged version
|
24
64
|
run: echo "GITHUB_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
25
65
|
|
66
|
+
- name: Create GitHub Release
|
67
|
+
uses: sendgrid/dx-automator/actions/release@main
|
68
|
+
env:
|
69
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
70
|
+
|
26
71
|
- name: Build and Push image
|
27
72
|
run: make docker-build && make docker-push
|
28
|
-
|
29
|
-
- name: Set up Ruby
|
30
|
-
uses: ruby/setup-ruby@v1
|
31
|
-
with:
|
32
|
-
ruby-version: 2.4
|
33
|
-
bundler-cache: true
|
34
|
-
|
35
|
-
- run: bundle install
|
36
73
|
- name: Publish to Rubygems
|
37
74
|
env:
|
38
75
|
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
|
39
|
-
run:
|
76
|
+
run: |
|
40
77
|
mkdir -p $HOME/.gem
|
41
78
|
touch $HOME/.gem/credentials
|
42
79
|
chmod 0600 $HOME/.gem/credentials
|
@@ -46,16 +83,16 @@ jobs:
|
|
46
83
|
|
47
84
|
notify-on-failure:
|
48
85
|
name: Slack notify on failure
|
49
|
-
if:
|
50
|
-
needs: [deploy]
|
86
|
+
if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
|
87
|
+
needs: [ test, deploy ]
|
51
88
|
runs-on: ubuntu-latest
|
52
89
|
steps:
|
53
90
|
- uses: rtCamp/action-slack-notify@v2
|
54
91
|
env:
|
55
|
-
SLACK_COLOR:
|
92
|
+
SLACK_COLOR: failure
|
56
93
|
SLACK_ICON_EMOJI: ':github:'
|
57
|
-
SLACK_MESSAGE: ${{ format('
|
58
|
-
SLACK_TITLE:
|
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) }}
|
95
|
+
SLACK_TITLE: Action Failure - ${{ github.repository }}
|
59
96
|
SLACK_USERNAME: GitHub Actions
|
60
97
|
SLACK_MSG_AUTHOR: twilio-dx
|
61
98
|
SLACK_FOOTER: Posted automatically using GitHub Actions
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGES.md
CHANGED
@@ -1,6 +1,104 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
[2022-01-12] Version 5.63.0
|
5
|
+
---------------------------
|
6
|
+
**Library - Feature**
|
7
|
+
- [PR #586](https://github.com/twilio/twilio-ruby/pull/586): add GitHub release step during deploy. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
|
8
|
+
|
9
|
+
**Library - Chore**
|
10
|
+
- [PR #584](https://github.com/twilio/twilio-ruby/pull/584): run yard in bundle context. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
|
11
|
+
- [PR #583](https://github.com/twilio/twilio-ruby/pull/583): remove githook dependency from make install. Thanks to [@JenniferMah](https://github.com/JenniferMah)!
|
12
|
+
|
13
|
+
**Api**
|
14
|
+
- Make fixed time scheduling parameters public **(breaking change)**
|
15
|
+
|
16
|
+
**Messaging**
|
17
|
+
- Add update brand registration API
|
18
|
+
|
19
|
+
**Numbers**
|
20
|
+
- Add API endpoint for List Bundle Copies resource
|
21
|
+
|
22
|
+
**Video**
|
23
|
+
- Enable external storage for all customers
|
24
|
+
|
25
|
+
|
26
|
+
[2021-12-15] Version 5.62.0
|
27
|
+
---------------------------
|
28
|
+
**Library - Feature**
|
29
|
+
- [PR #581](https://github.com/twilio/twilio-ruby/pull/581): run tests before deploying. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
|
30
|
+
|
31
|
+
**Api**
|
32
|
+
- Add optional boolean send_as_mms parameter to the create action of Message resource **(breaking change)**
|
33
|
+
- Change team ownership for `call` delete
|
34
|
+
|
35
|
+
**Conversations**
|
36
|
+
- Change wording for `Service Webhook Configuration` resource fields
|
37
|
+
|
38
|
+
**Insights**
|
39
|
+
- Added new APIs for updating and getting voice insights flags by accountSid.
|
40
|
+
|
41
|
+
**Media**
|
42
|
+
- Add max_duration param to MediaProcessor
|
43
|
+
|
44
|
+
**Video**
|
45
|
+
- Add `EmptyRoomTimeout` and `UnusedRoomTimeout` properties to a room; add corresponding parameters to room creation
|
46
|
+
|
47
|
+
**Voice**
|
48
|
+
- Add endpoint to delete archived Calls
|
49
|
+
|
50
|
+
|
51
|
+
[2021-12-01] Version 5.61.2
|
52
|
+
---------------------------
|
53
|
+
**Library - Chore**
|
54
|
+
- [PR #579](https://github.com/twilio/twilio-ruby/pull/579): make ruby-head test optional. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
|
55
|
+
|
56
|
+
**Conversations**
|
57
|
+
- Add `Service Webhook Configuration` resource
|
58
|
+
|
59
|
+
**Flex**
|
60
|
+
- Adding `flex_insights_drilldown` and `flex_url` objects to Flex Configuration
|
61
|
+
|
62
|
+
**Messaging**
|
63
|
+
- Update us_app_to_person endpoints to remove beta feature flag based access
|
64
|
+
|
65
|
+
**Supersim**
|
66
|
+
- Add IP Commands resource
|
67
|
+
|
68
|
+
**Verify**
|
69
|
+
- Add optional `factor_friendly_name` parameter to the create access token endpoint.
|
70
|
+
|
71
|
+
**Video**
|
72
|
+
- Add maxParticipantDuration param to Rooms
|
73
|
+
|
74
|
+
**Twiml**
|
75
|
+
- Unrevert Add supported SSML children to `<emphasis>`, `<lang>`, `<p>`, `<prosody>`, `<s>`, and `<w>`.
|
76
|
+
- Revert Add supported SSML children to `<emphasis>`, `<lang>`, `<p>`, `<prosody>`, `<s>`, and `<w>`.
|
77
|
+
|
78
|
+
|
79
|
+
[2021-11-17] Version 5.61.1
|
80
|
+
---------------------------
|
81
|
+
**Library - Chore**
|
82
|
+
- [PR #578](https://github.com/twilio/twilio-ruby/pull/578): remove yardoc files. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
|
83
|
+
|
84
|
+
**Library - Fix**
|
85
|
+
- [PR #576](https://github.com/twilio/twilio-ruby/pull/576): git log retrieval issues. Thanks to [@shwetha-manvinkurke](https://github.com/shwetha-manvinkurke)!
|
86
|
+
|
87
|
+
**Frontline**
|
88
|
+
- Added `is_available` to User's resource
|
89
|
+
|
90
|
+
**Messaging**
|
91
|
+
- Added GET vetting API
|
92
|
+
|
93
|
+
**Verify**
|
94
|
+
- Add `WHATSAPP` to the attempts API.
|
95
|
+
- Allow to update `config.notification_platform` from `none` to `apn` or `fcm` and viceversa for Verify Push
|
96
|
+
- Add `none` as a valid `config.notification_platform` value for Verify Push
|
97
|
+
|
98
|
+
**Twiml**
|
99
|
+
- Add supported SSML children to `<emphasis>`, `<lang>`, `<p>`, `<prosody>`, `<s>`, and `<w>`.
|
100
|
+
|
101
|
+
|
4
102
|
[2021-11-03] Version 5.61.0
|
5
103
|
---------------------------
|
6
104
|
**Library - Chore**
|
data/Makefile
CHANGED
@@ -3,17 +3,17 @@
|
|
3
3
|
githooks:
|
4
4
|
ln -sf ../../githooks/pre-commit .git/hooks/pre-commit
|
5
5
|
|
6
|
-
install:
|
6
|
+
install:
|
7
7
|
bundle install --with development; bundle exec rake install
|
8
8
|
|
9
9
|
test: lint
|
10
10
|
bundle exec rake spec
|
11
11
|
|
12
12
|
lint:
|
13
|
-
bundle exec rubocop --cache true --parallel
|
13
|
+
bundle exec rubocop -d --cache true --parallel
|
14
14
|
|
15
15
|
docs:
|
16
|
-
yard doc --output-dir ./doc
|
16
|
+
bundle exec yard doc --output-dir ./doc
|
17
17
|
|
18
18
|
authors:
|
19
19
|
echo "Authors\n=======\n\nA huge thanks to all of our contributors:\n\n" > AUTHORS.md
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# twilio-ruby
|
2
2
|
|
3
|
-
[![Tests](https://github.com/twilio/twilio-ruby/actions/workflows/test.yml/badge.svg)][github-actions]
|
3
|
+
[![Tests](https://github.com/twilio/twilio-ruby/actions/workflows/test-and-deploy.yml/badge.svg)][github-actions]
|
4
4
|
[![Gem Version](https://img.shields.io/gem/v/twilio-ruby.svg)](https://rubygems.org/gems/twilio-ruby)
|
5
5
|
[![Learn with TwilioQuest](https://img.shields.io/static/v1?label=TwilioQuest&message=Learn%20to%20contribute%21&color=F22F46&labelColor=1f243c&style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAASFBMVEUAAAAZGRkcHBwjIyMoKCgAAABgYGBoaGiAgICMjIyzs7PJycnMzMzNzc3UoBfd3d3m5ubqrhfrMEDu7u739/f4vSb/3AD///9tbdyEAAAABXRSTlMAAAAAAMJrBrEAAAKoSURBVHgB7ZrRcuI6EESdyxXGYoNFvMD//+l2bSszRgyUYpFAsXOeiJGmj4NkuWx1Qeh+Ekl9DgEXOBwOx+Px5xyQhDykfgq4wG63MxxaR4ddIkg6Ul3g84vCIcjPBA5gmUMeXESrlukuoK33+33uID8TWeLAdOWsKpJYzwVMB7bOzYSGOciyUlXSn0/ABXTosJ1M1SbypZ4O4MbZuIDMU02PMbauhhHMHXbmebmALIiEbbbbbUrpF1gwE9kFfRNAJaP+FQEXCCTGyJ4ngDrjOFo3jEL5JdqjF/pueR4cCeCGgAtwmuRS6gDwaRiGvu+DMFwSBLTE3+jF8JyuV1okPZ+AC4hDFhCHyHQjdjPHUKFDlHSJkHQXMB3KpSwXNGJPcwwTdZiXlRN0gSp0zpWxNtM0beYE0nRH6QIbO7rawwXaBYz0j78gxjokDuv12gVeUuBD0MDi0OQCLvDaAho4juP1Q/jkAncXqIcCfd+7gAu4QLMACCLxpRsSuQh0igu0C9Svhi7weAGZg50L3IE3cai4IfkNZAC8dfdhsUD3CgKBVC9JE5ABAFzg4QL/taYPAAWrHdYcgfLaIgAXWJ7OV38n1LEF8tt2TH29E+QAoDoO5Ve/LtCQDmKM9kPbvCEBApK+IXzbcSJ0cIGF6e8gpcRhUDogWZ8JnaWjPXc/fNnBBUKRngiHgTUSivSzDRDgHZQOLvBQgf8rRt+VdBUUhwkU6VpJ+xcOwQUqZr+mR0kvBUgv6cB4+37hQAkXqE8PwGisGhJtN4xAHMzrsgvI7rccXqSvKh6jltGlrOHA3Xk1At3LC4QiPdX9/0ndHpGVvTjR4bZA1ypAKgVcwE5vx74ulwIugDt8e/X7JgfkucBMIAr26ndnB4UCLnDOqvteQsHlgX9N4A+c4cW3DXSPbwAAAABJRU5ErkJggg==)](https://twil.io/learn-open-source)
|
6
6
|
|
@@ -35,13 +35,13 @@ This library supports the following Ruby implementations:
|
|
35
35
|
To install using [Bundler][bundler] grab the latest stable version:
|
36
36
|
|
37
37
|
```ruby
|
38
|
-
gem 'twilio-ruby', '~> 5.
|
38
|
+
gem 'twilio-ruby', '~> 5.63.0'
|
39
39
|
```
|
40
40
|
|
41
41
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
42
42
|
|
43
43
|
```bash
|
44
|
-
gem install twilio-ruby -v 5.
|
44
|
+
gem install twilio-ruby -v 5.63.0
|
45
45
|
```
|
46
46
|
|
47
47
|
To build and install the development branch yourself from the latest source:
|
@@ -257,7 +257,7 @@ If you've instead found a bug in the library or would like new features added, g
|
|
257
257
|
[bundler]: https://bundler.io
|
258
258
|
[rubygems]: https://rubygems.org
|
259
259
|
[gem]: https://rubygems.org/gems/twilio
|
260
|
-
[github-actions]: https://github.com/twilio/twilio-ruby/actions/workflows/test.yml
|
260
|
+
[github-actions]: https://github.com/twilio/twilio-ruby/actions/workflows/test-and-deploy.yml
|
261
261
|
[upgrade]: https://github.com/twilio/twilio-ruby/wiki/Ruby-Version-5.x-Upgrade-Guide
|
262
262
|
[issues]: https://github.com/twilio/twilio-ruby/issues
|
263
263
|
[faraday]: https://github.com/lostisland/faraday
|
@@ -144,9 +144,9 @@ module Twilio
|
|
144
144
|
# Calls Beta)
|
145
145
|
# @param [String] call_token A token string needed to invoke a forwarded call. A
|
146
146
|
# call_token is generated when an incoming call is received on a Twilio number.
|
147
|
-
#
|
148
|
-
#
|
149
|
-
#
|
147
|
+
# Pass an incoming call's call_token value to a forwarded call via the call_token
|
148
|
+
# parameter when creating a new call. A forwarded call should bear the same
|
149
|
+
# CallerID of the original incoming call.
|
150
150
|
# @param [String] recording_track The audio track to record for the call. Can be:
|
151
151
|
# `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the
|
152
152
|
# audio that is received by Twilio. `outbound` records the audio that is generated
|
@@ -78,6 +78,13 @@ module Twilio
|
|
78
78
|
# @param [Boolean] smart_encoded Whether to detect Unicode characters that have a
|
79
79
|
# similar GSM-7 character and replace them. Can be: `true` or `false`.
|
80
80
|
# @param [Array[String]] persistent_action Rich actions for Channels Messages.
|
81
|
+
# @param [message.ScheduleType] schedule_type Indicates your intent to schedule a
|
82
|
+
# message. Pass the value `fixed` to schedule a message at a fixed time.
|
83
|
+
# @param [Time] send_at The time that Twilio will send the message. Must be in ISO
|
84
|
+
# 8601 format.
|
85
|
+
# @param [Boolean] send_as_mms If set to True, Twilio will deliver the message as
|
86
|
+
# a single MMS message, regardless of the presence of media. This is a Beta
|
87
|
+
# Feature.
|
81
88
|
# @param [String] from A Twilio phone number in
|
82
89
|
# {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, an {alphanumeric
|
83
90
|
# sender
|
@@ -108,7 +115,7 @@ module Twilio
|
|
108
115
|
# parameters in the POST request. You can include up to 10 `media_url` parameters
|
109
116
|
# per message. You can send images in an SMS message in only the US and Canada.
|
110
117
|
# @return [MessageInstance] Created MessageInstance
|
111
|
-
def create(to: nil, status_callback: :unset, application_sid: :unset, max_price: :unset, provide_feedback: :unset, attempt: :unset, validity_period: :unset, force_delivery: :unset, content_retention: :unset, address_retention: :unset, smart_encoded: :unset, persistent_action: :unset, from: :unset, messaging_service_sid: :unset, body: :unset, media_url: :unset)
|
118
|
+
def create(to: nil, status_callback: :unset, application_sid: :unset, max_price: :unset, provide_feedback: :unset, attempt: :unset, validity_period: :unset, force_delivery: :unset, content_retention: :unset, address_retention: :unset, smart_encoded: :unset, persistent_action: :unset, schedule_type: :unset, send_at: :unset, send_as_mms: :unset, from: :unset, messaging_service_sid: :unset, body: :unset, media_url: :unset)
|
112
119
|
data = Twilio::Values.of({
|
113
120
|
'To' => to,
|
114
121
|
'From' => from,
|
@@ -126,6 +133,9 @@ module Twilio
|
|
126
133
|
'AddressRetention' => address_retention,
|
127
134
|
'SmartEncoded' => smart_encoded,
|
128
135
|
'PersistentAction' => Twilio.serialize_list(persistent_action) { |e| e },
|
136
|
+
'ScheduleType' => schedule_type,
|
137
|
+
'SendAt' => Twilio.serialize_iso8601_datetime(send_at),
|
138
|
+
'SendAsMms' => send_as_mms,
|
129
139
|
})
|
130
140
|
|
131
141
|
payload = @version.create('POST', @uri, data: data)
|
@@ -329,9 +339,11 @@ module Twilio
|
|
329
339
|
# Update the MessageInstance
|
330
340
|
# @param [String] body The text of the message you want to send. Can be up to
|
331
341
|
# 1,600 characters long.
|
342
|
+
# @param [message.UpdateStatus] status When set as `canceled`, allows a message
|
343
|
+
# cancelation request if a message has not yet been sent.
|
332
344
|
# @return [MessageInstance] Updated MessageInstance
|
333
|
-
def update(body: :unset)
|
334
|
-
data = Twilio::Values.of({'Body' => body, })
|
345
|
+
def update(body: :unset, status: :unset)
|
346
|
+
data = Twilio::Values.of({'Body' => body, 'Status' => status, })
|
335
347
|
|
336
348
|
payload = @version.update('POST', @uri, data: data)
|
337
349
|
|
@@ -579,9 +591,11 @@ module Twilio
|
|
579
591
|
# Update the MessageInstance
|
580
592
|
# @param [String] body The text of the message you want to send. Can be up to
|
581
593
|
# 1,600 characters long.
|
594
|
+
# @param [message.UpdateStatus] status When set as `canceled`, allows a message
|
595
|
+
# cancelation request if a message has not yet been sent.
|
582
596
|
# @return [MessageInstance] Updated MessageInstance
|
583
|
-
def update(body: :unset)
|
584
|
-
context.update(body: body, )
|
597
|
+
def update(body: :unset, status: :unset)
|
598
|
+
context.update(body: body, status: status, )
|
585
599
|
end
|
586
600
|
|
587
601
|
##
|
@@ -0,0 +1,269 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
#
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
module Twilio
|
10
|
+
module REST
|
11
|
+
class Conversations < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class ServiceContext < InstanceContext
|
14
|
+
class ConfigurationContext < InstanceContext
|
15
|
+
class WebhookList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the WebhookList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @param [String] chat_service_sid The unique string that we created to identify
|
20
|
+
# the Service configuration resource.
|
21
|
+
# @return [WebhookList] WebhookList
|
22
|
+
def initialize(version, chat_service_sid: nil)
|
23
|
+
super(version)
|
24
|
+
|
25
|
+
# Path Solution
|
26
|
+
@solution = {chat_service_sid: chat_service_sid}
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# Provide a user friendly representation
|
31
|
+
def to_s
|
32
|
+
'#<Twilio.Conversations.V1.WebhookList>'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class WebhookPage < Page
|
37
|
+
##
|
38
|
+
# Initialize the WebhookPage
|
39
|
+
# @param [Version] version Version that contains the resource
|
40
|
+
# @param [Response] response Response from the API
|
41
|
+
# @param [Hash] solution Path solution for the resource
|
42
|
+
# @return [WebhookPage] WebhookPage
|
43
|
+
def initialize(version, response, solution)
|
44
|
+
super(version, response)
|
45
|
+
|
46
|
+
# Path Solution
|
47
|
+
@solution = solution
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# Build an instance of WebhookInstance
|
52
|
+
# @param [Hash] payload Payload response from the API
|
53
|
+
# @return [WebhookInstance] WebhookInstance
|
54
|
+
def get_instance(payload)
|
55
|
+
WebhookInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# Provide a user friendly representation
|
60
|
+
def to_s
|
61
|
+
'<Twilio.Conversations.V1.WebhookPage>'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
class WebhookContext < InstanceContext
|
66
|
+
##
|
67
|
+
# Initialize the WebhookContext
|
68
|
+
# @param [Version] version Version that contains the resource
|
69
|
+
# @param [String] chat_service_sid The unique ID of the {Conversation
|
70
|
+
# Service}[https://www.twilio.com/docs/conversations/api/service-resource] this
|
71
|
+
# conversation belongs to.
|
72
|
+
# @return [WebhookContext] WebhookContext
|
73
|
+
def initialize(version, chat_service_sid)
|
74
|
+
super(version)
|
75
|
+
|
76
|
+
# Path Solution
|
77
|
+
@solution = {chat_service_sid: chat_service_sid, }
|
78
|
+
@uri = "/Services/#{@solution[:chat_service_sid]}/Configuration/Webhooks"
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Update the WebhookInstance
|
83
|
+
# @param [String] pre_webhook_url The absolute url the pre-event webhook request
|
84
|
+
# should be sent to.
|
85
|
+
# @param [String] post_webhook_url The absolute url the post-event webhook request
|
86
|
+
# should be sent to.
|
87
|
+
# @param [Array[String]] filters The list of events that your configured webhook
|
88
|
+
# targets will receive. Events not configured here will not fire. Possible values
|
89
|
+
# are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`,
|
90
|
+
# `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`,
|
91
|
+
# `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`,
|
92
|
+
# `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`,
|
93
|
+
# `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`,
|
94
|
+
# `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate`
|
95
|
+
# or `onConversationStateUpdated`.
|
96
|
+
# @param [String] method The HTTP method to be used when sending a webhook
|
97
|
+
# request. One of `GET` or `POST`.
|
98
|
+
# @return [WebhookInstance] Updated WebhookInstance
|
99
|
+
def update(pre_webhook_url: :unset, post_webhook_url: :unset, filters: :unset, method: :unset)
|
100
|
+
data = Twilio::Values.of({
|
101
|
+
'PreWebhookUrl' => pre_webhook_url,
|
102
|
+
'PostWebhookUrl' => post_webhook_url,
|
103
|
+
'Filters' => Twilio.serialize_list(filters) { |e| e },
|
104
|
+
'Method' => method,
|
105
|
+
})
|
106
|
+
|
107
|
+
payload = @version.update('POST', @uri, data: data)
|
108
|
+
|
109
|
+
WebhookInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# Fetch the WebhookInstance
|
114
|
+
# @return [WebhookInstance] Fetched WebhookInstance
|
115
|
+
def fetch
|
116
|
+
payload = @version.fetch('GET', @uri)
|
117
|
+
|
118
|
+
WebhookInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
|
119
|
+
end
|
120
|
+
|
121
|
+
##
|
122
|
+
# Provide a user friendly representation
|
123
|
+
def to_s
|
124
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
125
|
+
"#<Twilio.Conversations.V1.WebhookContext #{context}>"
|
126
|
+
end
|
127
|
+
|
128
|
+
##
|
129
|
+
# Provide a detailed, user friendly representation
|
130
|
+
def inspect
|
131
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
132
|
+
"#<Twilio.Conversations.V1.WebhookContext #{context}>"
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
class WebhookInstance < InstanceResource
|
137
|
+
##
|
138
|
+
# Initialize the WebhookInstance
|
139
|
+
# @param [Version] version Version that contains the resource
|
140
|
+
# @param [Hash] payload payload that contains response from Twilio
|
141
|
+
# @param [String] chat_service_sid The unique string that we created to identify
|
142
|
+
# the Service configuration resource.
|
143
|
+
# @return [WebhookInstance] WebhookInstance
|
144
|
+
def initialize(version, payload, chat_service_sid: nil)
|
145
|
+
super(version)
|
146
|
+
|
147
|
+
# Marshaled Properties
|
148
|
+
@properties = {
|
149
|
+
'account_sid' => payload['account_sid'],
|
150
|
+
'chat_service_sid' => payload['chat_service_sid'],
|
151
|
+
'pre_webhook_url' => payload['pre_webhook_url'],
|
152
|
+
'post_webhook_url' => payload['post_webhook_url'],
|
153
|
+
'filters' => payload['filters'],
|
154
|
+
'method' => payload['method'],
|
155
|
+
'url' => payload['url'],
|
156
|
+
}
|
157
|
+
|
158
|
+
# Context
|
159
|
+
@instance_context = nil
|
160
|
+
@params = {'chat_service_sid' => chat_service_sid, }
|
161
|
+
end
|
162
|
+
|
163
|
+
##
|
164
|
+
# Generate an instance context for the instance, the context is capable of
|
165
|
+
# performing various actions. All instance actions are proxied to the context
|
166
|
+
# @return [WebhookContext] WebhookContext for this WebhookInstance
|
167
|
+
def context
|
168
|
+
unless @instance_context
|
169
|
+
@instance_context = WebhookContext.new(@version, @params['chat_service_sid'], )
|
170
|
+
end
|
171
|
+
@instance_context
|
172
|
+
end
|
173
|
+
|
174
|
+
##
|
175
|
+
# @return [String] The unique ID of the Account responsible for this service.
|
176
|
+
def account_sid
|
177
|
+
@properties['account_sid']
|
178
|
+
end
|
179
|
+
|
180
|
+
##
|
181
|
+
# @return [String] The unique ID of the {Conversation Service}[https://www.twilio.com/docs/conversations/api/service-resource] this conversation belongs to.
|
182
|
+
def chat_service_sid
|
183
|
+
@properties['chat_service_sid']
|
184
|
+
end
|
185
|
+
|
186
|
+
##
|
187
|
+
# @return [String] The absolute url the pre-event webhook request should be sent to.
|
188
|
+
def pre_webhook_url
|
189
|
+
@properties['pre_webhook_url']
|
190
|
+
end
|
191
|
+
|
192
|
+
##
|
193
|
+
# @return [String] The absolute url the post-event webhook request should be sent to.
|
194
|
+
def post_webhook_url
|
195
|
+
@properties['post_webhook_url']
|
196
|
+
end
|
197
|
+
|
198
|
+
##
|
199
|
+
# @return [Array[String]] The list of events that your configured webhook targets will receive. Events not configured here will not fire.
|
200
|
+
def filters
|
201
|
+
@properties['filters']
|
202
|
+
end
|
203
|
+
|
204
|
+
##
|
205
|
+
# @return [webhook.Method] The HTTP method to be used when sending a webhook request
|
206
|
+
def method
|
207
|
+
@properties['method']
|
208
|
+
end
|
209
|
+
|
210
|
+
##
|
211
|
+
# @return [String] An absolute URL for this webhook.
|
212
|
+
def url
|
213
|
+
@properties['url']
|
214
|
+
end
|
215
|
+
|
216
|
+
##
|
217
|
+
# Update the WebhookInstance
|
218
|
+
# @param [String] pre_webhook_url The absolute url the pre-event webhook request
|
219
|
+
# should be sent to.
|
220
|
+
# @param [String] post_webhook_url The absolute url the post-event webhook request
|
221
|
+
# should be sent to.
|
222
|
+
# @param [Array[String]] filters The list of events that your configured webhook
|
223
|
+
# targets will receive. Events not configured here will not fire. Possible values
|
224
|
+
# are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`,
|
225
|
+
# `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`,
|
226
|
+
# `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`,
|
227
|
+
# `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`,
|
228
|
+
# `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`,
|
229
|
+
# `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate`
|
230
|
+
# or `onConversationStateUpdated`.
|
231
|
+
# @param [String] method The HTTP method to be used when sending a webhook
|
232
|
+
# request. One of `GET` or `POST`.
|
233
|
+
# @return [WebhookInstance] Updated WebhookInstance
|
234
|
+
def update(pre_webhook_url: :unset, post_webhook_url: :unset, filters: :unset, method: :unset)
|
235
|
+
context.update(
|
236
|
+
pre_webhook_url: pre_webhook_url,
|
237
|
+
post_webhook_url: post_webhook_url,
|
238
|
+
filters: filters,
|
239
|
+
method: method,
|
240
|
+
)
|
241
|
+
end
|
242
|
+
|
243
|
+
##
|
244
|
+
# Fetch the WebhookInstance
|
245
|
+
# @return [WebhookInstance] Fetched WebhookInstance
|
246
|
+
def fetch
|
247
|
+
context.fetch
|
248
|
+
end
|
249
|
+
|
250
|
+
##
|
251
|
+
# Provide a user friendly representation
|
252
|
+
def to_s
|
253
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
254
|
+
"<Twilio.Conversations.V1.WebhookInstance #{values}>"
|
255
|
+
end
|
256
|
+
|
257
|
+
##
|
258
|
+
# Provide a detailed, user friendly representation
|
259
|
+
def inspect
|
260
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
261
|
+
"<Twilio.Conversations.V1.WebhookInstance #{values}>"
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
@@ -77,6 +77,7 @@ module Twilio
|
|
77
77
|
|
78
78
|
# Components
|
79
79
|
@notifications = nil
|
80
|
+
@webhooks = nil
|
80
81
|
end
|
81
82
|
|
82
83
|
##
|
@@ -127,6 +128,13 @@ module Twilio
|
|
127
128
|
return NotificationContext.new(@version, @solution[:chat_service_sid], )
|
128
129
|
end
|
129
130
|
|
131
|
+
##
|
132
|
+
# Access the webhooks
|
133
|
+
# @return [WebhookContext] WebhookContext
|
134
|
+
def webhooks
|
135
|
+
return WebhookContext.new(@version, @solution[:chat_service_sid], )
|
136
|
+
end
|
137
|
+
|
130
138
|
##
|
131
139
|
# Provide a user friendly representation
|
132
140
|
def to_s
|