twilio-ruby 5.39.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/.travis.yml +1 -1
- data/CHANGES.md +107 -1
- data/CONTRIBUTING.md +2 -2
- data/ISSUE_TEMPLATE.md +5 -1
- data/PULL_REQUEST_TEMPLATE.md +1 -1
- data/README.md +4 -3
- data/lib/twilio-ruby/framework/version.rb +4 -8
- data/lib/twilio-ruby/rest/api/v2010/account/application.rb +6 -4
- 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 +85 -60
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +5 -2
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +14 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +14 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +14 -0
- 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/client.rb +7 -0
- data/lib/twilio-ruby/rest/conversations.rb +39 -3
- data/lib/twilio-ruby/rest/conversations/v1.rb +68 -5
- data/lib/twilio-ruby/rest/conversations/v1/configuration.rb +268 -0
- data/lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb +262 -0
- data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +21 -10
- data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +13 -10
- data/lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb +34 -19
- data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +48 -32
- data/lib/twilio-ruby/rest/conversations/v1/conversation/webhook.rb +14 -11
- data/lib/twilio-ruby/rest/conversations/v1/credential.rb +427 -0
- data/lib/twilio-ruby/rest/conversations/v1/role.rb +374 -0
- data/lib/twilio-ruby/rest/conversations/v1/service.rb +442 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/binding.rb +388 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +271 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +315 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +586 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +549 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb +394 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb +519 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb +457 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/role.rb +395 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +419 -0
- data/lib/twilio-ruby/rest/conversations/v1/user.rb +398 -0
- data/lib/twilio-ruby/rest/events.rb +72 -0
- data/lib/twilio-ruby/rest/events/v1.rb +90 -0
- data/lib/twilio-ruby/rest/events/v1/event_type.rb +291 -0
- 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/sink.rb +380 -0
- data/lib/twilio-ruby/rest/events/v1/sink/sink_test.rb +115 -0
- data/lib/twilio-ruby/rest/events/v1/sink/sink_validate.rb +119 -0
- data/lib/twilio-ruby/rest/events/v1/subscription.rb +383 -0
- data/lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb +216 -0
- data/lib/twilio-ruby/rest/fax/v1/fax.rb +2 -1
- data/lib/twilio-ruby/rest/messaging.rb +6 -0
- data/lib/twilio-ruby/rest/messaging/v1.rb +7 -0
- data/lib/twilio-ruby/rest/messaging/v1/deactivation.rb +164 -0
- 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/numbers/v2/regulatory_compliance.rb +3 -3
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user.rb +16 -2
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +18 -4
- 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/proxy/v1/service/session.rb +45 -4
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +14 -1
- data/lib/twilio-ruby/rest/serverless/v1/service.rb +13 -13
- data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +6 -6
- data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +5 -5
- data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +8 -8
- data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +6 -8
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +8 -8
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +14 -14
- data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +4 -4
- data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +7 -7
- data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb +1 -1
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +12 -11
- data/lib/twilio-ruby/rest/supersim/v1/sim.rb +17 -7
- data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +75 -9
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +2 -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 +38 -23
- 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.rb +21 -9
- data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +10 -2
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +7 -2
- 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/video/v1/room/room_participant/room_participant_subscribe_rule.rb +0 -6
- 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/rest/wireless/v1/sim/data_session.rb +5 -19
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/framework/version_spec.rb +53 -0
- data/spec/holodeck/holodeck.rb +3 -3
- data/spec/integration/api/v2010/account/incoming_phone_number/local_spec.rb +35 -36
- data/spec/integration/api/v2010/account/incoming_phone_number/mobile_spec.rb +39 -40
- data/spec/integration/api/v2010/account/incoming_phone_number/toll_free_spec.rb +35 -36
- data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +25 -23
- data/spec/integration/api/v2010/account/message_spec.rb +37 -0
- data/spec/integration/bulkexports/v1/export/day_spec.rb +5 -5
- data/spec/integration/bulkexports/v1/export_configuration_spec.rb +4 -4
- data/spec/integration/bulkexports/v1/export_spec.rb +3 -3
- data/spec/integration/conversations/v1/{webhook_spec.rb → configuration/webhook_spec.rb} +12 -8
- data/spec/integration/conversations/v1/configuration_spec.rb +87 -0
- data/spec/integration/conversations/v1/conversation/message/delivery_receipt_spec.rb +4 -0
- data/spec/integration/conversations/v1/conversation/message_spec.rb +38 -0
- data/spec/integration/conversations/v1/conversation/participant_spec.rb +60 -4
- data/spec/integration/conversations/v1/conversation_spec.rb +35 -0
- data/spec/integration/conversations/v1/credential_spec.rb +219 -0
- data/spec/integration/conversations/v1/role_spec.rb +249 -0
- data/spec/integration/conversations/v1/service/binding_spec.rb +166 -0
- data/spec/integration/conversations/v1/service/configuration/notification_spec.rb +115 -0
- data/spec/integration/conversations/v1/service/configuration_spec.rb +87 -0
- data/spec/integration/conversations/v1/service/conversation/message/delivery_receipt_spec.rb +144 -0
- data/spec/integration/conversations/v1/service/conversation/message_spec.rb +429 -0
- data/spec/integration/conversations/v1/service/conversation/participant_spec.rb +407 -0
- data/spec/integration/conversations/v1/service/conversation/webhook_spec.rb +299 -0
- data/spec/integration/conversations/v1/service/conversation_spec.rb +289 -0
- data/spec/integration/conversations/v1/service/role_spec.rb +260 -0
- data/spec/integration/conversations/v1/service/user_spec.rb +230 -0
- data/spec/integration/conversations/v1/service_spec.rb +174 -0
- data/spec/integration/conversations/v1/user_spec.rb +220 -0
- data/spec/integration/events/v1/event_type_spec.rb +133 -0
- 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/sink/sink_test_spec.rb +42 -0
- data/spec/integration/events/v1/sink/sink_validate_spec.rb +44 -0
- data/spec/integration/events/v1/sink_spec.rb +217 -0
- data/spec/integration/events/v1/subscription/subscribed_event_spec.rb +91 -0
- data/spec/integration/events/v1/subscription_spec.rb +243 -0
- data/spec/integration/messaging/v1/deactivation_spec.rb +40 -0
- data/spec/integration/numbers/v2/regulatory_compliance/end_user_spec.rb +27 -0
- data/spec/integration/numbers/v2/regulatory_compliance/supporting_document_spec.rb +27 -0
- data/spec/integration/studio/v1/flow/execution/execution_step_spec.rb +1 -0
- data/spec/integration/studio/v2/flow/execution/execution_step_spec.rb +1 -0
- data/spec/integration/supersim/v1/sim_spec.rb +23 -0
- data/spec/integration/supersim/v1/usage_record_spec.rb +463 -18
- data/spec/integration/trunking/v1/trunk/recording_spec.rb +79 -0
- data/spec/integration/trunking/v1/trunk_spec.rb +4 -0
- data/spec/integration/verify/v2/service/access_token_spec.rb +1 -1
- data/spec/integration/verify/v2/service/entity/challenge_spec.rb +8 -8
- data/spec/integration/video/v1/room_spec.rb +37 -0
- data/spec/integration/wireless/v1/sim/data_session_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +82 -5
- data/lib/twilio-ruby/rest/conversations/v1/webhook.rb +0 -262
@@ -0,0 +1,398 @@
|
|
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
|
+
##
|
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
|
+
@uri = "/Users"
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Create the UserInstance
|
30
|
+
# @param [String] identity The application-defined string that uniquely identifies
|
31
|
+
# the resource's User within the [Conversation
|
32
|
+
# Service](https://www.twilio.com/docs/conversations/api/service-resource). This
|
33
|
+
# value is often a username or an email address, and is case-sensitive.
|
34
|
+
# @param [String] friendly_name The string that you assigned to describe the
|
35
|
+
# resource.
|
36
|
+
# @param [String] attributes The JSON Object string that stores
|
37
|
+
# application-specific data. If attributes have not been set, `{}` is returned.
|
38
|
+
# @param [String] role_sid The SID of a service-level
|
39
|
+
# [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to
|
40
|
+
# the user.
|
41
|
+
# @return [UserInstance] Created UserInstance
|
42
|
+
def create(identity: nil, friendly_name: :unset, attributes: :unset, role_sid: :unset)
|
43
|
+
data = Twilio::Values.of({
|
44
|
+
'Identity' => identity,
|
45
|
+
'FriendlyName' => friendly_name,
|
46
|
+
'Attributes' => attributes,
|
47
|
+
'RoleSid' => role_sid,
|
48
|
+
})
|
49
|
+
|
50
|
+
payload = @version.create('POST', @uri, data: data)
|
51
|
+
|
52
|
+
UserInstance.new(@version, payload, )
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# Lists UserInstance records from the API as a list.
|
57
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
58
|
+
# memory before returning.
|
59
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
60
|
+
# guarantees to never return more than limit. Default is no limit
|
61
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
62
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
63
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
64
|
+
# efficient page size, i.e. min(limit, 1000)
|
65
|
+
# @return [Array] Array of up to limit results
|
66
|
+
def list(limit: nil, page_size: nil)
|
67
|
+
self.stream(limit: limit, page_size: page_size).entries
|
68
|
+
end
|
69
|
+
|
70
|
+
##
|
71
|
+
# Streams UserInstance records from the API as an Enumerable.
|
72
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
73
|
+
# is reached.
|
74
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
75
|
+
# guarantees to never return more than limit. Default is no limit.
|
76
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
77
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
78
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
79
|
+
# efficient page size, i.e. min(limit, 1000)
|
80
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
81
|
+
def stream(limit: nil, page_size: nil)
|
82
|
+
limits = @version.read_limits(limit, page_size)
|
83
|
+
|
84
|
+
page = self.page(page_size: limits[:page_size], )
|
85
|
+
|
86
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
87
|
+
end
|
88
|
+
|
89
|
+
##
|
90
|
+
# When passed a block, yields UserInstance records from the API.
|
91
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
92
|
+
# is reached.
|
93
|
+
def each
|
94
|
+
limits = @version.read_limits
|
95
|
+
|
96
|
+
page = self.page(page_size: limits[:page_size], )
|
97
|
+
|
98
|
+
@version.stream(page,
|
99
|
+
limit: limits[:limit],
|
100
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
101
|
+
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# Retrieve a single page of UserInstance records from the API.
|
105
|
+
# Request is executed immediately.
|
106
|
+
# @param [String] page_token PageToken provided by the API
|
107
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
108
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
109
|
+
# @return [Page] Page of UserInstance
|
110
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
111
|
+
params = Twilio::Values.of({
|
112
|
+
'PageToken' => page_token,
|
113
|
+
'Page' => page_number,
|
114
|
+
'PageSize' => page_size,
|
115
|
+
})
|
116
|
+
|
117
|
+
response = @version.page('GET', @uri, params: params)
|
118
|
+
|
119
|
+
UserPage.new(@version, response, @solution)
|
120
|
+
end
|
121
|
+
|
122
|
+
##
|
123
|
+
# Retrieve a single page of UserInstance records from the API.
|
124
|
+
# Request is executed immediately.
|
125
|
+
# @param [String] target_url API-generated URL for the requested results page
|
126
|
+
# @return [Page] Page of UserInstance
|
127
|
+
def get_page(target_url)
|
128
|
+
response = @version.domain.request(
|
129
|
+
'GET',
|
130
|
+
target_url
|
131
|
+
)
|
132
|
+
UserPage.new(@version, response, @solution)
|
133
|
+
end
|
134
|
+
|
135
|
+
##
|
136
|
+
# Provide a user friendly representation
|
137
|
+
def to_s
|
138
|
+
'#<Twilio.Conversations.V1.UserList>'
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
##
|
143
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
144
|
+
class UserPage < Page
|
145
|
+
##
|
146
|
+
# Initialize the UserPage
|
147
|
+
# @param [Version] version Version that contains the resource
|
148
|
+
# @param [Response] response Response from the API
|
149
|
+
# @param [Hash] solution Path solution for the resource
|
150
|
+
# @return [UserPage] UserPage
|
151
|
+
def initialize(version, response, solution)
|
152
|
+
super(version, response)
|
153
|
+
|
154
|
+
# Path Solution
|
155
|
+
@solution = solution
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# Build an instance of UserInstance
|
160
|
+
# @param [Hash] payload Payload response from the API
|
161
|
+
# @return [UserInstance] UserInstance
|
162
|
+
def get_instance(payload)
|
163
|
+
UserInstance.new(@version, payload, )
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# Provide a user friendly representation
|
168
|
+
def to_s
|
169
|
+
'<Twilio.Conversations.V1.UserPage>'
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
##
|
174
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
175
|
+
class UserContext < InstanceContext
|
176
|
+
##
|
177
|
+
# Initialize the UserContext
|
178
|
+
# @param [Version] version Version that contains the resource
|
179
|
+
# @param [String] sid The SID of the User resource to fetch. This value can be
|
180
|
+
# either the `sid` or the `identity` of the User resource to fetch.
|
181
|
+
# @return [UserContext] UserContext
|
182
|
+
def initialize(version, sid)
|
183
|
+
super(version)
|
184
|
+
|
185
|
+
# Path Solution
|
186
|
+
@solution = {sid: sid, }
|
187
|
+
@uri = "/Users/#{@solution[:sid]}"
|
188
|
+
end
|
189
|
+
|
190
|
+
##
|
191
|
+
# Update the UserInstance
|
192
|
+
# @param [String] friendly_name The string that you assigned to describe the
|
193
|
+
# resource.
|
194
|
+
# @param [String] attributes The JSON Object string that stores
|
195
|
+
# application-specific data. If attributes have not been set, `{}` is returned.
|
196
|
+
# @param [String] role_sid The SID of a service-level
|
197
|
+
# [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to
|
198
|
+
# the user.
|
199
|
+
# @return [UserInstance] Updated UserInstance
|
200
|
+
def update(friendly_name: :unset, attributes: :unset, role_sid: :unset)
|
201
|
+
data = Twilio::Values.of({
|
202
|
+
'FriendlyName' => friendly_name,
|
203
|
+
'Attributes' => attributes,
|
204
|
+
'RoleSid' => role_sid,
|
205
|
+
})
|
206
|
+
|
207
|
+
payload = @version.update('POST', @uri, data: data)
|
208
|
+
|
209
|
+
UserInstance.new(@version, payload, sid: @solution[:sid], )
|
210
|
+
end
|
211
|
+
|
212
|
+
##
|
213
|
+
# Delete the UserInstance
|
214
|
+
# @return [Boolean] true if delete succeeds, false otherwise
|
215
|
+
def delete
|
216
|
+
@version.delete('DELETE', @uri)
|
217
|
+
end
|
218
|
+
|
219
|
+
##
|
220
|
+
# Fetch the UserInstance
|
221
|
+
# @return [UserInstance] Fetched UserInstance
|
222
|
+
def fetch
|
223
|
+
payload = @version.fetch('GET', @uri)
|
224
|
+
|
225
|
+
UserInstance.new(@version, payload, sid: @solution[:sid], )
|
226
|
+
end
|
227
|
+
|
228
|
+
##
|
229
|
+
# Provide a user friendly representation
|
230
|
+
def to_s
|
231
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
232
|
+
"#<Twilio.Conversations.V1.UserContext #{context}>"
|
233
|
+
end
|
234
|
+
|
235
|
+
##
|
236
|
+
# Provide a detailed, user friendly representation
|
237
|
+
def inspect
|
238
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
239
|
+
"#<Twilio.Conversations.V1.UserContext #{context}>"
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
##
|
244
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
245
|
+
class UserInstance < InstanceResource
|
246
|
+
##
|
247
|
+
# Initialize the UserInstance
|
248
|
+
# @param [Version] version Version that contains the resource
|
249
|
+
# @param [Hash] payload payload that contains response from Twilio
|
250
|
+
# @param [String] sid The SID of the User resource to fetch. This value can be
|
251
|
+
# either the `sid` or the `identity` of the User resource to fetch.
|
252
|
+
# @return [UserInstance] UserInstance
|
253
|
+
def initialize(version, payload, sid: nil)
|
254
|
+
super(version)
|
255
|
+
|
256
|
+
# Marshaled Properties
|
257
|
+
@properties = {
|
258
|
+
'sid' => payload['sid'],
|
259
|
+
'account_sid' => payload['account_sid'],
|
260
|
+
'chat_service_sid' => payload['chat_service_sid'],
|
261
|
+
'role_sid' => payload['role_sid'],
|
262
|
+
'identity' => payload['identity'],
|
263
|
+
'friendly_name' => payload['friendly_name'],
|
264
|
+
'attributes' => payload['attributes'],
|
265
|
+
'is_online' => payload['is_online'],
|
266
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
267
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
268
|
+
'url' => payload['url'],
|
269
|
+
}
|
270
|
+
|
271
|
+
# Context
|
272
|
+
@instance_context = nil
|
273
|
+
@params = {'sid' => sid || @properties['sid'], }
|
274
|
+
end
|
275
|
+
|
276
|
+
##
|
277
|
+
# Generate an instance context for the instance, the context is capable of
|
278
|
+
# performing various actions. All instance actions are proxied to the context
|
279
|
+
# @return [UserContext] UserContext for this UserInstance
|
280
|
+
def context
|
281
|
+
unless @instance_context
|
282
|
+
@instance_context = UserContext.new(@version, @params['sid'], )
|
283
|
+
end
|
284
|
+
@instance_context
|
285
|
+
end
|
286
|
+
|
287
|
+
##
|
288
|
+
# @return [String] The unique string that identifies the resource
|
289
|
+
def sid
|
290
|
+
@properties['sid']
|
291
|
+
end
|
292
|
+
|
293
|
+
##
|
294
|
+
# @return [String] The SID of the Account that created the resource
|
295
|
+
def account_sid
|
296
|
+
@properties['account_sid']
|
297
|
+
end
|
298
|
+
|
299
|
+
##
|
300
|
+
# @return [String] The SID of the Conversation Service that the resource is associated with
|
301
|
+
def chat_service_sid
|
302
|
+
@properties['chat_service_sid']
|
303
|
+
end
|
304
|
+
|
305
|
+
##
|
306
|
+
# @return [String] The SID of a service-level Role assigned to the user
|
307
|
+
def role_sid
|
308
|
+
@properties['role_sid']
|
309
|
+
end
|
310
|
+
|
311
|
+
##
|
312
|
+
# @return [String] The string that identifies the resource's User
|
313
|
+
def identity
|
314
|
+
@properties['identity']
|
315
|
+
end
|
316
|
+
|
317
|
+
##
|
318
|
+
# @return [String] The string that you assigned to describe the resource
|
319
|
+
def friendly_name
|
320
|
+
@properties['friendly_name']
|
321
|
+
end
|
322
|
+
|
323
|
+
##
|
324
|
+
# @return [String] The JSON Object string that stores application-specific data
|
325
|
+
def attributes
|
326
|
+
@properties['attributes']
|
327
|
+
end
|
328
|
+
|
329
|
+
##
|
330
|
+
# @return [Boolean] Whether the User is actively connected to the Service instance and online
|
331
|
+
def is_online
|
332
|
+
@properties['is_online']
|
333
|
+
end
|
334
|
+
|
335
|
+
##
|
336
|
+
# @return [Time] The ISO 8601 date and time in GMT when the resource was created
|
337
|
+
def date_created
|
338
|
+
@properties['date_created']
|
339
|
+
end
|
340
|
+
|
341
|
+
##
|
342
|
+
# @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
|
343
|
+
def date_updated
|
344
|
+
@properties['date_updated']
|
345
|
+
end
|
346
|
+
|
347
|
+
##
|
348
|
+
# @return [String] The absolute URL of the User resource
|
349
|
+
def url
|
350
|
+
@properties['url']
|
351
|
+
end
|
352
|
+
|
353
|
+
##
|
354
|
+
# Update the UserInstance
|
355
|
+
# @param [String] friendly_name The string that you assigned to describe the
|
356
|
+
# resource.
|
357
|
+
# @param [String] attributes The JSON Object string that stores
|
358
|
+
# application-specific data. If attributes have not been set, `{}` is returned.
|
359
|
+
# @param [String] role_sid The SID of a service-level
|
360
|
+
# [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to
|
361
|
+
# the user.
|
362
|
+
# @return [UserInstance] Updated UserInstance
|
363
|
+
def update(friendly_name: :unset, attributes: :unset, role_sid: :unset)
|
364
|
+
context.update(friendly_name: friendly_name, attributes: attributes, role_sid: role_sid, )
|
365
|
+
end
|
366
|
+
|
367
|
+
##
|
368
|
+
# Delete the UserInstance
|
369
|
+
# @return [Boolean] true if delete succeeds, false otherwise
|
370
|
+
def delete
|
371
|
+
context.delete
|
372
|
+
end
|
373
|
+
|
374
|
+
##
|
375
|
+
# Fetch the UserInstance
|
376
|
+
# @return [UserInstance] Fetched UserInstance
|
377
|
+
def fetch
|
378
|
+
context.fetch
|
379
|
+
end
|
380
|
+
|
381
|
+
##
|
382
|
+
# Provide a user friendly representation
|
383
|
+
def to_s
|
384
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
385
|
+
"<Twilio.Conversations.V1.UserInstance #{values}>"
|
386
|
+
end
|
387
|
+
|
388
|
+
##
|
389
|
+
# Provide a detailed, user friendly representation
|
390
|
+
def inspect
|
391
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
392
|
+
"<Twilio.Conversations.V1.UserInstance #{values}>"
|
393
|
+
end
|
394
|
+
end
|
395
|
+
end
|
396
|
+
end
|
397
|
+
end
|
398
|
+
end
|
@@ -0,0 +1,72 @@
|
|
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 Events < Domain
|
12
|
+
##
|
13
|
+
# Initialize the Events Domain
|
14
|
+
def initialize(twilio)
|
15
|
+
super
|
16
|
+
|
17
|
+
@base_url = 'https://events.twilio.com'
|
18
|
+
@host = 'events.twilio.com'
|
19
|
+
@port = 443
|
20
|
+
|
21
|
+
# Versions
|
22
|
+
@v1 = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Version v1 of events
|
27
|
+
def v1
|
28
|
+
@v1 ||= V1.new self
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
# @param [String] type A string that uniquely identifies this Event Type.
|
33
|
+
# @return [Twilio::REST::Events::V1::EventTypeInstance] if type was passed.
|
34
|
+
# @return [Twilio::REST::Events::V1::EventTypeList]
|
35
|
+
def event_types(type=:unset)
|
36
|
+
self.v1.event_types(type)
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# @param [String] id The unique identifier of the schema. Each schema can have
|
41
|
+
# multiple versions, that share the same id.
|
42
|
+
# @return [Twilio::REST::Events::V1::SchemaInstance] if id was passed.
|
43
|
+
# @return [Twilio::REST::Events::V1::SchemaList]
|
44
|
+
def schemas(id=:unset)
|
45
|
+
self.v1.schemas(id)
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# @param [String] sid A 34 character string that uniquely identifies this Sink.
|
50
|
+
# @return [Twilio::REST::Events::V1::SinkInstance] if sid was passed.
|
51
|
+
# @return [Twilio::REST::Events::V1::SinkList]
|
52
|
+
def sinks(sid=:unset)
|
53
|
+
self.v1.sinks(sid)
|
54
|
+
end
|
55
|
+
|
56
|
+
##
|
57
|
+
# @param [String] sid A 34 character string that uniquely identifies this
|
58
|
+
# Subscription.
|
59
|
+
# @return [Twilio::REST::Events::V1::SubscriptionInstance] if sid was passed.
|
60
|
+
# @return [Twilio::REST::Events::V1::SubscriptionList]
|
61
|
+
def subscriptions(sid=:unset)
|
62
|
+
self.v1.subscriptions(sid)
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Provide a user friendly representation
|
67
|
+
def to_s
|
68
|
+
'#<Twilio::REST::Events>'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|