twilio-ruby 5.40.2 → 5.40.3
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 +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
|
@@ -332,7 +332,7 @@ module Twilio
|
|
|
332
332
|
end
|
|
333
333
|
|
|
334
334
|
##
|
|
335
|
-
# @return [String] The unique
|
|
335
|
+
# @return [String] The unique ID of the Account responsible for this service.
|
|
336
336
|
def account_sid
|
|
337
337
|
@properties['account_sid']
|
|
338
338
|
end
|
|
@@ -17,9 +17,9 @@ module Twilio
|
|
|
17
17
|
##
|
|
18
18
|
# Initialize the BindingList
|
|
19
19
|
# @param [Version] version Version that contains the resource
|
|
20
|
-
# @param [String] chat_service_sid The SID of the [
|
|
21
|
-
# Service](https://www.twilio.com/docs/
|
|
22
|
-
# resource is associated with.
|
|
20
|
+
# @param [String] chat_service_sid The SID of the [Conversation
|
|
21
|
+
# Service](https://www.twilio.com/docs/conversations/api/service-resource) the
|
|
22
|
+
# Binding resource is associated with.
|
|
23
23
|
# @return [BindingList] BindingList
|
|
24
24
|
def initialize(version, chat_service_sid: nil)
|
|
25
25
|
super(version)
|
|
@@ -38,10 +38,11 @@ module Twilio
|
|
|
38
38
|
# notification
|
|
39
39
|
# configuration](https://www.twilio.com/docs/chat/push-notification-configuration)
|
|
40
40
|
# for more info.
|
|
41
|
-
# @param [String] identity The
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
# tokens](https://www.twilio.com/docs/
|
|
41
|
+
# @param [String] identity The identity of a [Conversation
|
|
42
|
+
# User](https://www.twilio.com/docs/conversations/api/user-resource) this binding
|
|
43
|
+
# belongs to. See [access
|
|
44
|
+
# tokens](https://www.twilio.com/docs/conversations/create-tokens) for more
|
|
45
|
+
# details.
|
|
45
46
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
46
47
|
# guarantees to never return more than limit. Default is no limit
|
|
47
48
|
# @param [Integer] page_size Number of records to fetch per request, when
|
|
@@ -67,10 +68,11 @@ module Twilio
|
|
|
67
68
|
# notification
|
|
68
69
|
# configuration](https://www.twilio.com/docs/chat/push-notification-configuration)
|
|
69
70
|
# for more info.
|
|
70
|
-
# @param [String] identity The
|
|
71
|
-
#
|
|
72
|
-
#
|
|
73
|
-
# tokens](https://www.twilio.com/docs/
|
|
71
|
+
# @param [String] identity The identity of a [Conversation
|
|
72
|
+
# User](https://www.twilio.com/docs/conversations/api/user-resource) this binding
|
|
73
|
+
# belongs to. See [access
|
|
74
|
+
# tokens](https://www.twilio.com/docs/conversations/create-tokens) for more
|
|
75
|
+
# details.
|
|
74
76
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
75
77
|
# guarantees to never return more than limit. Default is no limit.
|
|
76
78
|
# @param [Integer] page_size Number of records to fetch per request, when
|
|
@@ -108,10 +110,11 @@ module Twilio
|
|
|
108
110
|
# notification
|
|
109
111
|
# configuration](https://www.twilio.com/docs/chat/push-notification-configuration)
|
|
110
112
|
# for more info.
|
|
111
|
-
# @param [String] identity The
|
|
112
|
-
#
|
|
113
|
-
#
|
|
114
|
-
# tokens](https://www.twilio.com/docs/
|
|
113
|
+
# @param [String] identity The identity of a [Conversation
|
|
114
|
+
# User](https://www.twilio.com/docs/conversations/api/user-resource) this binding
|
|
115
|
+
# belongs to. See [access
|
|
116
|
+
# tokens](https://www.twilio.com/docs/conversations/create-tokens) for more
|
|
117
|
+
# details.
|
|
115
118
|
# @param [String] page_token PageToken provided by the API
|
|
116
119
|
# @param [Integer] page_number Page Number, this value is simply for client state
|
|
117
120
|
# @param [Integer] page_size Number of records to return, defaults to 50
|
|
@@ -187,9 +190,9 @@ module Twilio
|
|
|
187
190
|
##
|
|
188
191
|
# Initialize the BindingContext
|
|
189
192
|
# @param [Version] version Version that contains the resource
|
|
190
|
-
# @param [String] chat_service_sid The SID of the [
|
|
191
|
-
# Service](https://www.twilio.com/docs/
|
|
192
|
-
# resource is associated with.
|
|
193
|
+
# @param [String] chat_service_sid The SID of the [Conversation
|
|
194
|
+
# Service](https://www.twilio.com/docs/conversations/api/service-resource) the
|
|
195
|
+
# Binding resource is associated with.
|
|
193
196
|
# @param [String] sid A 34 character string that uniquely identifies this
|
|
194
197
|
# resource.
|
|
195
198
|
# @return [BindingContext] BindingContext
|
|
@@ -244,9 +247,9 @@ module Twilio
|
|
|
244
247
|
# Initialize the BindingInstance
|
|
245
248
|
# @param [Version] version Version that contains the resource
|
|
246
249
|
# @param [Hash] payload payload that contains response from Twilio
|
|
247
|
-
# @param [String] chat_service_sid The SID of the [
|
|
248
|
-
# Service](https://www.twilio.com/docs/
|
|
249
|
-
# resource is associated with.
|
|
250
|
+
# @param [String] chat_service_sid The SID of the [Conversation
|
|
251
|
+
# Service](https://www.twilio.com/docs/conversations/api/service-resource) the
|
|
252
|
+
# Binding resource is associated with.
|
|
250
253
|
# @param [String] sid A 34 character string that uniquely identifies this
|
|
251
254
|
# resource.
|
|
252
255
|
# @return [BindingInstance] BindingInstance
|
|
@@ -291,13 +294,13 @@ module Twilio
|
|
|
291
294
|
end
|
|
292
295
|
|
|
293
296
|
##
|
|
294
|
-
# @return [String] The unique
|
|
297
|
+
# @return [String] The unique ID of the Account responsible for this binding.
|
|
295
298
|
def account_sid
|
|
296
299
|
@properties['account_sid']
|
|
297
300
|
end
|
|
298
301
|
|
|
299
302
|
##
|
|
300
|
-
# @return [String] The SID of the
|
|
303
|
+
# @return [String] The SID of the Conversation Service that the resource is associated with.
|
|
301
304
|
def chat_service_sid
|
|
302
305
|
@properties['chat_service_sid']
|
|
303
306
|
end
|
|
@@ -327,7 +330,7 @@ module Twilio
|
|
|
327
330
|
end
|
|
328
331
|
|
|
329
332
|
##
|
|
330
|
-
# @return [String] The
|
|
333
|
+
# @return [String] The identity of Conversation User associated with this binding.
|
|
331
334
|
def identity
|
|
332
335
|
@properties['identity']
|
|
333
336
|
end
|
|
@@ -339,7 +342,7 @@ module Twilio
|
|
|
339
342
|
end
|
|
340
343
|
|
|
341
344
|
##
|
|
342
|
-
# @return [String] The
|
|
345
|
+
# @return [String] The Conversation message types the binding is subscribed to.
|
|
343
346
|
def message_types
|
|
344
347
|
@properties['message_types']
|
|
345
348
|
end
|
|
@@ -80,6 +80,9 @@ module Twilio
|
|
|
80
80
|
# Path Solution
|
|
81
81
|
@solution = {chat_service_sid: chat_service_sid, }
|
|
82
82
|
@uri = "/Services/#{@solution[:chat_service_sid]}/Configuration"
|
|
83
|
+
|
|
84
|
+
# Components
|
|
85
|
+
@notifications = nil
|
|
83
86
|
end
|
|
84
87
|
|
|
85
88
|
##
|
|
@@ -93,17 +96,18 @@ module Twilio
|
|
|
93
96
|
|
|
94
97
|
##
|
|
95
98
|
# Update the ConfigurationInstance
|
|
96
|
-
# @param [String] default_conversation_creator_role_sid The
|
|
97
|
-
# conversation creator when they join a new conversation. See
|
|
98
|
-
#
|
|
99
|
+
# @param [String] default_conversation_creator_role_sid The conversation-level
|
|
100
|
+
# role assigned to a conversation creator when they join a new conversation. See
|
|
101
|
+
# the [Conversation
|
|
102
|
+
# Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info
|
|
99
103
|
# about roles.
|
|
100
|
-
# @param [String] default_conversation_role_sid The role
|
|
101
|
-
# they are added to a conversation. See the [
|
|
102
|
-
#
|
|
104
|
+
# @param [String] default_conversation_role_sid The conversation-level role
|
|
105
|
+
# assigned to users when they are added to a conversation. See the [Conversation
|
|
106
|
+
# Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info
|
|
103
107
|
# about roles.
|
|
104
|
-
# @param [String] default_chat_service_role_sid The service role assigned to
|
|
105
|
-
# when they are added to the service. See the [
|
|
106
|
-
#
|
|
108
|
+
# @param [String] default_chat_service_role_sid The service-level role assigned to
|
|
109
|
+
# users when they are added to the service. See the [Conversation
|
|
110
|
+
# Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info
|
|
107
111
|
# about roles.
|
|
108
112
|
# @return [ConfigurationInstance] Updated ConfigurationInstance
|
|
109
113
|
def update(default_conversation_creator_role_sid: :unset, default_conversation_role_sid: :unset, default_chat_service_role_sid: :unset)
|
|
@@ -118,6 +122,13 @@ module Twilio
|
|
|
118
122
|
ConfigurationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
|
|
119
123
|
end
|
|
120
124
|
|
|
125
|
+
##
|
|
126
|
+
# Access the notifications
|
|
127
|
+
# @return [NotificationContext] NotificationContext
|
|
128
|
+
def notifications
|
|
129
|
+
return NotificationContext.new(@version, @solution[:chat_service_sid], )
|
|
130
|
+
end
|
|
131
|
+
|
|
121
132
|
##
|
|
122
133
|
# Provide a user friendly representation
|
|
123
134
|
def to_s
|
|
@@ -217,17 +228,18 @@ module Twilio
|
|
|
217
228
|
|
|
218
229
|
##
|
|
219
230
|
# Update the ConfigurationInstance
|
|
220
|
-
# @param [String] default_conversation_creator_role_sid The
|
|
221
|
-
# conversation creator when they join a new conversation. See
|
|
222
|
-
#
|
|
231
|
+
# @param [String] default_conversation_creator_role_sid The conversation-level
|
|
232
|
+
# role assigned to a conversation creator when they join a new conversation. See
|
|
233
|
+
# the [Conversation
|
|
234
|
+
# Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info
|
|
223
235
|
# about roles.
|
|
224
|
-
# @param [String] default_conversation_role_sid The role
|
|
225
|
-
# they are added to a conversation. See the [
|
|
226
|
-
#
|
|
236
|
+
# @param [String] default_conversation_role_sid The conversation-level role
|
|
237
|
+
# assigned to users when they are added to a conversation. See the [Conversation
|
|
238
|
+
# Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info
|
|
227
239
|
# about roles.
|
|
228
|
-
# @param [String] default_chat_service_role_sid The service role assigned to
|
|
229
|
-
# when they are added to the service. See the [
|
|
230
|
-
#
|
|
240
|
+
# @param [String] default_chat_service_role_sid The service-level role assigned to
|
|
241
|
+
# users when they are added to the service. See the [Conversation
|
|
242
|
+
# Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info
|
|
231
243
|
# about roles.
|
|
232
244
|
# @return [ConfigurationInstance] Updated ConfigurationInstance
|
|
233
245
|
def update(default_conversation_creator_role_sid: :unset, default_conversation_role_sid: :unset, default_chat_service_role_sid: :unset)
|
|
@@ -0,0 +1,315 @@
|
|
|
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
|
+
##
|
|
16
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
|
17
|
+
class NotificationList < ListResource
|
|
18
|
+
##
|
|
19
|
+
# Initialize the NotificationList
|
|
20
|
+
# @param [Version] version Version that contains the resource
|
|
21
|
+
# @param [String] chat_service_sid The unique string that we created to identify
|
|
22
|
+
# the Service configuration resource.
|
|
23
|
+
# @return [NotificationList] NotificationList
|
|
24
|
+
def initialize(version, chat_service_sid: nil)
|
|
25
|
+
super(version)
|
|
26
|
+
|
|
27
|
+
# Path Solution
|
|
28
|
+
@solution = {chat_service_sid: chat_service_sid}
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
# Provide a user friendly representation
|
|
33
|
+
def to_s
|
|
34
|
+
'#<Twilio.Conversations.V1.NotificationList>'
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
##
|
|
39
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
|
40
|
+
class NotificationPage < Page
|
|
41
|
+
##
|
|
42
|
+
# Initialize the NotificationPage
|
|
43
|
+
# @param [Version] version Version that contains the resource
|
|
44
|
+
# @param [Response] response Response from the API
|
|
45
|
+
# @param [Hash] solution Path solution for the resource
|
|
46
|
+
# @return [NotificationPage] NotificationPage
|
|
47
|
+
def initialize(version, response, solution)
|
|
48
|
+
super(version, response)
|
|
49
|
+
|
|
50
|
+
# Path Solution
|
|
51
|
+
@solution = solution
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
##
|
|
55
|
+
# Build an instance of NotificationInstance
|
|
56
|
+
# @param [Hash] payload Payload response from the API
|
|
57
|
+
# @return [NotificationInstance] NotificationInstance
|
|
58
|
+
def get_instance(payload)
|
|
59
|
+
NotificationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
##
|
|
63
|
+
# Provide a user friendly representation
|
|
64
|
+
def to_s
|
|
65
|
+
'<Twilio.Conversations.V1.NotificationPage>'
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
##
|
|
70
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
|
71
|
+
class NotificationContext < InstanceContext
|
|
72
|
+
##
|
|
73
|
+
# Initialize the NotificationContext
|
|
74
|
+
# @param [Version] version Version that contains the resource
|
|
75
|
+
# @param [String] chat_service_sid The SID of the [Conversation
|
|
76
|
+
# Service](https://www.twilio.com/docs/conversations/api/service-resource) the
|
|
77
|
+
# Configuration applies to.
|
|
78
|
+
# @return [NotificationContext] NotificationContext
|
|
79
|
+
def initialize(version, chat_service_sid)
|
|
80
|
+
super(version)
|
|
81
|
+
|
|
82
|
+
# Path Solution
|
|
83
|
+
@solution = {chat_service_sid: chat_service_sid, }
|
|
84
|
+
@uri = "/Services/#{@solution[:chat_service_sid]}/Configuration/Notifications"
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
##
|
|
88
|
+
# Update the NotificationInstance
|
|
89
|
+
# @param [Boolean] log_enabled Weather the notification logging is enabled.
|
|
90
|
+
# @param [Boolean] new_message_enabled Whether to send a notification when a new
|
|
91
|
+
# message is added to a conversation. The default is `false`.
|
|
92
|
+
# @param [String] new_message_template The template to use to create the
|
|
93
|
+
# notification text displayed when a new message is added to a conversation and
|
|
94
|
+
# `new_message.enabled` is `true`.
|
|
95
|
+
# @param [String] new_message_sound The name of the sound to play when a new
|
|
96
|
+
# message is added to a conversation and `new_message.enabled` is `true`.
|
|
97
|
+
# @param [Boolean] new_message_badge_count_enabled Whether the new message badge
|
|
98
|
+
# is enabled. The default is `false`.
|
|
99
|
+
# @param [Boolean] added_to_conversation_enabled Whether to send a notification
|
|
100
|
+
# when a participant is added to a conversation. The default is `false`.
|
|
101
|
+
# @param [String] added_to_conversation_template The template to use to create the
|
|
102
|
+
# notification text displayed when a participant is added to a conversation and
|
|
103
|
+
# `added_to_conversation.enabled` is `true`.
|
|
104
|
+
# @param [String] added_to_conversation_sound The name of the sound to play when a
|
|
105
|
+
# participant is added to a conversation and `added_to_conversation.enabled` is
|
|
106
|
+
# `true`.
|
|
107
|
+
# @param [Boolean] removed_from_conversation_enabled Whether to send a
|
|
108
|
+
# notification to a user when they are removed from a conversation. The default is
|
|
109
|
+
# `false`.
|
|
110
|
+
# @param [String] removed_from_conversation_template The template to use to create
|
|
111
|
+
# the notification text displayed to a user when they are removed from a
|
|
112
|
+
# conversation and `removed_from_conversation.enabled` is `true`.
|
|
113
|
+
# @param [String] removed_from_conversation_sound The name of the sound to play to
|
|
114
|
+
# a user when they are removed from a conversation and
|
|
115
|
+
# `removed_from_conversation.enabled` is `true`.
|
|
116
|
+
# @return [NotificationInstance] Updated NotificationInstance
|
|
117
|
+
def update(log_enabled: :unset, new_message_enabled: :unset, new_message_template: :unset, new_message_sound: :unset, new_message_badge_count_enabled: :unset, added_to_conversation_enabled: :unset, added_to_conversation_template: :unset, added_to_conversation_sound: :unset, removed_from_conversation_enabled: :unset, removed_from_conversation_template: :unset, removed_from_conversation_sound: :unset)
|
|
118
|
+
data = Twilio::Values.of({
|
|
119
|
+
'LogEnabled' => log_enabled,
|
|
120
|
+
'NewMessage.Enabled' => new_message_enabled,
|
|
121
|
+
'NewMessage.Template' => new_message_template,
|
|
122
|
+
'NewMessage.Sound' => new_message_sound,
|
|
123
|
+
'NewMessage.BadgeCountEnabled' => new_message_badge_count_enabled,
|
|
124
|
+
'AddedToConversation.Enabled' => added_to_conversation_enabled,
|
|
125
|
+
'AddedToConversation.Template' => added_to_conversation_template,
|
|
126
|
+
'AddedToConversation.Sound' => added_to_conversation_sound,
|
|
127
|
+
'RemovedFromConversation.Enabled' => removed_from_conversation_enabled,
|
|
128
|
+
'RemovedFromConversation.Template' => removed_from_conversation_template,
|
|
129
|
+
'RemovedFromConversation.Sound' => removed_from_conversation_sound,
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
payload = @version.update('POST', @uri, data: data)
|
|
133
|
+
|
|
134
|
+
NotificationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
##
|
|
138
|
+
# Fetch the NotificationInstance
|
|
139
|
+
# @return [NotificationInstance] Fetched NotificationInstance
|
|
140
|
+
def fetch
|
|
141
|
+
payload = @version.fetch('GET', @uri)
|
|
142
|
+
|
|
143
|
+
NotificationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
##
|
|
147
|
+
# Provide a user friendly representation
|
|
148
|
+
def to_s
|
|
149
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
150
|
+
"#<Twilio.Conversations.V1.NotificationContext #{context}>"
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
##
|
|
154
|
+
# Provide a detailed, user friendly representation
|
|
155
|
+
def inspect
|
|
156
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
157
|
+
"#<Twilio.Conversations.V1.NotificationContext #{context}>"
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
##
|
|
162
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
|
163
|
+
class NotificationInstance < InstanceResource
|
|
164
|
+
##
|
|
165
|
+
# Initialize the NotificationInstance
|
|
166
|
+
# @param [Version] version Version that contains the resource
|
|
167
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
168
|
+
# @param [String] chat_service_sid The unique string that we created to identify
|
|
169
|
+
# the Service configuration resource.
|
|
170
|
+
# @return [NotificationInstance] NotificationInstance
|
|
171
|
+
def initialize(version, payload, chat_service_sid: nil)
|
|
172
|
+
super(version)
|
|
173
|
+
|
|
174
|
+
# Marshaled Properties
|
|
175
|
+
@properties = {
|
|
176
|
+
'account_sid' => payload['account_sid'],
|
|
177
|
+
'chat_service_sid' => payload['chat_service_sid'],
|
|
178
|
+
'new_message' => payload['new_message'],
|
|
179
|
+
'added_to_conversation' => payload['added_to_conversation'],
|
|
180
|
+
'removed_from_conversation' => payload['removed_from_conversation'],
|
|
181
|
+
'log_enabled' => payload['log_enabled'],
|
|
182
|
+
'url' => payload['url'],
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
# Context
|
|
186
|
+
@instance_context = nil
|
|
187
|
+
@params = {'chat_service_sid' => chat_service_sid, }
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
##
|
|
191
|
+
# Generate an instance context for the instance, the context is capable of
|
|
192
|
+
# performing various actions. All instance actions are proxied to the context
|
|
193
|
+
# @return [NotificationContext] NotificationContext for this NotificationInstance
|
|
194
|
+
def context
|
|
195
|
+
unless @instance_context
|
|
196
|
+
@instance_context = NotificationContext.new(@version, @params['chat_service_sid'], )
|
|
197
|
+
end
|
|
198
|
+
@instance_context
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
##
|
|
202
|
+
# @return [String] The unique ID of the Account responsible for this configuration.
|
|
203
|
+
def account_sid
|
|
204
|
+
@properties['account_sid']
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
##
|
|
208
|
+
# @return [String] The SID of the Conversation Service that the Configuration applies to.
|
|
209
|
+
def chat_service_sid
|
|
210
|
+
@properties['chat_service_sid']
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
##
|
|
214
|
+
# @return [Hash] The Push Notification configuration for New Messages.
|
|
215
|
+
def new_message
|
|
216
|
+
@properties['new_message']
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
##
|
|
220
|
+
# @return [Hash] The Push Notification configuration for being added to a Conversation.
|
|
221
|
+
def added_to_conversation
|
|
222
|
+
@properties['added_to_conversation']
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
##
|
|
226
|
+
# @return [Hash] The Push Notification configuration for being removed from a Conversation.
|
|
227
|
+
def removed_from_conversation
|
|
228
|
+
@properties['removed_from_conversation']
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
##
|
|
232
|
+
# @return [Boolean] Weather the notification logging is enabled.
|
|
233
|
+
def log_enabled
|
|
234
|
+
@properties['log_enabled']
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
##
|
|
238
|
+
# @return [String] An absolute URL for this configuration.
|
|
239
|
+
def url
|
|
240
|
+
@properties['url']
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
##
|
|
244
|
+
# Update the NotificationInstance
|
|
245
|
+
# @param [Boolean] log_enabled Weather the notification logging is enabled.
|
|
246
|
+
# @param [Boolean] new_message_enabled Whether to send a notification when a new
|
|
247
|
+
# message is added to a conversation. The default is `false`.
|
|
248
|
+
# @param [String] new_message_template The template to use to create the
|
|
249
|
+
# notification text displayed when a new message is added to a conversation and
|
|
250
|
+
# `new_message.enabled` is `true`.
|
|
251
|
+
# @param [String] new_message_sound The name of the sound to play when a new
|
|
252
|
+
# message is added to a conversation and `new_message.enabled` is `true`.
|
|
253
|
+
# @param [Boolean] new_message_badge_count_enabled Whether the new message badge
|
|
254
|
+
# is enabled. The default is `false`.
|
|
255
|
+
# @param [Boolean] added_to_conversation_enabled Whether to send a notification
|
|
256
|
+
# when a participant is added to a conversation. The default is `false`.
|
|
257
|
+
# @param [String] added_to_conversation_template The template to use to create the
|
|
258
|
+
# notification text displayed when a participant is added to a conversation and
|
|
259
|
+
# `added_to_conversation.enabled` is `true`.
|
|
260
|
+
# @param [String] added_to_conversation_sound The name of the sound to play when a
|
|
261
|
+
# participant is added to a conversation and `added_to_conversation.enabled` is
|
|
262
|
+
# `true`.
|
|
263
|
+
# @param [Boolean] removed_from_conversation_enabled Whether to send a
|
|
264
|
+
# notification to a user when they are removed from a conversation. The default is
|
|
265
|
+
# `false`.
|
|
266
|
+
# @param [String] removed_from_conversation_template The template to use to create
|
|
267
|
+
# the notification text displayed to a user when they are removed from a
|
|
268
|
+
# conversation and `removed_from_conversation.enabled` is `true`.
|
|
269
|
+
# @param [String] removed_from_conversation_sound The name of the sound to play to
|
|
270
|
+
# a user when they are removed from a conversation and
|
|
271
|
+
# `removed_from_conversation.enabled` is `true`.
|
|
272
|
+
# @return [NotificationInstance] Updated NotificationInstance
|
|
273
|
+
def update(log_enabled: :unset, new_message_enabled: :unset, new_message_template: :unset, new_message_sound: :unset, new_message_badge_count_enabled: :unset, added_to_conversation_enabled: :unset, added_to_conversation_template: :unset, added_to_conversation_sound: :unset, removed_from_conversation_enabled: :unset, removed_from_conversation_template: :unset, removed_from_conversation_sound: :unset)
|
|
274
|
+
context.update(
|
|
275
|
+
log_enabled: log_enabled,
|
|
276
|
+
new_message_enabled: new_message_enabled,
|
|
277
|
+
new_message_template: new_message_template,
|
|
278
|
+
new_message_sound: new_message_sound,
|
|
279
|
+
new_message_badge_count_enabled: new_message_badge_count_enabled,
|
|
280
|
+
added_to_conversation_enabled: added_to_conversation_enabled,
|
|
281
|
+
added_to_conversation_template: added_to_conversation_template,
|
|
282
|
+
added_to_conversation_sound: added_to_conversation_sound,
|
|
283
|
+
removed_from_conversation_enabled: removed_from_conversation_enabled,
|
|
284
|
+
removed_from_conversation_template: removed_from_conversation_template,
|
|
285
|
+
removed_from_conversation_sound: removed_from_conversation_sound,
|
|
286
|
+
)
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
##
|
|
290
|
+
# Fetch the NotificationInstance
|
|
291
|
+
# @return [NotificationInstance] Fetched NotificationInstance
|
|
292
|
+
def fetch
|
|
293
|
+
context.fetch
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
##
|
|
297
|
+
# Provide a user friendly representation
|
|
298
|
+
def to_s
|
|
299
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
300
|
+
"<Twilio.Conversations.V1.NotificationInstance #{values}>"
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
##
|
|
304
|
+
# Provide a detailed, user friendly representation
|
|
305
|
+
def inspect
|
|
306
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
307
|
+
"<Twilio.Conversations.V1.NotificationInstance #{values}>"
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
end
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
end
|
|
314
|
+
end
|
|
315
|
+
end
|