twilio-ruby 5.21.1 → 5.21.2

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +13 -0
  3. data/README.md +7 -4
  4. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +14 -1
  5. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +6 -4
  6. data/lib/twilio-ruby/rest/chat.rb +2 -2
  7. data/lib/twilio-ruby/rest/chat/v2.rb +4 -2
  8. data/lib/twilio-ruby/rest/chat/v2/credential.rb +50 -45
  9. data/lib/twilio-ruby/rest/chat/v2/service.rb +197 -146
  10. data/lib/twilio-ruby/rest/chat/v2/service/binding.rb +43 -30
  11. data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +85 -77
  12. data/lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb +48 -46
  13. data/lib/twilio-ruby/rest/chat/v2/service/channel/member.rb +117 -113
  14. data/lib/twilio-ruby/rest/chat/v2/service/channel/message.rb +98 -96
  15. data/lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb +90 -36
  16. data/lib/twilio-ruby/rest/chat/v2/service/role.rb +38 -25
  17. data/lib/twilio-ruby/rest/chat/v2/service/user.rb +49 -51
  18. data/lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb +42 -34
  19. data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +37 -31
  20. data/lib/twilio-ruby/rest/flex_api.rb +8 -0
  21. data/lib/twilio-ruby/rest/flex_api/v1.rb +15 -0
  22. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +515 -0
  23. data/lib/twilio-ruby/rest/ip_messaging.rb +2 -2
  24. data/lib/twilio-ruby/rest/ip_messaging/v2.rb +4 -2
  25. data/lib/twilio-ruby/rest/ip_messaging/v2/credential.rb +50 -45
  26. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +197 -146
  27. data/lib/twilio-ruby/rest/ip_messaging/v2/service/binding.rb +43 -30
  28. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +85 -77
  29. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +48 -46
  30. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +117 -113
  31. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +98 -96
  32. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb +90 -36
  33. data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +38 -25
  34. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +49 -51
  35. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb +42 -34
  36. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb +37 -31
  37. data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +1 -4
  38. data/lib/twilio-ruby/rest/voice/v1/voice_permission/settings.rb +207 -0
  39. data/lib/twilio-ruby/version.rb +1 -1
  40. data/spec/integration/flex_api/v1/flex_flow_spec.rb +255 -0
  41. data/spec/integration/voice/v1/voice_permission/settings_spec.rb +77 -0
  42. metadata +8 -2
@@ -16,11 +16,11 @@ module Twilio
16
16
  ##
17
17
  # Initialize the UserChannelList
18
18
  # @param [Version] version Version that contains the resource
19
- # @param [String] service_sid The unique id of the
20
- # [Service](https://www.twilio.com/docs/api/chat/rest/services) this channel
21
- # belongs to.
22
- # @param [String] user_sid The unique id of the
23
- # [User](https://www.twilio.com/docs/api/chat/rest/users) this Channel belongs to.
19
+ # @param [String] service_sid The SID of the
20
+ # [Service](https://www.twilio.com/docs/chat/rest/services) the resource is
21
+ # associated with.
22
+ # @param [String] user_sid The SID of the
23
+ # [User](https://www.twilio.com/docs/chat/rest/users) the User Channel belongs to.
24
24
  # @return [UserChannelList] UserChannelList
25
25
  def initialize(version, service_sid: nil, user_sid: nil)
26
26
  super(version)
@@ -157,11 +157,15 @@ module Twilio
157
157
  ##
158
158
  # Initialize the UserChannelContext
159
159
  # @param [Version] version Version that contains the resource
160
- # @param [String] service_sid The unique id of the
161
- # [Service](https://www.twilio.com/docs/api/chat/rest/services) those channels
162
- # belong to.
163
- # @param [String] user_sid The unique id of a User.
164
- # @param [String] channel_sid The unique id of a Channel.
160
+ # @param [String] service_sid The SID of the
161
+ # [Service](https://www.twilio.com/docs/chat/rest/services) to fetch the User
162
+ # Channel resource from.
163
+ # @param [String] user_sid The SID of the
164
+ # [User](https://www.twilio.com/docs/chat/rest/users) to fetch the User Channel
165
+ # resource from.
166
+ # @param [String] channel_sid The SID of the
167
+ # [Channel](https://www.twilio.com/docs/chat/channels) that has the User Channel
168
+ # to fetch.
165
169
  # @return [UserChannelContext] UserChannelContext
166
170
  def initialize(version, service_sid, user_sid, channel_sid)
167
171
  super(version)
@@ -194,8 +198,8 @@ module Twilio
194
198
 
195
199
  ##
196
200
  # Update the UserChannelInstance
197
- # @param [user_channel.NotificationLevel] notification_level Push notification
198
- # level to be assigned to Channel of the User.
201
+ # @param [user_channel.NotificationLevel] notification_level The push notification
202
+ # level to assign to the User Channel. Can be: `default` or `muted`.
199
203
  # @return [UserChannelInstance] Updated UserChannelInstance
200
204
  def update(notification_level: nil)
201
205
  data = Twilio::Values.of({'NotificationLevel' => notification_level, })
@@ -235,12 +239,14 @@ module Twilio
235
239
  # Initialize the UserChannelInstance
236
240
  # @param [Version] version Version that contains the resource
237
241
  # @param [Hash] payload payload that contains response from Twilio
238
- # @param [String] service_sid The unique id of the
239
- # [Service](https://www.twilio.com/docs/api/chat/rest/services) this channel
240
- # belongs to.
241
- # @param [String] user_sid The unique id of the
242
- # [User](https://www.twilio.com/docs/api/chat/rest/users) this Channel belongs to.
243
- # @param [String] channel_sid The unique id of a Channel.
242
+ # @param [String] service_sid The SID of the
243
+ # [Service](https://www.twilio.com/docs/chat/rest/services) the resource is
244
+ # associated with.
245
+ # @param [String] user_sid The SID of the
246
+ # [User](https://www.twilio.com/docs/chat/rest/users) the User Channel belongs to.
247
+ # @param [String] channel_sid The SID of the
248
+ # [Channel](https://www.twilio.com/docs/chat/channels) that has the User Channel
249
+ # to fetch.
244
250
  # @return [UserChannelInstance] UserChannelInstance
245
251
  def initialize(version, payload, service_sid: nil, user_sid: nil, channel_sid: nil)
246
252
  super(version)
@@ -286,67 +292,67 @@ module Twilio
286
292
  end
287
293
 
288
294
  ##
289
- # @return [String] The unique id of the Account responsible for this channel.
295
+ # @return [String] The SID of the Account that created the resource
290
296
  def account_sid
291
297
  @properties['account_sid']
292
298
  end
293
299
 
294
300
  ##
295
- # @return [String] The unique id of the Service this channel belongs to.
301
+ # @return [String] The SID of the Service that the resource is associated with
296
302
  def service_sid
297
303
  @properties['service_sid']
298
304
  end
299
305
 
300
306
  ##
301
- # @return [String] The unique id of a Channel.
307
+ # @return [String] The SID of the Channel the resource belongs to
302
308
  def channel_sid
303
309
  @properties['channel_sid']
304
310
  end
305
311
 
306
312
  ##
307
- # @return [String] The unique id of the User this Channel belongs to.
313
+ # @return [String] The SID of the User the User Channel belongs to
308
314
  def user_sid
309
315
  @properties['user_sid']
310
316
  end
311
317
 
312
318
  ##
313
- # @return [String] The unique id of this User as a Member in this Channel.
319
+ # @return [String] The SID of the User as a Member in the Channel
314
320
  def member_sid
315
321
  @properties['member_sid']
316
322
  end
317
323
 
318
324
  ##
319
- # @return [user_channel.ChannelStatus] The status of the User on this Channel.
325
+ # @return [user_channel.ChannelStatus] The status of the User on the Channel
320
326
  def status
321
327
  @properties['status']
322
328
  end
323
329
 
324
330
  ##
325
- # @return [String] The index of the last read Message in this Channel for this User.
331
+ # @return [String] The index of the last Message in the Channel the Member has read
326
332
  def last_consumed_message_index
327
333
  @properties['last_consumed_message_index']
328
334
  end
329
335
 
330
336
  ##
331
- # @return [String] The count of unread Messages in this Channel for this User.
337
+ # @return [String] The number of unread Messages in the Channel for the User
332
338
  def unread_messages_count
333
339
  @properties['unread_messages_count']
334
340
  end
335
341
 
336
342
  ##
337
- # @return [String] The links
343
+ # @return [String] Absolute URLs to access the Members, Messages , Invites and, if it exists, the last Message for the Channel
338
344
  def links
339
345
  @properties['links']
340
346
  end
341
347
 
342
348
  ##
343
- # @return [String] An absolute URL for this User Channel.
349
+ # @return [String] The absolute URL of the resource
344
350
  def url
345
351
  @properties['url']
346
352
  end
347
353
 
348
354
  ##
349
- # @return [user_channel.NotificationLevel] The notification level of the User for this Channel.
355
+ # @return [user_channel.NotificationLevel] The push notification level of the User for the Channel
350
356
  def notification_level
351
357
  @properties['notification_level']
352
358
  end
@@ -360,8 +366,8 @@ module Twilio
360
366
 
361
367
  ##
362
368
  # Update the UserChannelInstance
363
- # @param [user_channel.NotificationLevel] notification_level Push notification
364
- # level to be assigned to Channel of the User.
369
+ # @param [user_channel.NotificationLevel] notification_level The push notification
370
+ # level to assign to the User Channel. Can be: `default` or `muted`.
365
371
  # @return [UserChannelInstance] Updated UserChannelInstance
366
372
  def update(notification_level: nil)
367
373
  context.update(notification_level: notification_level, )
@@ -28,6 +28,14 @@ module Twilio
28
28
  @v1 ||= V1.new self
29
29
  end
30
30
 
31
+ ##
32
+ # @param [String] sid The unique ID of the FlexFlow
33
+ # @return [Twilio::REST::Flex_api::V1::FlexFlowInstance] if sid was passed.
34
+ # @return [Twilio::REST::Flex_api::V1::FlexFlowList]
35
+ def flex_flow(sid=:unset)
36
+ self.v1.flex_flow(sid)
37
+ end
38
+
31
39
  ##
32
40
  # @return [Twilio::REST::Flex_api::V1::ConfigurationInstance]
33
41
  def configuration
@@ -15,9 +15,24 @@ module Twilio
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'v1'
18
+ @flex_flow = nil
18
19
  @configuration = nil
19
20
  end
20
21
 
22
+ ##
23
+ # @param [String] sid The unique ID of the FlexFlow
24
+ # @return [Twilio::REST::Flex_api::V1::FlexFlowContext] if sid was passed.
25
+ # @return [Twilio::REST::Flex_api::V1::FlexFlowList]
26
+ def flex_flow(sid=:unset)
27
+ if sid.nil?
28
+ raise ArgumentError, 'sid cannot be nil'
29
+ elsif sid == :unset
30
+ @flex_flow ||= FlexFlowList.new self
31
+ else
32
+ FlexFlowContext.new(self, sid)
33
+ end
34
+ end
35
+
21
36
  ##
22
37
  # @return [Twilio::REST::Flex_api::V1::ConfigurationContext]
23
38
  def configuration
@@ -0,0 +1,515 @@
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 FlexApi < Domain
12
+ class V1 < Version
13
+ class FlexFlowList < ListResource
14
+ ##
15
+ # Initialize the FlexFlowList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [FlexFlowList] FlexFlowList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ @uri = "/FlexFlows"
24
+ end
25
+
26
+ ##
27
+ # Lists FlexFlowInstance records from the API as a list.
28
+ # Unlike stream(), this operation is eager and will load `limit` records into
29
+ # memory before returning.
30
+ # @param [String] friendly_name Human readable description of this FlexFlow
31
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
32
+ # guarantees to never return more than limit. Default is no limit
33
+ # @param [Integer] page_size Number of records to fetch per request, when
34
+ # not set will use the default value of 50 records. If no page_size is defined
35
+ # but a limit is defined, stream() will attempt to read the limit with the most
36
+ # efficient page size, i.e. min(limit, 1000)
37
+ # @return [Array] Array of up to limit results
38
+ def list(friendly_name: :unset, limit: nil, page_size: nil)
39
+ self.stream(friendly_name: friendly_name, limit: limit, page_size: page_size).entries
40
+ end
41
+
42
+ ##
43
+ # Streams FlexFlowInstance records from the API as an Enumerable.
44
+ # This operation lazily loads records as efficiently as possible until the limit
45
+ # is reached.
46
+ # @param [String] friendly_name Human readable description of this FlexFlow
47
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
48
+ # guarantees to never return more than limit. Default is no limit.
49
+ # @param [Integer] page_size Number of records to fetch per request, when
50
+ # not set will use the default value of 50 records. If no page_size is defined
51
+ # but a limit is defined, stream() will attempt to read the limit with the most
52
+ # efficient page size, i.e. min(limit, 1000)
53
+ # @return [Enumerable] Enumerable that will yield up to limit results
54
+ def stream(friendly_name: :unset, limit: nil, page_size: nil)
55
+ limits = @version.read_limits(limit, page_size)
56
+
57
+ page = self.page(friendly_name: friendly_name, page_size: limits[:page_size], )
58
+
59
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
60
+ end
61
+
62
+ ##
63
+ # When passed a block, yields FlexFlowInstance records from the API.
64
+ # This operation lazily loads records as efficiently as possible until the limit
65
+ # is reached.
66
+ def each
67
+ limits = @version.read_limits
68
+
69
+ page = self.page(page_size: limits[:page_size], )
70
+
71
+ @version.stream(page,
72
+ limit: limits[:limit],
73
+ page_limit: limits[:page_limit]).each {|x| yield x}
74
+ end
75
+
76
+ ##
77
+ # Retrieve a single page of FlexFlowInstance records from the API.
78
+ # Request is executed immediately.
79
+ # @param [String] friendly_name Human readable description of this FlexFlow
80
+ # @param [String] page_token PageToken provided by the API
81
+ # @param [Integer] page_number Page Number, this value is simply for client state
82
+ # @param [Integer] page_size Number of records to return, defaults to 50
83
+ # @return [Page] Page of FlexFlowInstance
84
+ def page(friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
85
+ params = Twilio::Values.of({
86
+ 'FriendlyName' => friendly_name,
87
+ 'PageToken' => page_token,
88
+ 'Page' => page_number,
89
+ 'PageSize' => page_size,
90
+ })
91
+ response = @version.page(
92
+ 'GET',
93
+ @uri,
94
+ params
95
+ )
96
+ FlexFlowPage.new(@version, response, @solution)
97
+ end
98
+
99
+ ##
100
+ # Retrieve a single page of FlexFlowInstance records from the API.
101
+ # Request is executed immediately.
102
+ # @param [String] target_url API-generated URL for the requested results page
103
+ # @return [Page] Page of FlexFlowInstance
104
+ def get_page(target_url)
105
+ response = @version.domain.request(
106
+ 'GET',
107
+ target_url
108
+ )
109
+ FlexFlowPage.new(@version, response, @solution)
110
+ end
111
+
112
+ ##
113
+ # Retrieve a single page of FlexFlowInstance records from the API.
114
+ # Request is executed immediately.
115
+ # @param [String] friendly_name Human readable description of this FlexFlow
116
+ # @param [String] chat_service_sid The unique SID identifier of the chat service
117
+ # @param [flex_flow.ChannelType] channel_type Channel type (web | facebook | sms)
118
+ # @param [String] contact_identity Channel contact Identity (number / contact)
119
+ # @param [Boolean] enabled Boolean flag for enabling or disabling the FlexFlow
120
+ # @param [flex_flow.IntegrationType] integration_type Integration type (studio |
121
+ # external | task)
122
+ # @param [String] integration_flow_sid The unique SID identifier of the Flow for
123
+ # Studio integration type
124
+ # @param [String] integration_url External Webhook Url for External integration
125
+ # type
126
+ # @param [String] integration_workspace_sid Workspace Sid for a new task for Task
127
+ # integration type
128
+ # @param [String] integration_workflow_sid Workflow Sid for a new task for Task
129
+ # integration type
130
+ # @param [String] integration_channel Task Channel for a new task for Task
131
+ # integration type (default is 'default')
132
+ # @param [String] integration_timeout Task timeout in seconds for a new task for
133
+ # Task integration type (default 86400)
134
+ # @param [String] integration_priority Task priority for a new task for Task
135
+ # integration type (default 0)
136
+ # @param [Boolean] integration_creation_on_message Flag for task creation, either
137
+ # creating task with the channel, or if true create task whwn first message
138
+ # arrives (for Task integration type)
139
+ # @param [Boolean] long_lived Default Flag defining whether the new channels
140
+ # created are long lived or not
141
+ # @return [FlexFlowInstance] Newly created FlexFlowInstance
142
+ def create(friendly_name: nil, chat_service_sid: nil, channel_type: nil, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset)
143
+ data = Twilio::Values.of({
144
+ 'FriendlyName' => friendly_name,
145
+ 'ChatServiceSid' => chat_service_sid,
146
+ 'ChannelType' => channel_type,
147
+ 'ContactIdentity' => contact_identity,
148
+ 'Enabled' => enabled,
149
+ 'IntegrationType' => integration_type,
150
+ 'Integration.FlowSid' => integration_flow_sid,
151
+ 'Integration.Url' => integration_url,
152
+ 'Integration.WorkspaceSid' => integration_workspace_sid,
153
+ 'Integration.WorkflowSid' => integration_workflow_sid,
154
+ 'Integration.Channel' => integration_channel,
155
+ 'Integration.Timeout' => integration_timeout,
156
+ 'Integration.Priority' => integration_priority,
157
+ 'Integration.CreationOnMessage' => integration_creation_on_message,
158
+ 'LongLived' => long_lived,
159
+ })
160
+
161
+ payload = @version.create(
162
+ 'POST',
163
+ @uri,
164
+ data: data
165
+ )
166
+
167
+ FlexFlowInstance.new(@version, payload, )
168
+ end
169
+
170
+ ##
171
+ # Provide a user friendly representation
172
+ def to_s
173
+ '#<Twilio.FlexApi.V1.FlexFlowList>'
174
+ end
175
+ end
176
+
177
+ class FlexFlowPage < Page
178
+ ##
179
+ # Initialize the FlexFlowPage
180
+ # @param [Version] version Version that contains the resource
181
+ # @param [Response] response Response from the API
182
+ # @param [Hash] solution Path solution for the resource
183
+ # @return [FlexFlowPage] FlexFlowPage
184
+ def initialize(version, response, solution)
185
+ super(version, response)
186
+
187
+ # Path Solution
188
+ @solution = solution
189
+ end
190
+
191
+ ##
192
+ # Build an instance of FlexFlowInstance
193
+ # @param [Hash] payload Payload response from the API
194
+ # @return [FlexFlowInstance] FlexFlowInstance
195
+ def get_instance(payload)
196
+ FlexFlowInstance.new(@version, payload, )
197
+ end
198
+
199
+ ##
200
+ # Provide a user friendly representation
201
+ def to_s
202
+ '<Twilio.FlexApi.V1.FlexFlowPage>'
203
+ end
204
+ end
205
+
206
+ class FlexFlowContext < InstanceContext
207
+ ##
208
+ # Initialize the FlexFlowContext
209
+ # @param [Version] version Version that contains the resource
210
+ # @param [String] sid The unique ID of the FlexFlow
211
+ # @return [FlexFlowContext] FlexFlowContext
212
+ def initialize(version, sid)
213
+ super(version)
214
+
215
+ # Path Solution
216
+ @solution = {sid: sid, }
217
+ @uri = "/FlexFlows/#{@solution[:sid]}"
218
+ end
219
+
220
+ ##
221
+ # Fetch a FlexFlowInstance
222
+ # @return [FlexFlowInstance] Fetched FlexFlowInstance
223
+ def fetch
224
+ params = Twilio::Values.of({})
225
+
226
+ payload = @version.fetch(
227
+ 'GET',
228
+ @uri,
229
+ params,
230
+ )
231
+
232
+ FlexFlowInstance.new(@version, payload, sid: @solution[:sid], )
233
+ end
234
+
235
+ ##
236
+ # Update the FlexFlowInstance
237
+ # @param [String] friendly_name Human readable description of this FlexFlow
238
+ # @param [String] chat_service_sid The unique SID identifier of the chat service
239
+ # @param [flex_flow.ChannelType] channel_type Channel type (web | facebook | sms)
240
+ # @param [String] contact_identity Channel contact Identity (number / contact)
241
+ # @param [Boolean] enabled Boolean flag for enabling or disabling the FlexFlow
242
+ # @param [flex_flow.IntegrationType] integration_type Integration type (studio |
243
+ # external | task)
244
+ # @param [String] integration_flow_sid The unique SID identifier of the Flow for
245
+ # Studio integration type
246
+ # @param [String] integration_url External Webhook Url for External integration
247
+ # type
248
+ # @param [String] integration_workspace_sid Workspace Sid for a new task for Task
249
+ # integration type
250
+ # @param [String] integration_workflow_sid Workflow Sid for a new task for Task
251
+ # integration type
252
+ # @param [String] integration_channel Task Channel for a new task for Task
253
+ # integration type (default is 'default')
254
+ # @param [String] integration_timeout Task timeout in seconds for a new task for
255
+ # Task integration type (default 86400)
256
+ # @param [String] integration_priority Task priority for a new task for Task
257
+ # integration type (default 0)
258
+ # @param [Boolean] integration_creation_on_message Flag for task creation, either
259
+ # creating task with the channel, or if true create task whwn first message
260
+ # arrives (for Task integration type)
261
+ # @param [Boolean] long_lived Default Flag defining whether the new channels
262
+ # created are long lived or not
263
+ # @return [FlexFlowInstance] Updated FlexFlowInstance
264
+ def update(friendly_name: :unset, chat_service_sid: :unset, channel_type: :unset, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset)
265
+ data = Twilio::Values.of({
266
+ 'FriendlyName' => friendly_name,
267
+ 'ChatServiceSid' => chat_service_sid,
268
+ 'ChannelType' => channel_type,
269
+ 'ContactIdentity' => contact_identity,
270
+ 'Enabled' => enabled,
271
+ 'IntegrationType' => integration_type,
272
+ 'Integration.FlowSid' => integration_flow_sid,
273
+ 'Integration.Url' => integration_url,
274
+ 'Integration.WorkspaceSid' => integration_workspace_sid,
275
+ 'Integration.WorkflowSid' => integration_workflow_sid,
276
+ 'Integration.Channel' => integration_channel,
277
+ 'Integration.Timeout' => integration_timeout,
278
+ 'Integration.Priority' => integration_priority,
279
+ 'Integration.CreationOnMessage' => integration_creation_on_message,
280
+ 'LongLived' => long_lived,
281
+ })
282
+
283
+ payload = @version.update(
284
+ 'POST',
285
+ @uri,
286
+ data: data,
287
+ )
288
+
289
+ FlexFlowInstance.new(@version, payload, sid: @solution[:sid], )
290
+ end
291
+
292
+ ##
293
+ # Deletes the FlexFlowInstance
294
+ # @return [Boolean] true if delete succeeds, true otherwise
295
+ def delete
296
+ @version.delete('delete', @uri)
297
+ end
298
+
299
+ ##
300
+ # Provide a user friendly representation
301
+ def to_s
302
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
303
+ "#<Twilio.FlexApi.V1.FlexFlowContext #{context}>"
304
+ end
305
+
306
+ ##
307
+ # Provide a detailed, user friendly representation
308
+ def inspect
309
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
310
+ "#<Twilio.FlexApi.V1.FlexFlowContext #{context}>"
311
+ end
312
+ end
313
+
314
+ class FlexFlowInstance < InstanceResource
315
+ ##
316
+ # Initialize the FlexFlowInstance
317
+ # @param [Version] version Version that contains the resource
318
+ # @param [Hash] payload payload that contains response from Twilio
319
+ # @param [String] sid The unique ID of the FlexFlow
320
+ # @return [FlexFlowInstance] FlexFlowInstance
321
+ def initialize(version, payload, sid: nil)
322
+ super(version)
323
+
324
+ # Marshaled Properties
325
+ @properties = {
326
+ 'account_sid' => payload['account_sid'],
327
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
328
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
329
+ 'sid' => payload['sid'],
330
+ 'friendly_name' => payload['friendly_name'],
331
+ 'chat_service_sid' => payload['chat_service_sid'],
332
+ 'channel_type' => payload['channel_type'],
333
+ 'contact_identity' => payload['contact_identity'],
334
+ 'enabled' => payload['enabled'],
335
+ 'integration_type' => payload['integration_type'],
336
+ 'integration' => payload['integration'],
337
+ 'long_lived' => payload['long_lived'],
338
+ 'url' => payload['url'],
339
+ }
340
+
341
+ # Context
342
+ @instance_context = nil
343
+ @params = {'sid' => sid || @properties['sid'], }
344
+ end
345
+
346
+ ##
347
+ # Generate an instance context for the instance, the context is capable of
348
+ # performing various actions. All instance actions are proxied to the context
349
+ # @return [FlexFlowContext] FlexFlowContext for this FlexFlowInstance
350
+ def context
351
+ unless @instance_context
352
+ @instance_context = FlexFlowContext.new(@version, @params['sid'], )
353
+ end
354
+ @instance_context
355
+ end
356
+
357
+ ##
358
+ # @return [String] The ID of the account that owns this Workflow
359
+ def account_sid
360
+ @properties['account_sid']
361
+ end
362
+
363
+ ##
364
+ # @return [Time] The time the FlexFlow was created, given as GMT in ISO 8601 format.
365
+ def date_created
366
+ @properties['date_created']
367
+ end
368
+
369
+ ##
370
+ # @return [Time] The time the FlexFlow was last updated, given as GMT in ISO 8601 format.
371
+ def date_updated
372
+ @properties['date_updated']
373
+ end
374
+
375
+ ##
376
+ # @return [String] The unique ID of the FlexFlow
377
+ def sid
378
+ @properties['sid']
379
+ end
380
+
381
+ ##
382
+ # @return [String] Human readable description of this FlexFlow
383
+ def friendly_name
384
+ @properties['friendly_name']
385
+ end
386
+
387
+ ##
388
+ # @return [String] Service Sid.
389
+ def chat_service_sid
390
+ @properties['chat_service_sid']
391
+ end
392
+
393
+ ##
394
+ # @return [flex_flow.ChannelType] Channel type
395
+ def channel_type
396
+ @properties['channel_type']
397
+ end
398
+
399
+ ##
400
+ # @return [String] Channel contact Identity
401
+ def contact_identity
402
+ @properties['contact_identity']
403
+ end
404
+
405
+ ##
406
+ # @return [Boolean] Boolean flag for enabling or disabling the FlexFlow
407
+ def enabled
408
+ @properties['enabled']
409
+ end
410
+
411
+ ##
412
+ # @return [flex_flow.IntegrationType] Integration type
413
+ def integration_type
414
+ @properties['integration_type']
415
+ end
416
+
417
+ ##
418
+ # @return [Hash] Integration block
419
+ def integration
420
+ @properties['integration']
421
+ end
422
+
423
+ ##
424
+ # @return [Boolean] Long Lived flag for new Channel
425
+ def long_lived
426
+ @properties['long_lived']
427
+ end
428
+
429
+ ##
430
+ # @return [String] The url
431
+ def url
432
+ @properties['url']
433
+ end
434
+
435
+ ##
436
+ # Fetch a FlexFlowInstance
437
+ # @return [FlexFlowInstance] Fetched FlexFlowInstance
438
+ def fetch
439
+ context.fetch
440
+ end
441
+
442
+ ##
443
+ # Update the FlexFlowInstance
444
+ # @param [String] friendly_name Human readable description of this FlexFlow
445
+ # @param [String] chat_service_sid The unique SID identifier of the chat service
446
+ # @param [flex_flow.ChannelType] channel_type Channel type (web | facebook | sms)
447
+ # @param [String] contact_identity Channel contact Identity (number / contact)
448
+ # @param [Boolean] enabled Boolean flag for enabling or disabling the FlexFlow
449
+ # @param [flex_flow.IntegrationType] integration_type Integration type (studio |
450
+ # external | task)
451
+ # @param [String] integration_flow_sid The unique SID identifier of the Flow for
452
+ # Studio integration type
453
+ # @param [String] integration_url External Webhook Url for External integration
454
+ # type
455
+ # @param [String] integration_workspace_sid Workspace Sid for a new task for Task
456
+ # integration type
457
+ # @param [String] integration_workflow_sid Workflow Sid for a new task for Task
458
+ # integration type
459
+ # @param [String] integration_channel Task Channel for a new task for Task
460
+ # integration type (default is 'default')
461
+ # @param [String] integration_timeout Task timeout in seconds for a new task for
462
+ # Task integration type (default 86400)
463
+ # @param [String] integration_priority Task priority for a new task for Task
464
+ # integration type (default 0)
465
+ # @param [Boolean] integration_creation_on_message Flag for task creation, either
466
+ # creating task with the channel, or if true create task whwn first message
467
+ # arrives (for Task integration type)
468
+ # @param [Boolean] long_lived Default Flag defining whether the new channels
469
+ # created are long lived or not
470
+ # @return [FlexFlowInstance] Updated FlexFlowInstance
471
+ def update(friendly_name: :unset, chat_service_sid: :unset, channel_type: :unset, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset)
472
+ context.update(
473
+ friendly_name: friendly_name,
474
+ chat_service_sid: chat_service_sid,
475
+ channel_type: channel_type,
476
+ contact_identity: contact_identity,
477
+ enabled: enabled,
478
+ integration_type: integration_type,
479
+ integration_flow_sid: integration_flow_sid,
480
+ integration_url: integration_url,
481
+ integration_workspace_sid: integration_workspace_sid,
482
+ integration_workflow_sid: integration_workflow_sid,
483
+ integration_channel: integration_channel,
484
+ integration_timeout: integration_timeout,
485
+ integration_priority: integration_priority,
486
+ integration_creation_on_message: integration_creation_on_message,
487
+ long_lived: long_lived,
488
+ )
489
+ end
490
+
491
+ ##
492
+ # Deletes the FlexFlowInstance
493
+ # @return [Boolean] true if delete succeeds, true otherwise
494
+ def delete
495
+ context.delete
496
+ end
497
+
498
+ ##
499
+ # Provide a user friendly representation
500
+ def to_s
501
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
502
+ "<Twilio.FlexApi.V1.FlexFlowInstance #{values}>"
503
+ end
504
+
505
+ ##
506
+ # Provide a detailed, user friendly representation
507
+ def inspect
508
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
509
+ "<Twilio.FlexApi.V1.FlexFlowInstance #{values}>"
510
+ end
511
+ end
512
+ end
513
+ end
514
+ end
515
+ end