twilio-ruby 5.53.0 → 5.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +7 -7
- data/.travis.yml +2 -2
- data/CHANGES.md +62 -0
- data/README.md +10 -2
- data/lib/twilio-ruby.rb +5 -15
- data/lib/twilio-ruby/framework/{domain.rb → rest/domain.rb} +0 -0
- data/lib/twilio-ruby/framework/{error.rb → rest/error.rb} +0 -0
- data/lib/twilio-ruby/framework/{helper.rb → rest/helper.rb} +0 -0
- data/lib/twilio-ruby/framework/{obsolete_client.rb → rest/obsolete_client.rb} +0 -0
- data/lib/twilio-ruby/framework/{page.rb → rest/page.rb} +0 -0
- data/lib/twilio-ruby/framework/{resource.rb → rest/resource.rb} +0 -0
- data/lib/twilio-ruby/framework/{version.rb → rest/version.rb} +0 -0
- data/lib/twilio-ruby/http.rb +5 -0
- data/lib/twilio-ruby/http/http_client.rb +11 -1
- data/lib/twilio-ruby/rest.rb +13 -0
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +8 -7
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +2 -2
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +7 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +7 -0
- data/lib/twilio-ruby/rest/events/v1/event_type.rb +12 -5
- data/lib/twilio-ruby/rest/events/v1/sink.rb +19 -5
- data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +28 -22
- data/lib/twilio-ruby/rest/frontline_api.rb +47 -0
- data/lib/twilio-ruby/rest/frontline_api/v1.rb +45 -0
- data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +233 -0
- data/lib/twilio-ruby/rest/messaging/v1/external_campaign.rb +7 -0
- data/lib/twilio-ruby/rest/messaging/v1/service.rb +8 -2
- data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb +175 -15
- data/lib/twilio-ruby/rest/supersim/v1/sim.rb +30 -1
- data/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb +231 -0
- data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +15 -6
- data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb +6 -7
- data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +8 -8
- data/lib/twilio-ruby/rest/video/v1/composition.rb +0 -8
- data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +0 -8
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +15 -9
@@ -50,6 +50,10 @@ module Twilio
|
|
50
50
|
# Lists SinkInstance records from the API as a list.
|
51
51
|
# Unlike stream(), this operation is eager and will load `limit` records into
|
52
52
|
# memory before returning.
|
53
|
+
# @param [Boolean] in_use A boolean query parameter filtering the results to
|
54
|
+
# return sinks used/not used by a subscription.
|
55
|
+
# @param [String] status A String query parameter filtering the results by status
|
56
|
+
# `initialized`, `validating`, `active` or `failed`.
|
53
57
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
54
58
|
# guarantees to never return more than limit. Default is no limit
|
55
59
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -57,14 +61,18 @@ module Twilio
|
|
57
61
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
58
62
|
# efficient page size, i.e. min(limit, 1000)
|
59
63
|
# @return [Array] Array of up to limit results
|
60
|
-
def list(limit: nil, page_size: nil)
|
61
|
-
self.stream(limit: limit, page_size: page_size).entries
|
64
|
+
def list(in_use: :unset, status: :unset, limit: nil, page_size: nil)
|
65
|
+
self.stream(in_use: in_use, status: status, limit: limit, page_size: page_size).entries
|
62
66
|
end
|
63
67
|
|
64
68
|
##
|
65
69
|
# Streams SinkInstance records from the API as an Enumerable.
|
66
70
|
# This operation lazily loads records as efficiently as possible until the limit
|
67
71
|
# is reached.
|
72
|
+
# @param [Boolean] in_use A boolean query parameter filtering the results to
|
73
|
+
# return sinks used/not used by a subscription.
|
74
|
+
# @param [String] status A String query parameter filtering the results by status
|
75
|
+
# `initialized`, `validating`, `active` or `failed`.
|
68
76
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
69
77
|
# guarantees to never return more than limit. Default is no limit.
|
70
78
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -72,10 +80,10 @@ module Twilio
|
|
72
80
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
73
81
|
# efficient page size, i.e. min(limit, 1000)
|
74
82
|
# @return [Enumerable] Enumerable that will yield up to limit results
|
75
|
-
def stream(limit: nil, page_size: nil)
|
83
|
+
def stream(in_use: :unset, status: :unset, limit: nil, page_size: nil)
|
76
84
|
limits = @version.read_limits(limit, page_size)
|
77
85
|
|
78
|
-
page = self.page(page_size: limits[:page_size], )
|
86
|
+
page = self.page(in_use: in_use, status: status, page_size: limits[:page_size], )
|
79
87
|
|
80
88
|
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
81
89
|
end
|
@@ -97,12 +105,18 @@ module Twilio
|
|
97
105
|
##
|
98
106
|
# Retrieve a single page of SinkInstance records from the API.
|
99
107
|
# Request is executed immediately.
|
108
|
+
# @param [Boolean] in_use A boolean query parameter filtering the results to
|
109
|
+
# return sinks used/not used by a subscription.
|
110
|
+
# @param [String] status A String query parameter filtering the results by status
|
111
|
+
# `initialized`, `validating`, `active` or `failed`.
|
100
112
|
# @param [String] page_token PageToken provided by the API
|
101
113
|
# @param [Integer] page_number Page Number, this value is simply for client state
|
102
114
|
# @param [Integer] page_size Number of records to return, defaults to 50
|
103
115
|
# @return [Page] Page of SinkInstance
|
104
|
-
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
116
|
+
def page(in_use: :unset, status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
105
117
|
params = Twilio::Values.of({
|
118
|
+
'InUse' => in_use,
|
119
|
+
'Status' => status,
|
106
120
|
'PageToken' => page_token,
|
107
121
|
'Page' => page_number,
|
108
122
|
'PageSize' => page_size,
|
@@ -119,8 +119,10 @@ module Twilio
|
|
119
119
|
# `facebook`, `sms`, `whatsapp`, `line` or `custom`.
|
120
120
|
# @param [String] contact_identity The channel contact's Identity.
|
121
121
|
# @param [Boolean] enabled Whether the new Flex Flow is enabled.
|
122
|
-
# @param [flex_flow.IntegrationType] integration_type The
|
123
|
-
#
|
122
|
+
# @param [flex_flow.IntegrationType] integration_type The software that will
|
123
|
+
# handle inbound messages. {Integration
|
124
|
+
# Type}[https://www.twilio.com/docs/flex/developer/messaging/manage-flows#integration-types]
|
125
|
+
# can be: `studio`, `external`, or `task`.
|
124
126
|
# @param [String] integration_flow_sid The SID of the Studio Flow. Required when
|
125
127
|
# `integrationType` is `studio`.
|
126
128
|
# @param [String] integration_url The URL of the external webhook. Required when
|
@@ -129,9 +131,9 @@ module Twilio
|
|
129
131
|
# Required when `integrationType` is `task`.
|
130
132
|
# @param [String] integration_workflow_sid The Workflow SID for a new Task.
|
131
133
|
# Required when `integrationType` is `task`.
|
132
|
-
# @param [String] integration_channel The Task Channel
|
133
|
-
# that will be created. Applicable and required
|
134
|
-
#
|
134
|
+
# @param [String] integration_channel The Task Channel SID (TCXXXX) or unique name
|
135
|
+
# (e.g., `sms`) to use for the Task that will be created. Applicable and required
|
136
|
+
# when `integrationType` is `task`. The default value is `default`.
|
135
137
|
# @param [String] integration_timeout The Task timeout in seconds for a new Task.
|
136
138
|
# Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`,
|
137
139
|
# not applicable otherwise.
|
@@ -150,8 +152,8 @@ module Twilio
|
|
150
152
|
# will remove active Proxy sessions if the associated Task is deleted outside of
|
151
153
|
# the Flex UI. Defaults to `false`.
|
152
154
|
# @param [String] integration_retry_count The number of times to retry the webhook
|
153
|
-
# if the first attempt fails. Can be an integer between 0 and 3 (
|
154
|
-
# default is
|
155
|
+
# if the first attempt fails. Can be an integer between 0 and 3 (inclusive),
|
156
|
+
# default is 3. Optional when `integrationType` is `external`, not applicable
|
155
157
|
# otherwise.
|
156
158
|
# @return [FlexFlowInstance] Created FlexFlowInstance
|
157
159
|
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, janitor_enabled: :unset, integration_retry_count: :unset)
|
@@ -248,8 +250,10 @@ module Twilio
|
|
248
250
|
# `facebook`, `sms`, `whatsapp`, `line` or `custom`.
|
249
251
|
# @param [String] contact_identity The channel contact's Identity.
|
250
252
|
# @param [Boolean] enabled Whether the new Flex Flow is enabled.
|
251
|
-
# @param [flex_flow.IntegrationType] integration_type The
|
252
|
-
#
|
253
|
+
# @param [flex_flow.IntegrationType] integration_type The software that will
|
254
|
+
# handle inbound messages. {Integration
|
255
|
+
# Type}[https://www.twilio.com/docs/flex/developer/messaging/manage-flows#integration-types]
|
256
|
+
# can be: `studio`, `external`, or `task`.
|
253
257
|
# @param [String] integration_flow_sid The SID of the Studio Flow. Required when
|
254
258
|
# `integrationType` is `studio`.
|
255
259
|
# @param [String] integration_url The URL of the external webhook. Required when
|
@@ -258,9 +262,9 @@ module Twilio
|
|
258
262
|
# Required when `integrationType` is `task`.
|
259
263
|
# @param [String] integration_workflow_sid The Workflow SID for a new Task.
|
260
264
|
# Required when `integrationType` is `task`.
|
261
|
-
# @param [String] integration_channel The Task Channel
|
262
|
-
# that will be created. Applicable and required
|
263
|
-
#
|
265
|
+
# @param [String] integration_channel The Task Channel SID (TCXXXX) or unique name
|
266
|
+
# (e.g., `sms`) to use for the Task that will be created. Applicable and required
|
267
|
+
# when `integrationType` is `task`. The default value is `default`.
|
264
268
|
# @param [String] integration_timeout The Task timeout in seconds for a new Task.
|
265
269
|
# Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`,
|
266
270
|
# not applicable otherwise.
|
@@ -279,8 +283,8 @@ module Twilio
|
|
279
283
|
# will remove active Proxy sessions if the associated Task is deleted outside of
|
280
284
|
# the Flex UI. Defaults to `false`.
|
281
285
|
# @param [String] integration_retry_count The number of times to retry the webhook
|
282
|
-
# if the first attempt fails. Can be an integer between 0 and 3 (
|
283
|
-
# default is
|
286
|
+
# if the first attempt fails. Can be an integer between 0 and 3 (inclusive),
|
287
|
+
# default is 3. Optional when `integrationType` is `external`, not applicable
|
284
288
|
# otherwise.
|
285
289
|
# @return [FlexFlowInstance] Updated FlexFlowInstance
|
286
290
|
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, janitor_enabled: :unset, integration_retry_count: :unset)
|
@@ -430,7 +434,7 @@ module Twilio
|
|
430
434
|
end
|
431
435
|
|
432
436
|
##
|
433
|
-
# @return [flex_flow.IntegrationType] The
|
437
|
+
# @return [flex_flow.IntegrationType] The software that will handle inbound messages.
|
434
438
|
def integration_type
|
435
439
|
@properties['integration_type']
|
436
440
|
end
|
@@ -475,8 +479,10 @@ module Twilio
|
|
475
479
|
# `facebook`, `sms`, `whatsapp`, `line` or `custom`.
|
476
480
|
# @param [String] contact_identity The channel contact's Identity.
|
477
481
|
# @param [Boolean] enabled Whether the new Flex Flow is enabled.
|
478
|
-
# @param [flex_flow.IntegrationType] integration_type The
|
479
|
-
#
|
482
|
+
# @param [flex_flow.IntegrationType] integration_type The software that will
|
483
|
+
# handle inbound messages. {Integration
|
484
|
+
# Type}[https://www.twilio.com/docs/flex/developer/messaging/manage-flows#integration-types]
|
485
|
+
# can be: `studio`, `external`, or `task`.
|
480
486
|
# @param [String] integration_flow_sid The SID of the Studio Flow. Required when
|
481
487
|
# `integrationType` is `studio`.
|
482
488
|
# @param [String] integration_url The URL of the external webhook. Required when
|
@@ -485,9 +491,9 @@ module Twilio
|
|
485
491
|
# Required when `integrationType` is `task`.
|
486
492
|
# @param [String] integration_workflow_sid The Workflow SID for a new Task.
|
487
493
|
# Required when `integrationType` is `task`.
|
488
|
-
# @param [String] integration_channel The Task Channel
|
489
|
-
# that will be created. Applicable and required
|
490
|
-
#
|
494
|
+
# @param [String] integration_channel The Task Channel SID (TCXXXX) or unique name
|
495
|
+
# (e.g., `sms`) to use for the Task that will be created. Applicable and required
|
496
|
+
# when `integrationType` is `task`. The default value is `default`.
|
491
497
|
# @param [String] integration_timeout The Task timeout in seconds for a new Task.
|
492
498
|
# Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`,
|
493
499
|
# not applicable otherwise.
|
@@ -506,8 +512,8 @@ module Twilio
|
|
506
512
|
# will remove active Proxy sessions if the associated Task is deleted outside of
|
507
513
|
# the Flex UI. Defaults to `false`.
|
508
514
|
# @param [String] integration_retry_count The number of times to retry the webhook
|
509
|
-
# if the first attempt fails. Can be an integer between 0 and 3 (
|
510
|
-
# default is
|
515
|
+
# if the first attempt fails. Can be an integer between 0 and 3 (inclusive),
|
516
|
+
# default is 3. Optional when `integrationType` is `external`, not applicable
|
511
517
|
# otherwise.
|
512
518
|
# @return [FlexFlowInstance] Updated FlexFlowInstance
|
513
519
|
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, janitor_enabled: :unset, integration_retry_count: :unset)
|
@@ -0,0 +1,47 @@
|
|
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 FrontlineApi < Domain
|
12
|
+
##
|
13
|
+
# Initialize the FrontlineApi Domain
|
14
|
+
def initialize(twilio)
|
15
|
+
super
|
16
|
+
|
17
|
+
@base_url = 'https://frontline-api.twilio.com'
|
18
|
+
@host = 'frontline-api.twilio.com'
|
19
|
+
@port = 443
|
20
|
+
|
21
|
+
# Versions
|
22
|
+
@v1 = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Version v1 of frontline_api
|
27
|
+
def v1
|
28
|
+
@v1 ||= V1.new self
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
# @param [String] sid The unique string that we created to identify the User
|
33
|
+
# resource.
|
34
|
+
# @return [Twilio::REST::Frontline_api::V1::UserInstance] if sid was passed.
|
35
|
+
# @return [Twilio::REST::Frontline_api::V1::UserList]
|
36
|
+
def users(sid=:unset)
|
37
|
+
self.v1.users(sid)
|
38
|
+
end
|
39
|
+
|
40
|
+
##
|
41
|
+
# Provide a user friendly representation
|
42
|
+
def to_s
|
43
|
+
'#<Twilio::REST::FrontlineApi>'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,45 @@
|
|
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 FrontlineApi
|
12
|
+
class V1 < Version
|
13
|
+
##
|
14
|
+
# Initialize the V1 version of FrontlineApi
|
15
|
+
def initialize(domain)
|
16
|
+
super
|
17
|
+
@version = 'v1'
|
18
|
+
@users = nil
|
19
|
+
end
|
20
|
+
|
21
|
+
##
|
22
|
+
# @param [String] sid The SID of the User resource to fetch. This value can be
|
23
|
+
# either the `sid` or the `identity` of the User resource to fetch.
|
24
|
+
# @return [Twilio::REST::Frontline_api::V1::UserContext] if sid was passed.
|
25
|
+
# @return [Twilio::REST::Frontline_api::V1::UserList]
|
26
|
+
def users(sid=:unset)
|
27
|
+
if sid.nil?
|
28
|
+
raise ArgumentError, 'sid cannot be nil'
|
29
|
+
end
|
30
|
+
if sid == :unset
|
31
|
+
@users ||= UserList.new self
|
32
|
+
else
|
33
|
+
UserContext.new(self, sid)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Provide a user friendly representation
|
39
|
+
def to_s
|
40
|
+
'<Twilio::REST::FrontlineApi::V1>'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,233 @@
|
|
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 FrontlineApi < Domain
|
12
|
+
class V1 < Version
|
13
|
+
##
|
14
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
15
|
+
class UserList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the UserList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [UserList] UserList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Provide a user friendly representation
|
29
|
+
def to_s
|
30
|
+
'#<Twilio.FrontlineApi.V1.UserList>'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
36
|
+
class UserPage < Page
|
37
|
+
##
|
38
|
+
# Initialize the UserPage
|
39
|
+
# @param [Version] version Version that contains the resource
|
40
|
+
# @param [Response] response Response from the API
|
41
|
+
# @param [Hash] solution Path solution for the resource
|
42
|
+
# @return [UserPage] UserPage
|
43
|
+
def initialize(version, response, solution)
|
44
|
+
super(version, response)
|
45
|
+
|
46
|
+
# Path Solution
|
47
|
+
@solution = solution
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# Build an instance of UserInstance
|
52
|
+
# @param [Hash] payload Payload response from the API
|
53
|
+
# @return [UserInstance] UserInstance
|
54
|
+
def get_instance(payload)
|
55
|
+
UserInstance.new(@version, payload, )
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# Provide a user friendly representation
|
60
|
+
def to_s
|
61
|
+
'<Twilio.FrontlineApi.V1.UserPage>'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
67
|
+
class UserContext < InstanceContext
|
68
|
+
##
|
69
|
+
# Initialize the UserContext
|
70
|
+
# @param [Version] version Version that contains the resource
|
71
|
+
# @param [String] sid The SID of the User resource to fetch. This value can be
|
72
|
+
# either the `sid` or the `identity` of the User resource to fetch.
|
73
|
+
# @return [UserContext] UserContext
|
74
|
+
def initialize(version, sid)
|
75
|
+
super(version)
|
76
|
+
|
77
|
+
# Path Solution
|
78
|
+
@solution = {sid: sid, }
|
79
|
+
@uri = "/Users/#{@solution[:sid]}"
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Fetch the UserInstance
|
84
|
+
# @return [UserInstance] Fetched UserInstance
|
85
|
+
def fetch
|
86
|
+
payload = @version.fetch('GET', @uri)
|
87
|
+
|
88
|
+
UserInstance.new(@version, payload, sid: @solution[:sid], )
|
89
|
+
end
|
90
|
+
|
91
|
+
##
|
92
|
+
# Update the UserInstance
|
93
|
+
# @param [String] friendly_name The string that you assigned to describe the User.
|
94
|
+
# @param [String] avatar The avatar URL which will be shown in Frontline
|
95
|
+
# application.
|
96
|
+
# @param [user.StateType] state Current state of this user. Can be either `active`
|
97
|
+
# or `deactivated` and defaults to `active`
|
98
|
+
# @return [UserInstance] Updated UserInstance
|
99
|
+
def update(friendly_name: :unset, avatar: :unset, state: :unset)
|
100
|
+
data = Twilio::Values.of({'FriendlyName' => friendly_name, 'Avatar' => avatar, 'State' => state, })
|
101
|
+
|
102
|
+
payload = @version.update('POST', @uri, data: data)
|
103
|
+
|
104
|
+
UserInstance.new(@version, payload, sid: @solution[:sid], )
|
105
|
+
end
|
106
|
+
|
107
|
+
##
|
108
|
+
# Provide a user friendly representation
|
109
|
+
def to_s
|
110
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
111
|
+
"#<Twilio.FrontlineApi.V1.UserContext #{context}>"
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# Provide a detailed, user friendly representation
|
116
|
+
def inspect
|
117
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
118
|
+
"#<Twilio.FrontlineApi.V1.UserContext #{context}>"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
##
|
123
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
124
|
+
class UserInstance < InstanceResource
|
125
|
+
##
|
126
|
+
# Initialize the UserInstance
|
127
|
+
# @param [Version] version Version that contains the resource
|
128
|
+
# @param [Hash] payload payload that contains response from Twilio
|
129
|
+
# @param [String] sid The SID of the User resource to fetch. This value can be
|
130
|
+
# either the `sid` or the `identity` of the User resource to fetch.
|
131
|
+
# @return [UserInstance] UserInstance
|
132
|
+
def initialize(version, payload, sid: nil)
|
133
|
+
super(version)
|
134
|
+
|
135
|
+
# Marshaled Properties
|
136
|
+
@properties = {
|
137
|
+
'sid' => payload['sid'],
|
138
|
+
'identity' => payload['identity'],
|
139
|
+
'friendly_name' => payload['friendly_name'],
|
140
|
+
'avatar' => payload['avatar'],
|
141
|
+
'state' => payload['state'],
|
142
|
+
'url' => payload['url'],
|
143
|
+
}
|
144
|
+
|
145
|
+
# Context
|
146
|
+
@instance_context = nil
|
147
|
+
@params = {'sid' => sid || @properties['sid'], }
|
148
|
+
end
|
149
|
+
|
150
|
+
##
|
151
|
+
# Generate an instance context for the instance, the context is capable of
|
152
|
+
# performing various actions. All instance actions are proxied to the context
|
153
|
+
# @return [UserContext] UserContext for this UserInstance
|
154
|
+
def context
|
155
|
+
unless @instance_context
|
156
|
+
@instance_context = UserContext.new(@version, @params['sid'], )
|
157
|
+
end
|
158
|
+
@instance_context
|
159
|
+
end
|
160
|
+
|
161
|
+
##
|
162
|
+
# @return [String] The unique string that identifies the resource
|
163
|
+
def sid
|
164
|
+
@properties['sid']
|
165
|
+
end
|
166
|
+
|
167
|
+
##
|
168
|
+
# @return [String] The string that identifies the resource's User
|
169
|
+
def identity
|
170
|
+
@properties['identity']
|
171
|
+
end
|
172
|
+
|
173
|
+
##
|
174
|
+
# @return [String] The string that you assigned to describe the User
|
175
|
+
def friendly_name
|
176
|
+
@properties['friendly_name']
|
177
|
+
end
|
178
|
+
|
179
|
+
##
|
180
|
+
# @return [String] The avatar URL which will be shown in Frontline application
|
181
|
+
def avatar
|
182
|
+
@properties['avatar']
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# @return [user.StateType] Current state of this user
|
187
|
+
def state
|
188
|
+
@properties['state']
|
189
|
+
end
|
190
|
+
|
191
|
+
##
|
192
|
+
# @return [String] An absolute URL for this user.
|
193
|
+
def url
|
194
|
+
@properties['url']
|
195
|
+
end
|
196
|
+
|
197
|
+
##
|
198
|
+
# Fetch the UserInstance
|
199
|
+
# @return [UserInstance] Fetched UserInstance
|
200
|
+
def fetch
|
201
|
+
context.fetch
|
202
|
+
end
|
203
|
+
|
204
|
+
##
|
205
|
+
# Update the UserInstance
|
206
|
+
# @param [String] friendly_name The string that you assigned to describe the User.
|
207
|
+
# @param [String] avatar The avatar URL which will be shown in Frontline
|
208
|
+
# application.
|
209
|
+
# @param [user.StateType] state Current state of this user. Can be either `active`
|
210
|
+
# or `deactivated` and defaults to `active`
|
211
|
+
# @return [UserInstance] Updated UserInstance
|
212
|
+
def update(friendly_name: :unset, avatar: :unset, state: :unset)
|
213
|
+
context.update(friendly_name: friendly_name, avatar: avatar, state: state, )
|
214
|
+
end
|
215
|
+
|
216
|
+
##
|
217
|
+
# Provide a user friendly representation
|
218
|
+
def to_s
|
219
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
220
|
+
"<Twilio.FrontlineApi.V1.UserInstance #{values}>"
|
221
|
+
end
|
222
|
+
|
223
|
+
##
|
224
|
+
# Provide a detailed, user friendly representation
|
225
|
+
def inspect
|
226
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
227
|
+
"<Twilio.FrontlineApi.V1.UserInstance #{values}>"
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|