twilio-ruby 5.63.1 → 5.65.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test-and-deploy.yml +7 -2
- data/CHANGES.md +81 -0
- data/README.md +3 -2
- data/lib/twilio-ruby/rest/api/v2010/account/call/siprec.rb +7 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call/stream.rb +674 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +26 -0
- data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +27 -7
- data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +10 -4
- data/lib/twilio-ruby/rest/conversations/v1/address_configuration.rb +447 -0
- data/lib/twilio-ruby/rest/conversations/v1.rb +17 -0
- data/lib/twilio-ruby/rest/conversations.rb +9 -0
- data/lib/twilio-ruby/rest/fax/v1/fax.rb +0 -77
- data/lib/twilio-ruby/rest/insights/v1/conference/conference_participant.rb +56 -65
- data/lib/twilio-ruby/rest/insights/v1/conference.rb +82 -54
- data/lib/twilio-ruby/rest/insights/v1.rb +1 -1
- data/lib/twilio-ruby/rest/insights.rb +1 -1
- data/lib/twilio-ruby/rest/media/v1/media_recording.rb +385 -0
- data/lib/twilio-ruby/rest/media/v1.rb +16 -0
- data/lib/twilio-ruby/rest/media.rb +9 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +75 -18
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +7 -0
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +71 -30
- data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +1 -1
- data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +9 -9
- data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +18 -1
- data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +22 -4
- data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +7 -0
- data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +16 -6
- data/lib/twilio-ruby/rest/verify/v2/template.rb +1 -1
- data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +89 -21
- data/lib/twilio-ruby/rest/verify.rb +2 -2
- data/lib/twilio-ruby/rest/video/v1/room.rb +7 -4
- data/lib/twilio-ruby/version.rb +1 -1
- data/lib/twilio-ruby.rb +1 -1
- metadata +5 -2
@@ -443,6 +443,7 @@ module Twilio
|
|
443
443
|
@events = nil
|
444
444
|
@payments = nil
|
445
445
|
@siprec = nil
|
446
|
+
@streams = nil
|
446
447
|
end
|
447
448
|
|
448
449
|
##
|
@@ -617,6 +618,24 @@ module Twilio
|
|
617
618
|
@siprec
|
618
619
|
end
|
619
620
|
|
621
|
+
##
|
622
|
+
# Access the streams
|
623
|
+
# @return [StreamList]
|
624
|
+
# @return [StreamContext] if sid was passed.
|
625
|
+
def streams(sid=:unset)
|
626
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
627
|
+
|
628
|
+
if sid != :unset
|
629
|
+
return StreamContext.new(@version, @solution[:account_sid], @solution[:sid], sid, )
|
630
|
+
end
|
631
|
+
|
632
|
+
unless @streams
|
633
|
+
@streams = StreamList.new(@version, account_sid: @solution[:account_sid], call_sid: @solution[:sid], )
|
634
|
+
end
|
635
|
+
|
636
|
+
@streams
|
637
|
+
end
|
638
|
+
|
620
639
|
##
|
621
640
|
# Provide a user friendly representation
|
622
641
|
def to_s
|
@@ -958,6 +977,13 @@ module Twilio
|
|
958
977
|
context.siprec
|
959
978
|
end
|
960
979
|
|
980
|
+
##
|
981
|
+
# Access the streams
|
982
|
+
# @return [streams] streams
|
983
|
+
def streams
|
984
|
+
context.streams
|
985
|
+
end
|
986
|
+
|
961
987
|
##
|
962
988
|
# Provide a user friendly representation
|
963
989
|
def to_s
|
@@ -39,6 +39,9 @@ module Twilio
|
|
39
39
|
# to read.
|
40
40
|
# @param [String] conference_sid The Conference SID that identifies the conference
|
41
41
|
# associated with the recording to read.
|
42
|
+
# @param [Boolean] include_soft_deleted A boolean parameter indicating whether to
|
43
|
+
# retrieve soft deleted recordings or not. Recordings are kept after deletion for
|
44
|
+
# a retention period of 40 days.
|
42
45
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
43
46
|
# guarantees to never return more than limit. Default is no limit
|
44
47
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -46,13 +49,14 @@ module Twilio
|
|
46
49
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
47
50
|
# efficient page size, i.e. min(limit, 1000)
|
48
51
|
# @return [Array] Array of up to limit results
|
49
|
-
def list(date_created_before: :unset, date_created: :unset, date_created_after: :unset, call_sid: :unset, conference_sid: :unset, limit: nil, page_size: nil)
|
52
|
+
def list(date_created_before: :unset, date_created: :unset, date_created_after: :unset, call_sid: :unset, conference_sid: :unset, include_soft_deleted: :unset, limit: nil, page_size: nil)
|
50
53
|
self.stream(
|
51
54
|
date_created_before: date_created_before,
|
52
55
|
date_created: date_created,
|
53
56
|
date_created_after: date_created_after,
|
54
57
|
call_sid: call_sid,
|
55
58
|
conference_sid: conference_sid,
|
59
|
+
include_soft_deleted: include_soft_deleted,
|
56
60
|
limit: limit,
|
57
61
|
page_size: page_size
|
58
62
|
).entries
|
@@ -70,6 +74,9 @@ module Twilio
|
|
70
74
|
# to read.
|
71
75
|
# @param [String] conference_sid The Conference SID that identifies the conference
|
72
76
|
# associated with the recording to read.
|
77
|
+
# @param [Boolean] include_soft_deleted A boolean parameter indicating whether to
|
78
|
+
# retrieve soft deleted recordings or not. Recordings are kept after deletion for
|
79
|
+
# a retention period of 40 days.
|
73
80
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
74
81
|
# guarantees to never return more than limit. Default is no limit.
|
75
82
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -77,7 +84,7 @@ module Twilio
|
|
77
84
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
78
85
|
# efficient page size, i.e. min(limit, 1000)
|
79
86
|
# @return [Enumerable] Enumerable that will yield up to limit results
|
80
|
-
def stream(date_created_before: :unset, date_created: :unset, date_created_after: :unset, call_sid: :unset, conference_sid: :unset, limit: nil, page_size: nil)
|
87
|
+
def stream(date_created_before: :unset, date_created: :unset, date_created_after: :unset, call_sid: :unset, conference_sid: :unset, include_soft_deleted: :unset, limit: nil, page_size: nil)
|
81
88
|
limits = @version.read_limits(limit, page_size)
|
82
89
|
|
83
90
|
page = self.page(
|
@@ -86,6 +93,7 @@ module Twilio
|
|
86
93
|
date_created_after: date_created_after,
|
87
94
|
call_sid: call_sid,
|
88
95
|
conference_sid: conference_sid,
|
96
|
+
include_soft_deleted: include_soft_deleted,
|
89
97
|
page_size: limits[:page_size],
|
90
98
|
)
|
91
99
|
|
@@ -117,17 +125,21 @@ module Twilio
|
|
117
125
|
# to read.
|
118
126
|
# @param [String] conference_sid The Conference SID that identifies the conference
|
119
127
|
# associated with the recording to read.
|
128
|
+
# @param [Boolean] include_soft_deleted A boolean parameter indicating whether to
|
129
|
+
# retrieve soft deleted recordings or not. Recordings are kept after deletion for
|
130
|
+
# a retention period of 40 days.
|
120
131
|
# @param [String] page_token PageToken provided by the API
|
121
132
|
# @param [Integer] page_number Page Number, this value is simply for client state
|
122
133
|
# @param [Integer] page_size Number of records to return, defaults to 50
|
123
134
|
# @return [Page] Page of RecordingInstance
|
124
|
-
def page(date_created_before: :unset, date_created: :unset, date_created_after: :unset, call_sid: :unset, conference_sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
135
|
+
def page(date_created_before: :unset, date_created: :unset, date_created_after: :unset, call_sid: :unset, conference_sid: :unset, include_soft_deleted: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
125
136
|
params = Twilio::Values.of({
|
126
137
|
'DateCreated<' => Twilio.serialize_iso8601_datetime(date_created_before),
|
127
138
|
'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
|
128
139
|
'DateCreated>' => Twilio.serialize_iso8601_datetime(date_created_after),
|
129
140
|
'CallSid' => call_sid,
|
130
141
|
'ConferenceSid' => conference_sid,
|
142
|
+
'IncludeSoftDeleted' => include_soft_deleted,
|
131
143
|
'PageToken' => page_token,
|
132
144
|
'Page' => page_number,
|
133
145
|
'PageSize' => page_size,
|
@@ -211,9 +223,14 @@ module Twilio
|
|
211
223
|
|
212
224
|
##
|
213
225
|
# Fetch the RecordingInstance
|
226
|
+
# @param [Boolean] include_soft_deleted A boolean parameter indicating whether to
|
227
|
+
# retrieve soft deleted recordings or not. Recordings are kept after deletion for
|
228
|
+
# a retention period of 40 days.
|
214
229
|
# @return [RecordingInstance] Fetched RecordingInstance
|
215
|
-
def fetch
|
216
|
-
|
230
|
+
def fetch(include_soft_deleted: :unset)
|
231
|
+
params = Twilio::Values.of({'IncludeSoftDeleted' => include_soft_deleted, })
|
232
|
+
|
233
|
+
payload = @version.fetch('GET', @uri, params: params)
|
217
234
|
|
218
235
|
RecordingInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], )
|
219
236
|
end
|
@@ -446,9 +463,12 @@ module Twilio
|
|
446
463
|
|
447
464
|
##
|
448
465
|
# Fetch the RecordingInstance
|
466
|
+
# @param [Boolean] include_soft_deleted A boolean parameter indicating whether to
|
467
|
+
# retrieve soft deleted recordings or not. Recordings are kept after deletion for
|
468
|
+
# a retention period of 40 days.
|
449
469
|
# @return [RecordingInstance] Fetched RecordingInstance
|
450
|
-
def fetch
|
451
|
-
context.fetch
|
470
|
+
def fetch(include_soft_deleted: :unset)
|
471
|
+
context.fetch(include_soft_deleted: include_soft_deleted, )
|
452
472
|
end
|
453
473
|
|
454
474
|
##
|
@@ -193,9 +193,13 @@ module Twilio
|
|
193
193
|
|
194
194
|
##
|
195
195
|
# Delete the UserChannelInstance
|
196
|
+
# @param [user_channel.WebhookEnabledType] x_twilio_webhook_enabled The
|
197
|
+
# X-Twilio-Webhook-Enabled HTTP request header
|
196
198
|
# @return [Boolean] true if delete succeeds, false otherwise
|
197
|
-
def delete
|
198
|
-
|
199
|
+
def delete(x_twilio_webhook_enabled: :unset)
|
200
|
+
headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
|
201
|
+
|
202
|
+
@version.delete('DELETE', @uri, headers: headers)
|
199
203
|
end
|
200
204
|
|
201
205
|
##
|
@@ -377,9 +381,11 @@ module Twilio
|
|
377
381
|
|
378
382
|
##
|
379
383
|
# Delete the UserChannelInstance
|
384
|
+
# @param [user_channel.WebhookEnabledType] x_twilio_webhook_enabled The
|
385
|
+
# X-Twilio-Webhook-Enabled HTTP request header
|
380
386
|
# @return [Boolean] true if delete succeeds, false otherwise
|
381
|
-
def delete
|
382
|
-
context.delete
|
387
|
+
def delete(x_twilio_webhook_enabled: :unset)
|
388
|
+
context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, )
|
383
389
|
end
|
384
390
|
|
385
391
|
##
|
@@ -0,0 +1,447 @@
|
|
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 AddressConfigurationList < ListResource
|
14
|
+
##
|
15
|
+
# Initialize the AddressConfigurationList
|
16
|
+
# @param [Version] version Version that contains the resource
|
17
|
+
# @return [AddressConfigurationList] AddressConfigurationList
|
18
|
+
def initialize(version)
|
19
|
+
super(version)
|
20
|
+
|
21
|
+
# Path Solution
|
22
|
+
@solution = {}
|
23
|
+
@uri = "/Configuration/Addresses"
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Lists AddressConfigurationInstance 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 [Integer] limit Upper limit for the number of records to return. stream()
|
31
|
+
# guarantees to never return more than limit. Default is no limit
|
32
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
33
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
34
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
35
|
+
# efficient page size, i.e. min(limit, 1000)
|
36
|
+
# @return [Array] Array of up to limit results
|
37
|
+
def list(limit: nil, page_size: nil)
|
38
|
+
self.stream(limit: limit, page_size: page_size).entries
|
39
|
+
end
|
40
|
+
|
41
|
+
##
|
42
|
+
# Streams AddressConfigurationInstance records from the API as an Enumerable.
|
43
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
44
|
+
# is reached.
|
45
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
46
|
+
# guarantees to never return more than limit. Default is no limit.
|
47
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
48
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
49
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
50
|
+
# efficient page size, i.e. min(limit, 1000)
|
51
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
52
|
+
def stream(limit: nil, page_size: nil)
|
53
|
+
limits = @version.read_limits(limit, page_size)
|
54
|
+
|
55
|
+
page = self.page(page_size: limits[:page_size], )
|
56
|
+
|
57
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
58
|
+
end
|
59
|
+
|
60
|
+
##
|
61
|
+
# When passed a block, yields AddressConfigurationInstance records from the API.
|
62
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
63
|
+
# is reached.
|
64
|
+
def each
|
65
|
+
limits = @version.read_limits
|
66
|
+
|
67
|
+
page = self.page(page_size: limits[:page_size], )
|
68
|
+
|
69
|
+
@version.stream(page,
|
70
|
+
limit: limits[:limit],
|
71
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
72
|
+
end
|
73
|
+
|
74
|
+
##
|
75
|
+
# Retrieve a single page of AddressConfigurationInstance records from the API.
|
76
|
+
# Request is executed immediately.
|
77
|
+
# @param [String] page_token PageToken provided by the API
|
78
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
79
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
80
|
+
# @return [Page] Page of AddressConfigurationInstance
|
81
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
82
|
+
params = Twilio::Values.of({
|
83
|
+
'PageToken' => page_token,
|
84
|
+
'Page' => page_number,
|
85
|
+
'PageSize' => page_size,
|
86
|
+
})
|
87
|
+
|
88
|
+
response = @version.page('GET', @uri, params: params)
|
89
|
+
|
90
|
+
AddressConfigurationPage.new(@version, response, @solution)
|
91
|
+
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# Retrieve a single page of AddressConfigurationInstance records from the API.
|
95
|
+
# Request is executed immediately.
|
96
|
+
# @param [String] target_url API-generated URL for the requested results page
|
97
|
+
# @return [Page] Page of AddressConfigurationInstance
|
98
|
+
def get_page(target_url)
|
99
|
+
response = @version.domain.request(
|
100
|
+
'GET',
|
101
|
+
target_url
|
102
|
+
)
|
103
|
+
AddressConfigurationPage.new(@version, response, @solution)
|
104
|
+
end
|
105
|
+
|
106
|
+
##
|
107
|
+
# Create the AddressConfigurationInstance
|
108
|
+
# @param [address_configuration.Type] type Type of Address. Value can be
|
109
|
+
# `whatsapp` or `sms`.
|
110
|
+
# @param [String] address The unique address to be configured. The address can be
|
111
|
+
# a whatsapp address or phone number
|
112
|
+
# @param [String] friendly_name The human-readable name of this configuration,
|
113
|
+
# limited to 256 characters. Optional.
|
114
|
+
# @param [Boolean] auto_creation_enabled Enable/Disable auto-creating
|
115
|
+
# conversations for messages to this address
|
116
|
+
# @param [address_configuration.AutoCreationType] auto_creation_type Type of Auto
|
117
|
+
# Creation. Value can be one of `webhook`, `studio` or `default`.
|
118
|
+
# @param [String] auto_creation_conversation_service_sid Conversation Service for
|
119
|
+
# the auto-created conversation. If not set, the conversation is created in the
|
120
|
+
# default service.
|
121
|
+
# @param [String] auto_creation_webhook_url For type `webhook`, the url for the
|
122
|
+
# webhook request.
|
123
|
+
# @param [address_configuration.Method] auto_creation_webhook_method For type
|
124
|
+
# `webhook`, the HTTP method to be used when sending a webhook request.
|
125
|
+
# @param [Array[String]] auto_creation_webhook_filters The list of events, firing
|
126
|
+
# webhook event for this Conversation. Values can be any of the following:
|
127
|
+
# `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`,
|
128
|
+
# `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`,
|
129
|
+
# `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`,
|
130
|
+
# `onDeliveryUpdated`
|
131
|
+
# @param [String] auto_creation_studio_flow_sid For type `studio`, the studio flow
|
132
|
+
# SID where the webhook should be sent to.
|
133
|
+
# @param [String] auto_creation_studio_retry_count For type `studio`, number of
|
134
|
+
# times to retry the webhook request
|
135
|
+
# @return [AddressConfigurationInstance] Created AddressConfigurationInstance
|
136
|
+
def create(type: nil, address: nil, friendly_name: :unset, auto_creation_enabled: :unset, auto_creation_type: :unset, auto_creation_conversation_service_sid: :unset, auto_creation_webhook_url: :unset, auto_creation_webhook_method: :unset, auto_creation_webhook_filters: :unset, auto_creation_studio_flow_sid: :unset, auto_creation_studio_retry_count: :unset)
|
137
|
+
data = Twilio::Values.of({
|
138
|
+
'Type' => type,
|
139
|
+
'Address' => address,
|
140
|
+
'FriendlyName' => friendly_name,
|
141
|
+
'AutoCreation.Enabled' => auto_creation_enabled,
|
142
|
+
'AutoCreation.Type' => auto_creation_type,
|
143
|
+
'AutoCreation.ConversationServiceSid' => auto_creation_conversation_service_sid,
|
144
|
+
'AutoCreation.WebhookUrl' => auto_creation_webhook_url,
|
145
|
+
'AutoCreation.WebhookMethod' => auto_creation_webhook_method,
|
146
|
+
'AutoCreation.WebhookFilters' => Twilio.serialize_list(auto_creation_webhook_filters) { |e| e },
|
147
|
+
'AutoCreation.StudioFlowSid' => auto_creation_studio_flow_sid,
|
148
|
+
'AutoCreation.StudioRetryCount' => auto_creation_studio_retry_count,
|
149
|
+
})
|
150
|
+
|
151
|
+
payload = @version.create('POST', @uri, data: data)
|
152
|
+
|
153
|
+
AddressConfigurationInstance.new(@version, payload, )
|
154
|
+
end
|
155
|
+
|
156
|
+
##
|
157
|
+
# Provide a user friendly representation
|
158
|
+
def to_s
|
159
|
+
'#<Twilio.Conversations.V1.AddressConfigurationList>'
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
class AddressConfigurationPage < Page
|
164
|
+
##
|
165
|
+
# Initialize the AddressConfigurationPage
|
166
|
+
# @param [Version] version Version that contains the resource
|
167
|
+
# @param [Response] response Response from the API
|
168
|
+
# @param [Hash] solution Path solution for the resource
|
169
|
+
# @return [AddressConfigurationPage] AddressConfigurationPage
|
170
|
+
def initialize(version, response, solution)
|
171
|
+
super(version, response)
|
172
|
+
|
173
|
+
# Path Solution
|
174
|
+
@solution = solution
|
175
|
+
end
|
176
|
+
|
177
|
+
##
|
178
|
+
# Build an instance of AddressConfigurationInstance
|
179
|
+
# @param [Hash] payload Payload response from the API
|
180
|
+
# @return [AddressConfigurationInstance] AddressConfigurationInstance
|
181
|
+
def get_instance(payload)
|
182
|
+
AddressConfigurationInstance.new(@version, payload, )
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# Provide a user friendly representation
|
187
|
+
def to_s
|
188
|
+
'<Twilio.Conversations.V1.AddressConfigurationPage>'
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
class AddressConfigurationContext < InstanceContext
|
193
|
+
##
|
194
|
+
# Initialize the AddressConfigurationContext
|
195
|
+
# @param [Version] version Version that contains the resource
|
196
|
+
# @param [String] sid The SID of the Address Configuration resource. This value
|
197
|
+
# can be either the `sid` or the `address` of the configuration
|
198
|
+
# @return [AddressConfigurationContext] AddressConfigurationContext
|
199
|
+
def initialize(version, sid)
|
200
|
+
super(version)
|
201
|
+
|
202
|
+
# Path Solution
|
203
|
+
@solution = {sid: sid, }
|
204
|
+
@uri = "/Configuration/Addresses/#{@solution[:sid]}"
|
205
|
+
end
|
206
|
+
|
207
|
+
##
|
208
|
+
# Fetch the AddressConfigurationInstance
|
209
|
+
# @return [AddressConfigurationInstance] Fetched AddressConfigurationInstance
|
210
|
+
def fetch
|
211
|
+
payload = @version.fetch('GET', @uri)
|
212
|
+
|
213
|
+
AddressConfigurationInstance.new(@version, payload, sid: @solution[:sid], )
|
214
|
+
end
|
215
|
+
|
216
|
+
##
|
217
|
+
# Update the AddressConfigurationInstance
|
218
|
+
# @param [String] friendly_name The human-readable name of this configuration,
|
219
|
+
# limited to 256 characters. Optional.
|
220
|
+
# @param [Boolean] auto_creation_enabled Enable/Disable auto-creating
|
221
|
+
# conversations for messages to this address
|
222
|
+
# @param [address_configuration.AutoCreationType] auto_creation_type Type of Auto
|
223
|
+
# Creation. Value can be one of `webhook`, `studio` or `default`.
|
224
|
+
# @param [String] auto_creation_conversation_service_sid Conversation Service for
|
225
|
+
# the auto-created conversation. If not set, the conversation is created in the
|
226
|
+
# default service.
|
227
|
+
# @param [String] auto_creation_webhook_url For type `webhook`, the url for the
|
228
|
+
# webhook request.
|
229
|
+
# @param [address_configuration.Method] auto_creation_webhook_method For type
|
230
|
+
# `webhook`, the HTTP method to be used when sending a webhook request.
|
231
|
+
# @param [Array[String]] auto_creation_webhook_filters The list of events, firing
|
232
|
+
# webhook event for this Conversation. Values can be any of the following:
|
233
|
+
# `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`,
|
234
|
+
# `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`,
|
235
|
+
# `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`,
|
236
|
+
# `onDeliveryUpdated`
|
237
|
+
# @param [String] auto_creation_studio_flow_sid For type `studio`, the studio flow
|
238
|
+
# SID where the webhook should be sent to.
|
239
|
+
# @param [String] auto_creation_studio_retry_count For type `studio`, number of
|
240
|
+
# times to retry the webhook request
|
241
|
+
# @return [AddressConfigurationInstance] Updated AddressConfigurationInstance
|
242
|
+
def update(friendly_name: :unset, auto_creation_enabled: :unset, auto_creation_type: :unset, auto_creation_conversation_service_sid: :unset, auto_creation_webhook_url: :unset, auto_creation_webhook_method: :unset, auto_creation_webhook_filters: :unset, auto_creation_studio_flow_sid: :unset, auto_creation_studio_retry_count: :unset)
|
243
|
+
data = Twilio::Values.of({
|
244
|
+
'FriendlyName' => friendly_name,
|
245
|
+
'AutoCreation.Enabled' => auto_creation_enabled,
|
246
|
+
'AutoCreation.Type' => auto_creation_type,
|
247
|
+
'AutoCreation.ConversationServiceSid' => auto_creation_conversation_service_sid,
|
248
|
+
'AutoCreation.WebhookUrl' => auto_creation_webhook_url,
|
249
|
+
'AutoCreation.WebhookMethod' => auto_creation_webhook_method,
|
250
|
+
'AutoCreation.WebhookFilters' => Twilio.serialize_list(auto_creation_webhook_filters) { |e| e },
|
251
|
+
'AutoCreation.StudioFlowSid' => auto_creation_studio_flow_sid,
|
252
|
+
'AutoCreation.StudioRetryCount' => auto_creation_studio_retry_count,
|
253
|
+
})
|
254
|
+
|
255
|
+
payload = @version.update('POST', @uri, data: data)
|
256
|
+
|
257
|
+
AddressConfigurationInstance.new(@version, payload, sid: @solution[:sid], )
|
258
|
+
end
|
259
|
+
|
260
|
+
##
|
261
|
+
# Delete the AddressConfigurationInstance
|
262
|
+
# @return [Boolean] true if delete succeeds, false otherwise
|
263
|
+
def delete
|
264
|
+
@version.delete('DELETE', @uri)
|
265
|
+
end
|
266
|
+
|
267
|
+
##
|
268
|
+
# Provide a user friendly representation
|
269
|
+
def to_s
|
270
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
271
|
+
"#<Twilio.Conversations.V1.AddressConfigurationContext #{context}>"
|
272
|
+
end
|
273
|
+
|
274
|
+
##
|
275
|
+
# Provide a detailed, user friendly representation
|
276
|
+
def inspect
|
277
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
278
|
+
"#<Twilio.Conversations.V1.AddressConfigurationContext #{context}>"
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
class AddressConfigurationInstance < InstanceResource
|
283
|
+
##
|
284
|
+
# Initialize the AddressConfigurationInstance
|
285
|
+
# @param [Version] version Version that contains the resource
|
286
|
+
# @param [Hash] payload payload that contains response from Twilio
|
287
|
+
# @param [String] sid The SID of the Address Configuration resource. This value
|
288
|
+
# can be either the `sid` or the `address` of the configuration
|
289
|
+
# @return [AddressConfigurationInstance] AddressConfigurationInstance
|
290
|
+
def initialize(version, payload, sid: nil)
|
291
|
+
super(version)
|
292
|
+
|
293
|
+
# Marshaled Properties
|
294
|
+
@properties = {
|
295
|
+
'sid' => payload['sid'],
|
296
|
+
'account_sid' => payload['account_sid'],
|
297
|
+
'type' => payload['type'],
|
298
|
+
'address' => payload['address'],
|
299
|
+
'friendly_name' => payload['friendly_name'],
|
300
|
+
'auto_creation' => payload['auto_creation'],
|
301
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
302
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
303
|
+
'url' => payload['url'],
|
304
|
+
}
|
305
|
+
|
306
|
+
# Context
|
307
|
+
@instance_context = nil
|
308
|
+
@params = {'sid' => sid || @properties['sid'], }
|
309
|
+
end
|
310
|
+
|
311
|
+
##
|
312
|
+
# Generate an instance context for the instance, the context is capable of
|
313
|
+
# performing various actions. All instance actions are proxied to the context
|
314
|
+
# @return [AddressConfigurationContext] AddressConfigurationContext for this AddressConfigurationInstance
|
315
|
+
def context
|
316
|
+
unless @instance_context
|
317
|
+
@instance_context = AddressConfigurationContext.new(@version, @params['sid'], )
|
318
|
+
end
|
319
|
+
@instance_context
|
320
|
+
end
|
321
|
+
|
322
|
+
##
|
323
|
+
# @return [String] A 34 character string that uniquely identifies this resource.
|
324
|
+
def sid
|
325
|
+
@properties['sid']
|
326
|
+
end
|
327
|
+
|
328
|
+
##
|
329
|
+
# @return [String] The unique ID of the Account the address belongs to.
|
330
|
+
def account_sid
|
331
|
+
@properties['account_sid']
|
332
|
+
end
|
333
|
+
|
334
|
+
##
|
335
|
+
# @return [String] Type of Address.
|
336
|
+
def type
|
337
|
+
@properties['type']
|
338
|
+
end
|
339
|
+
|
340
|
+
##
|
341
|
+
# @return [String] The unique address to be configured.
|
342
|
+
def address
|
343
|
+
@properties['address']
|
344
|
+
end
|
345
|
+
|
346
|
+
##
|
347
|
+
# @return [String] The human-readable name of this configuration.
|
348
|
+
def friendly_name
|
349
|
+
@properties['friendly_name']
|
350
|
+
end
|
351
|
+
|
352
|
+
##
|
353
|
+
# @return [Hash] Auto Creation configuration for the address.
|
354
|
+
def auto_creation
|
355
|
+
@properties['auto_creation']
|
356
|
+
end
|
357
|
+
|
358
|
+
##
|
359
|
+
# @return [Time] The date that this resource was created.
|
360
|
+
def date_created
|
361
|
+
@properties['date_created']
|
362
|
+
end
|
363
|
+
|
364
|
+
##
|
365
|
+
# @return [Time] The date that this resource was last updated.
|
366
|
+
def date_updated
|
367
|
+
@properties['date_updated']
|
368
|
+
end
|
369
|
+
|
370
|
+
##
|
371
|
+
# @return [String] An absolute URL for this address configuration.
|
372
|
+
def url
|
373
|
+
@properties['url']
|
374
|
+
end
|
375
|
+
|
376
|
+
##
|
377
|
+
# Fetch the AddressConfigurationInstance
|
378
|
+
# @return [AddressConfigurationInstance] Fetched AddressConfigurationInstance
|
379
|
+
def fetch
|
380
|
+
context.fetch
|
381
|
+
end
|
382
|
+
|
383
|
+
##
|
384
|
+
# Update the AddressConfigurationInstance
|
385
|
+
# @param [String] friendly_name The human-readable name of this configuration,
|
386
|
+
# limited to 256 characters. Optional.
|
387
|
+
# @param [Boolean] auto_creation_enabled Enable/Disable auto-creating
|
388
|
+
# conversations for messages to this address
|
389
|
+
# @param [address_configuration.AutoCreationType] auto_creation_type Type of Auto
|
390
|
+
# Creation. Value can be one of `webhook`, `studio` or `default`.
|
391
|
+
# @param [String] auto_creation_conversation_service_sid Conversation Service for
|
392
|
+
# the auto-created conversation. If not set, the conversation is created in the
|
393
|
+
# default service.
|
394
|
+
# @param [String] auto_creation_webhook_url For type `webhook`, the url for the
|
395
|
+
# webhook request.
|
396
|
+
# @param [address_configuration.Method] auto_creation_webhook_method For type
|
397
|
+
# `webhook`, the HTTP method to be used when sending a webhook request.
|
398
|
+
# @param [Array[String]] auto_creation_webhook_filters The list of events, firing
|
399
|
+
# webhook event for this Conversation. Values can be any of the following:
|
400
|
+
# `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`,
|
401
|
+
# `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`,
|
402
|
+
# `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`,
|
403
|
+
# `onDeliveryUpdated`
|
404
|
+
# @param [String] auto_creation_studio_flow_sid For type `studio`, the studio flow
|
405
|
+
# SID where the webhook should be sent to.
|
406
|
+
# @param [String] auto_creation_studio_retry_count For type `studio`, number of
|
407
|
+
# times to retry the webhook request
|
408
|
+
# @return [AddressConfigurationInstance] Updated AddressConfigurationInstance
|
409
|
+
def update(friendly_name: :unset, auto_creation_enabled: :unset, auto_creation_type: :unset, auto_creation_conversation_service_sid: :unset, auto_creation_webhook_url: :unset, auto_creation_webhook_method: :unset, auto_creation_webhook_filters: :unset, auto_creation_studio_flow_sid: :unset, auto_creation_studio_retry_count: :unset)
|
410
|
+
context.update(
|
411
|
+
friendly_name: friendly_name,
|
412
|
+
auto_creation_enabled: auto_creation_enabled,
|
413
|
+
auto_creation_type: auto_creation_type,
|
414
|
+
auto_creation_conversation_service_sid: auto_creation_conversation_service_sid,
|
415
|
+
auto_creation_webhook_url: auto_creation_webhook_url,
|
416
|
+
auto_creation_webhook_method: auto_creation_webhook_method,
|
417
|
+
auto_creation_webhook_filters: auto_creation_webhook_filters,
|
418
|
+
auto_creation_studio_flow_sid: auto_creation_studio_flow_sid,
|
419
|
+
auto_creation_studio_retry_count: auto_creation_studio_retry_count,
|
420
|
+
)
|
421
|
+
end
|
422
|
+
|
423
|
+
##
|
424
|
+
# Delete the AddressConfigurationInstance
|
425
|
+
# @return [Boolean] true if delete succeeds, false otherwise
|
426
|
+
def delete
|
427
|
+
context.delete
|
428
|
+
end
|
429
|
+
|
430
|
+
##
|
431
|
+
# Provide a user friendly representation
|
432
|
+
def to_s
|
433
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
434
|
+
"<Twilio.Conversations.V1.AddressConfigurationInstance #{values}>"
|
435
|
+
end
|
436
|
+
|
437
|
+
##
|
438
|
+
# Provide a detailed, user friendly representation
|
439
|
+
def inspect
|
440
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
441
|
+
"<Twilio.Conversations.V1.AddressConfigurationInstance #{values}>"
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
end
|
446
|
+
end
|
447
|
+
end
|
@@ -16,6 +16,7 @@ module Twilio
|
|
16
16
|
super
|
17
17
|
@version = 'v1'
|
18
18
|
@configuration = nil
|
19
|
+
@address_configurations = nil
|
19
20
|
@conversations = nil
|
20
21
|
@credentials = nil
|
21
22
|
@participant_conversations = nil
|
@@ -30,6 +31,22 @@ module Twilio
|
|
30
31
|
@configuration ||= ConfigurationContext.new self
|
31
32
|
end
|
32
33
|
|
34
|
+
##
|
35
|
+
# @param [String] sid The SID of the Address Configuration resource. This value
|
36
|
+
# can be either the `sid` or the `address` of the configuration
|
37
|
+
# @return [Twilio::REST::Conversations::V1::AddressConfigurationContext] if sid was passed.
|
38
|
+
# @return [Twilio::REST::Conversations::V1::AddressConfigurationList]
|
39
|
+
def address_configurations(sid=:unset)
|
40
|
+
if sid.nil?
|
41
|
+
raise ArgumentError, 'sid cannot be nil'
|
42
|
+
end
|
43
|
+
if sid == :unset
|
44
|
+
@address_configurations ||= AddressConfigurationList.new self
|
45
|
+
else
|
46
|
+
AddressConfigurationContext.new(self, sid)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
33
50
|
##
|
34
51
|
# @param [String] sid A 34 character string that uniquely identifies this
|
35
52
|
# resource. Can also be the `unique_name` of the Conversation.
|
@@ -34,6 +34,15 @@ module Twilio
|
|
34
34
|
self.v1.configuration()
|
35
35
|
end
|
36
36
|
|
37
|
+
##
|
38
|
+
# @param [String] sid A 34 character string that uniquely identifies this
|
39
|
+
# resource.
|
40
|
+
# @return [Twilio::REST::Conversations::V1::AddressConfigurationInstance] if sid was passed.
|
41
|
+
# @return [Twilio::REST::Conversations::V1::AddressConfigurationList]
|
42
|
+
def address_configurations(sid=:unset)
|
43
|
+
self.v1.address_configurations(sid)
|
44
|
+
end
|
45
|
+
|
37
46
|
##
|
38
47
|
# @param [String] sid A 34 character string that uniquely identifies this
|
39
48
|
# resource.
|