twilio-ruby 5.60.0 → 5.62.0
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 +5 -5
- data/.github/workflows/test-and-deploy.yml +95 -0
- data/.gitignore +3 -1
- data/.rubocop.yml +1 -1
- data/CHANGES.md +98 -0
- data/Makefile +3 -4
- 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 +5 -1
- 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 +15 -2
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration/brand_vetting.rb +84 -3
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +9 -3
- 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/taskrouter/v1/workspace.rb +8 -2
- data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +8 -2
- data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +16 -6
- data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +5 -5
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +9 -1
- data/lib/twilio-ruby/rest/verify/v2/service.rb +22 -3
- 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/rate_plan.rb +3 -3
- data/lib/twilio-ruby/rest/wireless/v1/sim.rb +16 -26
- data/lib/twilio-ruby/twiml/voice_response.rb +613 -36
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +9 -4
- data/.travis.yml +0 -57
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4de9f3e13c7d62d46dd01dc76c29a0053d5aebc2
|
4
|
+
data.tar.gz: 840453ea3047e82252cff8e7a2938ff6a1ee3de7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e130c8595f487439b3a2791ba660dbe198661cada16c0c5bb088b12b8b6ba714fb3245841ce55a1c1c0837ec2830a6988ec4d3fea11cf3d945e655f935658a6
|
7
|
+
data.tar.gz: 0e49320acd4390848bc5946626f8e999f9fdc2bfaef36efb6f027292cf3895ae295c473b4376ee4b44fc0a71a556fb47343adfba3370e17b36f078a308240be5
|
@@ -0,0 +1,95 @@
|
|
1
|
+
name: Test and Deploy
|
2
|
+
on:
|
3
|
+
push:
|
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'
|
11
|
+
workflow_dispatch:
|
12
|
+
|
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
|
+
|
37
|
+
deploy:
|
38
|
+
name: Deploy
|
39
|
+
if: success() && github.ref_type == 'tag'
|
40
|
+
needs: [ test ]
|
41
|
+
runs-on: ubuntu-latest
|
42
|
+
steps:
|
43
|
+
- name: Checkout twilio-ruby
|
44
|
+
uses: actions/checkout@v2
|
45
|
+
with:
|
46
|
+
fetch-depth: 0
|
47
|
+
|
48
|
+
- name: Login to Docker Hub
|
49
|
+
uses: docker/login-action@v1
|
50
|
+
with:
|
51
|
+
username: ${{ secrets.DOCKER_USERNAME }}
|
52
|
+
password: ${{ secrets.DOCKER_AUTH_TOKEN }}
|
53
|
+
|
54
|
+
# The expression strips off the shortest match from the front of the string to yield just the tag name as the output
|
55
|
+
- name: Get tagged version
|
56
|
+
run: echo "GITHUB_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
57
|
+
|
58
|
+
- name: Build and Push image
|
59
|
+
run: make docker-build && make docker-push
|
60
|
+
|
61
|
+
- name: Set up Ruby
|
62
|
+
uses: ruby/setup-ruby@v1
|
63
|
+
with:
|
64
|
+
ruby-version: 2.4
|
65
|
+
bundler-cache: true
|
66
|
+
|
67
|
+
- run: bundle install
|
68
|
+
- name: Publish to Rubygems
|
69
|
+
env:
|
70
|
+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
|
71
|
+
run: |
|
72
|
+
mkdir -p $HOME/.gem
|
73
|
+
touch $HOME/.gem/credentials
|
74
|
+
chmod 0600 $HOME/.gem/credentials
|
75
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
76
|
+
gem build *.gemspec
|
77
|
+
gem push *.gem
|
78
|
+
|
79
|
+
notify-on-failure:
|
80
|
+
name: Slack notify on failure
|
81
|
+
if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
|
82
|
+
needs: [ test, deploy ]
|
83
|
+
runs-on: ubuntu-latest
|
84
|
+
steps:
|
85
|
+
- uses: rtCamp/action-slack-notify@v2
|
86
|
+
env:
|
87
|
+
SLACK_COLOR: failure
|
88
|
+
SLACK_ICON_EMOJI: ':github:'
|
89
|
+
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) }}
|
90
|
+
SLACK_TITLE: Action Failure - ${{ github.repository }}
|
91
|
+
SLACK_USERNAME: GitHub Actions
|
92
|
+
SLACK_MSG_AUTHOR: twilio-dx
|
93
|
+
SLACK_FOOTER: Posted automatically using GitHub Actions
|
94
|
+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
95
|
+
MSG_MINIMAL: true
|
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
|
+
[2021-12-15] Version 5.62.0
|
5
|
+
---------------------------
|
6
|
+
**Library - Feature**
|
7
|
+
- [PR #581](https://github.com/twilio/twilio-ruby/pull/581): run tests before deploying. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
|
8
|
+
|
9
|
+
**Api**
|
10
|
+
- Add optional boolean send_as_mms parameter to the create action of Message resource **(breaking change)**
|
11
|
+
- Change team ownership for `call` delete
|
12
|
+
|
13
|
+
**Conversations**
|
14
|
+
- Change wording for `Service Webhook Configuration` resource fields
|
15
|
+
|
16
|
+
**Insights**
|
17
|
+
- Added new APIs for updating and getting voice insights flags by accountSid.
|
18
|
+
|
19
|
+
**Media**
|
20
|
+
- Add max_duration param to MediaProcessor
|
21
|
+
|
22
|
+
**Video**
|
23
|
+
- Add `EmptyRoomTimeout` and `UnusedRoomTimeout` properties to a room; add corresponding parameters to room creation
|
24
|
+
|
25
|
+
**Voice**
|
26
|
+
- Add endpoint to delete archived Calls
|
27
|
+
|
28
|
+
|
29
|
+
[2021-12-01] Version 5.61.2
|
30
|
+
---------------------------
|
31
|
+
**Library - Chore**
|
32
|
+
- [PR #579](https://github.com/twilio/twilio-ruby/pull/579): make ruby-head test optional. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
|
33
|
+
|
34
|
+
**Conversations**
|
35
|
+
- Add `Service Webhook Configuration` resource
|
36
|
+
|
37
|
+
**Flex**
|
38
|
+
- Adding `flex_insights_drilldown` and `flex_url` objects to Flex Configuration
|
39
|
+
|
40
|
+
**Messaging**
|
41
|
+
- Update us_app_to_person endpoints to remove beta feature flag based access
|
42
|
+
|
43
|
+
**Supersim**
|
44
|
+
- Add IP Commands resource
|
45
|
+
|
46
|
+
**Verify**
|
47
|
+
- Add optional `factor_friendly_name` parameter to the create access token endpoint.
|
48
|
+
|
49
|
+
**Video**
|
50
|
+
- Add maxParticipantDuration param to Rooms
|
51
|
+
|
52
|
+
**Twiml**
|
53
|
+
- Unrevert Add supported SSML children to `<emphasis>`, `<lang>`, `<p>`, `<prosody>`, `<s>`, and `<w>`.
|
54
|
+
- Revert Add supported SSML children to `<emphasis>`, `<lang>`, `<p>`, `<prosody>`, `<s>`, and `<w>`.
|
55
|
+
|
56
|
+
|
57
|
+
[2021-11-17] Version 5.61.1
|
58
|
+
---------------------------
|
59
|
+
**Library - Chore**
|
60
|
+
- [PR #578](https://github.com/twilio/twilio-ruby/pull/578): remove yardoc files. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
|
61
|
+
|
62
|
+
**Library - Fix**
|
63
|
+
- [PR #576](https://github.com/twilio/twilio-ruby/pull/576): git log retrieval issues. Thanks to [@shwetha-manvinkurke](https://github.com/shwetha-manvinkurke)!
|
64
|
+
|
65
|
+
**Frontline**
|
66
|
+
- Added `is_available` to User's resource
|
67
|
+
|
68
|
+
**Messaging**
|
69
|
+
- Added GET vetting API
|
70
|
+
|
71
|
+
**Verify**
|
72
|
+
- Add `WHATSAPP` to the attempts API.
|
73
|
+
- Allow to update `config.notification_platform` from `none` to `apn` or `fcm` and viceversa for Verify Push
|
74
|
+
- Add `none` as a valid `config.notification_platform` value for Verify Push
|
75
|
+
|
76
|
+
**Twiml**
|
77
|
+
- Add supported SSML children to `<emphasis>`, `<lang>`, `<p>`, `<prosody>`, `<s>`, and `<w>`.
|
78
|
+
|
79
|
+
|
80
|
+
[2021-11-03] Version 5.61.0
|
81
|
+
---------------------------
|
82
|
+
**Library - Chore**
|
83
|
+
- [PR #575](https://github.com/twilio/twilio-ruby/pull/575): migrate from TravisCI to GitHub Actions. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
|
84
|
+
|
85
|
+
**Api**
|
86
|
+
- Updated `media_url` property to be treated as PII
|
87
|
+
|
88
|
+
**Messaging**
|
89
|
+
- Added a new enum for brand registration status named DELETED **(breaking change)**
|
90
|
+
- Add a new K12_EDUCATION use case in us_app_to_person_usecase api transaction
|
91
|
+
- Added a new enum for brand registration status named IN_REVIEW
|
92
|
+
|
93
|
+
**Serverless**
|
94
|
+
- Add node14 as a valid Build runtime
|
95
|
+
|
96
|
+
**Verify**
|
97
|
+
- Fix typos in Verify Push Factor documentation for the `config.notification_token` parameter.
|
98
|
+
- Added `TemplateCustomSubstitutions` on verification creation
|
99
|
+
- Make `TemplateSid` parameter public for Verification resource and `DefaultTemplateSid` parameter public for Service resource. **(breaking change)**
|
100
|
+
|
101
|
+
|
4
102
|
[2021-10-18] Version 5.60.0
|
5
103
|
---------------------------
|
6
104
|
**Library - Feature**
|
data/Makefile
CHANGED
@@ -10,7 +10,7 @@ test: lint
|
|
10
10
|
bundle exec rake spec
|
11
11
|
|
12
12
|
lint:
|
13
|
-
rubocop --cache true --parallel
|
13
|
+
bundle exec rubocop -d --cache true --parallel
|
14
14
|
|
15
15
|
docs:
|
16
16
|
yard doc --output-dir ./doc
|
@@ -22,12 +22,11 @@ authors:
|
|
22
22
|
API_DEFINITIONS_SHA=$(shell git log --oneline | grep Regenerated | head -n1 | cut -d ' ' -f 5)
|
23
23
|
docker-build:
|
24
24
|
docker build -t twilio/twilio-ruby .
|
25
|
-
docker tag twilio/twilio-ruby twilio/twilio-ruby:${
|
25
|
+
docker tag twilio/twilio-ruby twilio/twilio-ruby:${GITHUB_TAG}
|
26
26
|
docker tag twilio/twilio-ruby twilio/twilio-ruby:apidefs-${API_DEFINITIONS_SHA}
|
27
27
|
docker tag twilio/twilio-ruby twilio/twilio-ruby:latest
|
28
28
|
|
29
29
|
docker-push:
|
30
|
-
|
31
|
-
docker push twilio/twilio-ruby:${TRAVIS_TAG}
|
30
|
+
docker push twilio/twilio-ruby:${GITHUB_TAG}
|
32
31
|
docker push twilio/twilio-ruby:apidefs-${API_DEFINITIONS_SHA}
|
33
32
|
docker push twilio/twilio-ruby:latest
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# twilio-ruby
|
2
2
|
|
3
|
-
[][github-actions]
|
4
4
|
[](https://rubygems.org/gems/twilio-ruby)
|
5
5
|
[](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.62.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.62.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
|
-
[
|
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,9 @@ 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 [Boolean] send_as_mms If set to True, Twilio will deliver the message as
|
82
|
+
# a single MMS message, regardless of the presence of media. This is a Beta
|
83
|
+
# Feature.
|
81
84
|
# @param [String] from A Twilio phone number in
|
82
85
|
# {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, an {alphanumeric
|
83
86
|
# sender
|
@@ -108,7 +111,7 @@ module Twilio
|
|
108
111
|
# parameters in the POST request. You can include up to 10 `media_url` parameters
|
109
112
|
# per message. You can send images in an SMS message in only the US and Canada.
|
110
113
|
# @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)
|
114
|
+
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, send_as_mms: :unset, from: :unset, messaging_service_sid: :unset, body: :unset, media_url: :unset)
|
112
115
|
data = Twilio::Values.of({
|
113
116
|
'To' => to,
|
114
117
|
'From' => from,
|
@@ -126,6 +129,7 @@ module Twilio
|
|
126
129
|
'AddressRetention' => address_retention,
|
127
130
|
'SmartEncoded' => smart_encoded,
|
128
131
|
'PersistentAction' => Twilio.serialize_list(persistent_action) { |e| e },
|
132
|
+
'SendAsMms' => send_as_mms,
|
129
133
|
})
|
130
134
|
|
131
135
|
payload = @version.create('POST', @uri, data: data)
|
@@ -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
|
@@ -168,6 +168,8 @@ module Twilio
|
|
168
168
|
'markdown' => payload['markdown'],
|
169
169
|
'url' => payload['url'],
|
170
170
|
'flex_insights_hr' => payload['flex_insights_hr'],
|
171
|
+
'flex_insights_drilldown' => payload['flex_insights_drilldown'],
|
172
|
+
'flex_url' => payload['flex_url'],
|
171
173
|
}
|
172
174
|
|
173
175
|
# Context
|
@@ -426,6 +428,18 @@ module Twilio
|
|
426
428
|
@properties['flex_insights_hr']
|
427
429
|
end
|
428
430
|
|
431
|
+
##
|
432
|
+
# @return [Boolean] Setting to enable Flex UI redirection
|
433
|
+
def flex_insights_drilldown
|
434
|
+
@properties['flex_insights_drilldown']
|
435
|
+
end
|
436
|
+
|
437
|
+
##
|
438
|
+
# @return [String] URL to redirect to in case drilldown is enabled.
|
439
|
+
def flex_url
|
440
|
+
@properties['flex_url']
|
441
|
+
end
|
442
|
+
|
429
443
|
##
|
430
444
|
# Fetch the ConfigurationInstance
|
431
445
|
# @param [String] ui_version The Pinned UI version of the Configuration resource
|