twilio-ruby 5.40.2 → 5.40.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +15 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/framework/version.rb +2 -1
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb +12 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/machine_to_machine.rb +12 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/mobile.rb +12 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/national.rb +12 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/shared_cost.rb +12 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/toll_free.rb +12 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/voip.rb +12 -3
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +2 -1
- data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +8 -2
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +5 -2
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +8 -1
- data/lib/twilio-ruby/rest/api/v2010/account/message/feedback.rb +3 -1
- data/lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb +2 -1
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb +8 -4
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb +11 -4
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb +13 -6
- data/lib/twilio-ruby/rest/conversations.rb +0 -16
- data/lib/twilio-ruby/rest/conversations/v1.rb +0 -24
- data/lib/twilio-ruby/rest/conversations/v1/configuration.rb +17 -7
- data/lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb +262 -0
- data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +6 -6
- data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +13 -10
- data/lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb +22 -16
- data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +42 -36
- data/lib/twilio-ruby/rest/conversations/v1/conversation/webhook.rb +14 -11
- data/lib/twilio-ruby/rest/conversations/v1/credential.rb +1 -1
- data/lib/twilio-ruby/rest/conversations/v1/role.rb +4 -2
- data/lib/twilio-ruby/rest/conversations/v1/service.rb +1 -1
- data/lib/twilio-ruby/rest/conversations/v1/service/binding.rb +28 -25
- data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +30 -18
- data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +315 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +10 -10
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +23 -20
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb +32 -26
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb +52 -46
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb +24 -21
- data/lib/twilio-ruby/rest/conversations/v1/service/role.rb +13 -11
- data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +23 -23
- data/lib/twilio-ruby/rest/conversations/v1/user.rb +14 -14
- data/lib/twilio-ruby/rest/events.rb +10 -1
- data/lib/twilio-ruby/rest/events/v1.rb +17 -1
- data/lib/twilio-ruby/rest/events/v1/event_type.rb +8 -8
- data/lib/twilio-ruby/rest/events/v1/schema.rb +226 -0
- data/lib/twilio-ruby/rest/events/v1/schema/schema_version.rb +290 -0
- data/lib/twilio-ruby/rest/events/v1/subscription.rb +28 -8
- data/lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb +3 -109
- data/lib/twilio-ruby/rest/fax/v1/fax.rb +2 -1
- data/lib/twilio-ruby/rest/messaging/v1/service.rb +6 -3
- data/lib/twilio-ruby/rest/notify/v1/credential.rb +12 -6
- data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +10 -2
- data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +10 -5
- data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.rb +6 -3
- data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights.rb +1 -4
- data/lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb +3 -1
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +6 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +1 -4
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +6 -2
- data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +19 -26
- data/lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb +2 -1
- data/lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb +2 -1
- data/lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb +201 -0
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +3 -1
- data/lib/twilio-ruby/rest/video/v1/composition.rb +7 -3
- data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +18 -9
- data/lib/twilio-ruby/rest/video/v1/room.rb +2 -1
- data/lib/twilio-ruby/rest/voice/v1/dialing_permissions.rb +1 -4
- data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +2 -1
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/framework/version_spec.rb +11 -0
- data/spec/integration/conversations/v1/{webhook_spec.rb → configuration/webhook_spec.rb} +12 -8
- data/spec/integration/conversations/v1/configuration_spec.rb +4 -2
- data/spec/integration/conversations/v1/{notification_spec.rb → service/configuration/notification_spec.rb} +12 -4
- data/spec/integration/events/v1/schema/schema_version_spec.rb +126 -0
- data/spec/integration/events/v1/schema_spec.rb +46 -0
- data/spec/integration/events/v1/subscription/subscribed_event_spec.rb +0 -121
- data/spec/integration/events/v1/subscription_spec.rb +38 -0
- data/spec/integration/trunking/v1/trunk/recording_spec.rb +79 -0
- metadata +17 -8
- data/lib/twilio-ruby/rest/conversations/v1/notification.rb +0 -310
- data/lib/twilio-ruby/rest/conversations/v1/webhook.rb +0 -262
@@ -34,7 +34,9 @@ module Twilio
|
|
34
34
|
# Unlike stream(), this operation is eager and will load `limit` records into
|
35
35
|
# memory before returning.
|
36
36
|
# @param [String] language The [ISO
|
37
|
-
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
37
|
+
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
38
|
+
# string that specifies the language used by the Query resources to read. For
|
39
|
+
# example: `en-US`.
|
38
40
|
# @param [String] model_build The SID or unique name of the [Model
|
39
41
|
# Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.
|
40
42
|
# @param [String] status The status of the resources to read. Can be:
|
@@ -64,7 +66,9 @@ module Twilio
|
|
64
66
|
# This operation lazily loads records as efficiently as possible until the limit
|
65
67
|
# is reached.
|
66
68
|
# @param [String] language The [ISO
|
67
|
-
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
69
|
+
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
70
|
+
# string that specifies the language used by the Query resources to read. For
|
71
|
+
# example: `en-US`.
|
68
72
|
# @param [String] model_build The SID or unique name of the [Model
|
69
73
|
# Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.
|
70
74
|
# @param [String] status The status of the resources to read. Can be:
|
@@ -110,7 +114,9 @@ module Twilio
|
|
110
114
|
# Retrieve a single page of QueryInstance records from the API.
|
111
115
|
# Request is executed immediately.
|
112
116
|
# @param [String] language The [ISO
|
113
|
-
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
117
|
+
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
118
|
+
# string that specifies the language used by the Query resources to read. For
|
119
|
+
# example: `en-US`.
|
114
120
|
# @param [String] model_build The SID or unique name of the [Model
|
115
121
|
# Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.
|
116
122
|
# @param [String] status The status of the resources to read. Can be:
|
@@ -153,7 +159,8 @@ module Twilio
|
|
153
159
|
##
|
154
160
|
# Create the QueryInstance
|
155
161
|
# @param [String] language The [ISO
|
156
|
-
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
162
|
+
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
163
|
+
# string that specifies the language used for the new query. For example: `en-US`.
|
157
164
|
# @param [String] query The end-user's natural language input. It can be up to
|
158
165
|
# 2048 characters long.
|
159
166
|
# @param [String] tasks The list of tasks to limit the new query to. Tasks are
|
@@ -38,7 +38,8 @@ module Twilio
|
|
38
38
|
# Unlike stream(), this operation is eager and will load `limit` records into
|
39
39
|
# memory before returning.
|
40
40
|
# @param [String] language The [ISO
|
41
|
-
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
41
|
+
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
42
|
+
# string that specifies the language used for the sample. For example: `en-US`.
|
42
43
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
43
44
|
# guarantees to never return more than limit. Default is no limit
|
44
45
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -55,7 +56,8 @@ module Twilio
|
|
55
56
|
# This operation lazily loads records as efficiently as possible until the limit
|
56
57
|
# is reached.
|
57
58
|
# @param [String] language The [ISO
|
58
|
-
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
59
|
+
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
60
|
+
# string that specifies the language used for the sample. For example: `en-US`.
|
59
61
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
60
62
|
# guarantees to never return more than limit. Default is no limit.
|
61
63
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -89,7 +91,8 @@ module Twilio
|
|
89
91
|
# Retrieve a single page of SampleInstance records from the API.
|
90
92
|
# Request is executed immediately.
|
91
93
|
# @param [String] language The [ISO
|
92
|
-
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
94
|
+
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
95
|
+
# string that specifies the language used for the sample. For example: `en-US`.
|
93
96
|
# @param [String] page_token PageToken provided by the API
|
94
97
|
# @param [Integer] page_number Page Number, this value is simply for client state
|
95
98
|
# @param [Integer] page_size Number of records to return, defaults to 50
|
@@ -123,7 +126,9 @@ module Twilio
|
|
123
126
|
##
|
124
127
|
# Create the SampleInstance
|
125
128
|
# @param [String] language The [ISO
|
126
|
-
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
129
|
+
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
130
|
+
# string that specifies the language used for the new sample. For example:
|
131
|
+
# `en-US`.
|
127
132
|
# @param [String] tagged_text The text example of how end users might express the
|
128
133
|
# task. The sample can contain [Field tag
|
129
134
|
# blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging).
|
@@ -232,7 +237,8 @@ module Twilio
|
|
232
237
|
##
|
233
238
|
# Update the SampleInstance
|
234
239
|
# @param [String] language The [ISO
|
235
|
-
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
240
|
+
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
241
|
+
# string that specifies the language used for the sample. For example: `en-US`.
|
236
242
|
# @param [String] tagged_text The text example of how end users might express the
|
237
243
|
# task. The sample can contain [Field tag
|
238
244
|
# blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging).
|
@@ -408,7 +414,8 @@ module Twilio
|
|
408
414
|
##
|
409
415
|
# Update the SampleInstance
|
410
416
|
# @param [String] language The [ISO
|
411
|
-
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
417
|
+
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
418
|
+
# string that specifies the language used for the sample. For example: `en-US`.
|
412
419
|
# @param [String] tagged_text The text example of how end users might express the
|
413
420
|
# task. The sample can contain [Field tag
|
414
421
|
# blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging).
|
@@ -43,12 +43,6 @@ module Twilio
|
|
43
43
|
self.v1.conversations(sid)
|
44
44
|
end
|
45
45
|
|
46
|
-
##
|
47
|
-
# @return [Twilio::REST::Conversations::V1::WebhookInstance]
|
48
|
-
def webhooks
|
49
|
-
self.v1.webhooks()
|
50
|
-
end
|
51
|
-
|
52
46
|
##
|
53
47
|
# @param [String] sid A 34 character string that uniquely identifies this
|
54
48
|
# resource.
|
@@ -76,16 +70,6 @@ module Twilio
|
|
76
70
|
self.v1.services(sid)
|
77
71
|
end
|
78
72
|
|
79
|
-
##
|
80
|
-
# @param [String] chat_service_sid The SID of the [Chat
|
81
|
-
# Service](https://www.twilio.com/docs/chat/rest/service-resource) the
|
82
|
-
# Configuration applies to.
|
83
|
-
# @return [Twilio::REST::Conversations::V1::NotificationInstance] if chat_service_sid was passed.
|
84
|
-
# @return [Twilio::REST::Conversations::V1::NotificationList]
|
85
|
-
def notifications(chat_service_sid=:unset)
|
86
|
-
self.v1.notifications(chat_service_sid)
|
87
|
-
end
|
88
|
-
|
89
73
|
##
|
90
74
|
# @param [String] sid The unique string that we created to identify the User
|
91
75
|
# resource.
|
@@ -17,11 +17,9 @@ module Twilio
|
|
17
17
|
@version = 'v1'
|
18
18
|
@configuration = nil
|
19
19
|
@conversations = nil
|
20
|
-
@webhooks = nil
|
21
20
|
@credentials = nil
|
22
21
|
@roles = nil
|
23
22
|
@services = nil
|
24
|
-
@notifications = nil
|
25
23
|
@users = nil
|
26
24
|
end
|
27
25
|
|
@@ -46,12 +44,6 @@ module Twilio
|
|
46
44
|
end
|
47
45
|
end
|
48
46
|
|
49
|
-
##
|
50
|
-
# @return [Twilio::REST::Conversations::V1::WebhookContext]
|
51
|
-
def webhooks
|
52
|
-
@webhooks ||= WebhookContext.new self
|
53
|
-
end
|
54
|
-
|
55
47
|
##
|
56
48
|
# @param [String] sid A 34 character string that uniquely identifies this
|
57
49
|
# resource.
|
@@ -96,22 +88,6 @@ module Twilio
|
|
96
88
|
end
|
97
89
|
end
|
98
90
|
|
99
|
-
##
|
100
|
-
# @param [String] chat_service_sid The SID of the [Chat
|
101
|
-
# Service](https://www.twilio.com/docs/chat/rest/service-resource) the
|
102
|
-
# Configuration applies to.
|
103
|
-
# @return [Twilio::REST::Conversations::V1::NotificationContext] if chat_service_sid was passed.
|
104
|
-
# @return [Twilio::REST::Conversations::V1::NotificationList]
|
105
|
-
def notifications(chat_service_sid=:unset)
|
106
|
-
if chat_service_sid.nil?
|
107
|
-
raise ArgumentError, 'chat_service_sid cannot be nil'
|
108
|
-
elsif chat_service_sid == :unset
|
109
|
-
@notifications ||= NotificationList.new self
|
110
|
-
else
|
111
|
-
NotificationContext.new(self, chat_service_sid)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
91
|
##
|
116
92
|
# @param [String] sid The SID of the User resource to fetch. This value can be
|
117
93
|
# either the `sid` or the `identity` of the User resource to fetch.
|
@@ -75,6 +75,9 @@ module Twilio
|
|
75
75
|
# Path Solution
|
76
76
|
@solution = {}
|
77
77
|
@uri = "/Configuration"
|
78
|
+
|
79
|
+
# Components
|
80
|
+
@webhooks = nil
|
78
81
|
end
|
79
82
|
|
80
83
|
##
|
@@ -88,9 +91,9 @@ module Twilio
|
|
88
91
|
|
89
92
|
##
|
90
93
|
# Update the ConfigurationInstance
|
91
|
-
# @param [String] default_chat_service_sid The SID of the default [
|
92
|
-
# Service](https://www.twilio.com/docs/
|
93
|
-
# creating a conversation.
|
94
|
+
# @param [String] default_chat_service_sid The SID of the default [Conversation
|
95
|
+
# Service](https://www.twilio.com/docs/conversations/api/service-resource) to use
|
96
|
+
# when creating a conversation.
|
94
97
|
# @param [String] default_messaging_service_sid The SID of the default [Messaging
|
95
98
|
# Service](https://www.twilio.com/docs/sms/services/api) to use when creating a
|
96
99
|
# conversation.
|
@@ -113,6 +116,13 @@ module Twilio
|
|
113
116
|
ConfigurationInstance.new(@version, payload, )
|
114
117
|
end
|
115
118
|
|
119
|
+
##
|
120
|
+
# Access the webhooks
|
121
|
+
# @return [WebhookContext] WebhookContext
|
122
|
+
def webhooks
|
123
|
+
return WebhookContext.new(@version, )
|
124
|
+
end
|
125
|
+
|
116
126
|
##
|
117
127
|
# Provide a user friendly representation
|
118
128
|
def to_s
|
@@ -173,7 +183,7 @@ module Twilio
|
|
173
183
|
end
|
174
184
|
|
175
185
|
##
|
176
|
-
# @return [String] The SID of the default
|
186
|
+
# @return [String] The SID of the default Conversation Service that every new conversation is associated with.
|
177
187
|
def default_chat_service_sid
|
178
188
|
@properties['default_chat_service_sid']
|
179
189
|
end
|
@@ -217,9 +227,9 @@ module Twilio
|
|
217
227
|
|
218
228
|
##
|
219
229
|
# Update the ConfigurationInstance
|
220
|
-
# @param [String] default_chat_service_sid The SID of the default [
|
221
|
-
# Service](https://www.twilio.com/docs/
|
222
|
-
# creating a conversation.
|
230
|
+
# @param [String] default_chat_service_sid The SID of the default [Conversation
|
231
|
+
# Service](https://www.twilio.com/docs/conversations/api/service-resource) to use
|
232
|
+
# when creating a conversation.
|
223
233
|
# @param [String] default_messaging_service_sid The SID of the default [Messaging
|
224
234
|
# Service](https://www.twilio.com/docs/sms/services/api) to use when creating a
|
225
235
|
# conversation.
|
@@ -0,0 +1,262 @@
|
|
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 ConfigurationContext < InstanceContext
|
14
|
+
##
|
15
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
16
|
+
class WebhookList < ListResource
|
17
|
+
##
|
18
|
+
# Initialize the WebhookList
|
19
|
+
# @param [Version] version Version that contains the resource
|
20
|
+
# @return [WebhookList] WebhookList
|
21
|
+
def initialize(version)
|
22
|
+
super(version)
|
23
|
+
|
24
|
+
# Path Solution
|
25
|
+
@solution = {}
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Provide a user friendly representation
|
30
|
+
def to_s
|
31
|
+
'#<Twilio.Conversations.V1.WebhookList>'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
37
|
+
class WebhookPage < Page
|
38
|
+
##
|
39
|
+
# Initialize the WebhookPage
|
40
|
+
# @param [Version] version Version that contains the resource
|
41
|
+
# @param [Response] response Response from the API
|
42
|
+
# @param [Hash] solution Path solution for the resource
|
43
|
+
# @return [WebhookPage] WebhookPage
|
44
|
+
def initialize(version, response, solution)
|
45
|
+
super(version, response)
|
46
|
+
|
47
|
+
# Path Solution
|
48
|
+
@solution = solution
|
49
|
+
end
|
50
|
+
|
51
|
+
##
|
52
|
+
# Build an instance of WebhookInstance
|
53
|
+
# @param [Hash] payload Payload response from the API
|
54
|
+
# @return [WebhookInstance] WebhookInstance
|
55
|
+
def get_instance(payload)
|
56
|
+
WebhookInstance.new(@version, payload, )
|
57
|
+
end
|
58
|
+
|
59
|
+
##
|
60
|
+
# Provide a user friendly representation
|
61
|
+
def to_s
|
62
|
+
'<Twilio.Conversations.V1.WebhookPage>'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
##
|
67
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
68
|
+
class WebhookContext < InstanceContext
|
69
|
+
##
|
70
|
+
# Initialize the WebhookContext
|
71
|
+
# @param [Version] version Version that contains the resource
|
72
|
+
# @return [WebhookContext] WebhookContext
|
73
|
+
def initialize(version)
|
74
|
+
super(version)
|
75
|
+
|
76
|
+
# Path Solution
|
77
|
+
@solution = {}
|
78
|
+
@uri = "/Configuration/Webhooks"
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Fetch the WebhookInstance
|
83
|
+
# @return [WebhookInstance] Fetched WebhookInstance
|
84
|
+
def fetch
|
85
|
+
payload = @version.fetch('GET', @uri)
|
86
|
+
|
87
|
+
WebhookInstance.new(@version, payload, )
|
88
|
+
end
|
89
|
+
|
90
|
+
##
|
91
|
+
# Update the WebhookInstance
|
92
|
+
# @param [String] method The HTTP method to be used when sending a webhook
|
93
|
+
# request.
|
94
|
+
# @param [String] filters The list of webhook event triggers that are enabled for
|
95
|
+
# this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`,
|
96
|
+
# `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`,
|
97
|
+
# `onParticipantUpdated`, `onParticipantRemoved`
|
98
|
+
# @param [String] pre_webhook_url The absolute url the pre-event webhook request
|
99
|
+
# should be sent to.
|
100
|
+
# @param [String] post_webhook_url The absolute url the post-event webhook request
|
101
|
+
# should be sent to.
|
102
|
+
# @param [webhook.Target] target The routing target of the webhook.
|
103
|
+
# @return [WebhookInstance] Updated WebhookInstance
|
104
|
+
def update(method: :unset, filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, target: :unset)
|
105
|
+
data = Twilio::Values.of({
|
106
|
+
'Method' => method,
|
107
|
+
'Filters' => Twilio.serialize_list(filters) { |e| e },
|
108
|
+
'PreWebhookUrl' => pre_webhook_url,
|
109
|
+
'PostWebhookUrl' => post_webhook_url,
|
110
|
+
'Target' => target,
|
111
|
+
})
|
112
|
+
|
113
|
+
payload = @version.update('POST', @uri, data: data)
|
114
|
+
|
115
|
+
WebhookInstance.new(@version, payload, )
|
116
|
+
end
|
117
|
+
|
118
|
+
##
|
119
|
+
# Provide a user friendly representation
|
120
|
+
def to_s
|
121
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
122
|
+
"#<Twilio.Conversations.V1.WebhookContext #{context}>"
|
123
|
+
end
|
124
|
+
|
125
|
+
##
|
126
|
+
# Provide a detailed, user friendly representation
|
127
|
+
def inspect
|
128
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
129
|
+
"#<Twilio.Conversations.V1.WebhookContext #{context}>"
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
##
|
134
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
135
|
+
class WebhookInstance < InstanceResource
|
136
|
+
##
|
137
|
+
# Initialize the WebhookInstance
|
138
|
+
# @param [Version] version Version that contains the resource
|
139
|
+
# @param [Hash] payload payload that contains response from Twilio
|
140
|
+
# @return [WebhookInstance] WebhookInstance
|
141
|
+
def initialize(version, payload)
|
142
|
+
super(version)
|
143
|
+
|
144
|
+
# Marshaled Properties
|
145
|
+
@properties = {
|
146
|
+
'account_sid' => payload['account_sid'],
|
147
|
+
'method' => payload['method'],
|
148
|
+
'filters' => payload['filters'],
|
149
|
+
'pre_webhook_url' => payload['pre_webhook_url'],
|
150
|
+
'post_webhook_url' => payload['post_webhook_url'],
|
151
|
+
'target' => payload['target'],
|
152
|
+
'url' => payload['url'],
|
153
|
+
}
|
154
|
+
|
155
|
+
# Context
|
156
|
+
@instance_context = nil
|
157
|
+
@params = {}
|
158
|
+
end
|
159
|
+
|
160
|
+
##
|
161
|
+
# Generate an instance context for the instance, the context is capable of
|
162
|
+
# performing various actions. All instance actions are proxied to the context
|
163
|
+
# @return [WebhookContext] WebhookContext for this WebhookInstance
|
164
|
+
def context
|
165
|
+
unless @instance_context
|
166
|
+
@instance_context = WebhookContext.new(@version, )
|
167
|
+
end
|
168
|
+
@instance_context
|
169
|
+
end
|
170
|
+
|
171
|
+
##
|
172
|
+
# @return [String] The unique ID of the Account responsible for this conversation.
|
173
|
+
def account_sid
|
174
|
+
@properties['account_sid']
|
175
|
+
end
|
176
|
+
|
177
|
+
##
|
178
|
+
# @return [webhook.Method] The HTTP method to be used when sending a webhook request.
|
179
|
+
def method
|
180
|
+
@properties['method']
|
181
|
+
end
|
182
|
+
|
183
|
+
##
|
184
|
+
# @return [String] The list of webhook event triggers that are enabled for this Service.
|
185
|
+
def filters
|
186
|
+
@properties['filters']
|
187
|
+
end
|
188
|
+
|
189
|
+
##
|
190
|
+
# @return [String] The absolute url the pre-event webhook request should be sent to.
|
191
|
+
def pre_webhook_url
|
192
|
+
@properties['pre_webhook_url']
|
193
|
+
end
|
194
|
+
|
195
|
+
##
|
196
|
+
# @return [String] The absolute url the post-event webhook request should be sent to.
|
197
|
+
def post_webhook_url
|
198
|
+
@properties['post_webhook_url']
|
199
|
+
end
|
200
|
+
|
201
|
+
##
|
202
|
+
# @return [webhook.Target] The routing target of the webhook.
|
203
|
+
def target
|
204
|
+
@properties['target']
|
205
|
+
end
|
206
|
+
|
207
|
+
##
|
208
|
+
# @return [String] An absolute URL for this webhook.
|
209
|
+
def url
|
210
|
+
@properties['url']
|
211
|
+
end
|
212
|
+
|
213
|
+
##
|
214
|
+
# Fetch the WebhookInstance
|
215
|
+
# @return [WebhookInstance] Fetched WebhookInstance
|
216
|
+
def fetch
|
217
|
+
context.fetch
|
218
|
+
end
|
219
|
+
|
220
|
+
##
|
221
|
+
# Update the WebhookInstance
|
222
|
+
# @param [String] method The HTTP method to be used when sending a webhook
|
223
|
+
# request.
|
224
|
+
# @param [String] filters The list of webhook event triggers that are enabled for
|
225
|
+
# this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`,
|
226
|
+
# `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`,
|
227
|
+
# `onParticipantUpdated`, `onParticipantRemoved`
|
228
|
+
# @param [String] pre_webhook_url The absolute url the pre-event webhook request
|
229
|
+
# should be sent to.
|
230
|
+
# @param [String] post_webhook_url The absolute url the post-event webhook request
|
231
|
+
# should be sent to.
|
232
|
+
# @param [webhook.Target] target The routing target of the webhook.
|
233
|
+
# @return [WebhookInstance] Updated WebhookInstance
|
234
|
+
def update(method: :unset, filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, target: :unset)
|
235
|
+
context.update(
|
236
|
+
method: method,
|
237
|
+
filters: filters,
|
238
|
+
pre_webhook_url: pre_webhook_url,
|
239
|
+
post_webhook_url: post_webhook_url,
|
240
|
+
target: target,
|
241
|
+
)
|
242
|
+
end
|
243
|
+
|
244
|
+
##
|
245
|
+
# Provide a user friendly representation
|
246
|
+
def to_s
|
247
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
248
|
+
"<Twilio.Conversations.V1.WebhookInstance #{values}>"
|
249
|
+
end
|
250
|
+
|
251
|
+
##
|
252
|
+
# Provide a detailed, user friendly representation
|
253
|
+
def inspect
|
254
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
255
|
+
"<Twilio.Conversations.V1.WebhookInstance #{values}>"
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|