twilio-ruby 7.11.3 → 7.13.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/CHANGES.md +277 -0
- data/Gemfile.lock +2 -2
- data/README.md +2 -2
- data/examples/WebhookSignatureValidation.md +61 -0
- data/lib/rack/twilio_webhook_authentication.rb +30 -5
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +7 -0
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +4 -4
- data/lib/twilio-ruby/rest/client.rb +5 -0
- data/lib/twilio-ruby/rest/content/v1/content/approval_create.rb +108 -1
- data/lib/twilio-ruby/rest/content/v1/content.rb +10 -4
- data/lib/twilio-ruby/rest/conversations/v2/action.rb +9 -2
- data/lib/twilio-ruby/rest/conversations/v2/communication.rb +4 -1
- data/lib/twilio-ruby/rest/conversations/v2/configuration.rb +21 -0
- data/lib/twilio-ruby/rest/conversations/v2/conversation.rb +226 -7
- data/lib/twilio-ruby/rest/insights/v1/call/call_summary.rb +1 -1
- data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +1 -1
- data/lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb +512 -17
- data/lib/twilio-ruby/rest/insights/v3/{capacity.rb → custom_field_mappings_capacity.rb} +26 -26
- data/lib/twilio-ruby/rest/insights/v3.rb +17 -7
- data/lib/twilio-ruby/rest/memory/v1/bulk.rb +22 -1
- data/lib/twilio-ruby/rest/memory/v1/conversation_summary.rb +5 -5
- data/lib/twilio-ruby/rest/memory/v1/import.rb +21 -7
- data/lib/twilio-ruby/rest/memory/v1/observation.rb +9 -9
- data/lib/twilio-ruby/rest/memory/v1/revision.rb +1 -1
- data/lib/twilio-ruby/rest/memory/v1/store.rb +7 -0
- data/lib/twilio-ruby/rest/messaging/v2/channels_sender.rb +30 -2
- data/lib/twilio-ruby/rest/numbers/v1/sms_verification.rb +30 -6
- data/lib/twilio-ruby/rest/numbers/v1/sms_verification_check.rb +30 -6
- data/lib/twilio-ruby/rest/numbers/v1/voice_verification.rb +45 -6
- data/lib/twilio-ruby/rest/numbers/v1.rb +0 -6
- data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +40 -0
- data/lib/twilio-ruby/rest/routes/v3/iso_country_code.rb +402 -0
- data/lib/twilio-ruby/rest/routes/v3.rb +43 -0
- data/lib/twilio-ruby/rest/trusthub/v1/a2p_brand_registration.rb +5 -5
- data/lib/twilio-ruby/rest/trusthub/v1/a2p_campaign_registration.rb +4 -4
- data/lib/twilio-ruby/rest/trusthub/v1.rb +2 -2
- data/lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb +825 -0
- data/lib/twilio-ruby/rest/webhooks/v1/edge_zone.rb +320 -0
- data/lib/twilio-ruby/rest/webhooks/v1/operation.rb +513 -0
- data/lib/twilio-ruby/rest/webhooks/v1/rule.rb +818 -0
- data/lib/twilio-ruby/rest/webhooks/v1/setting.rb +1028 -0
- data/lib/twilio-ruby/rest/webhooks/v1/shared_key.rb +722 -0
- data/lib/twilio-ruby/rest/webhooks/v1/test.rb +228 -0
- data/lib/twilio-ruby/rest/webhooks/v1.rb +126 -0
- data/lib/twilio-ruby/rest/webhooks.rb +6 -0
- data/lib/twilio-ruby/rest/webhooks_base.rb +38 -0
- data/lib/twilio-ruby/security/request_validator.rb +54 -8
- data/lib/twilio-ruby/twiml/voice_response.rb +20 -5
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +15 -5
- data/lib/twilio-ruby/rest/numbers/v1/voice_verification_check.rb +0 -165
- data/lib/twilio-ruby/rest/oauth/v2/oauth_authorization_server.rb +0 -200
|
@@ -0,0 +1,825 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
6
|
+
#
|
|
7
|
+
# Twilio - Webhooks Configuration
|
|
8
|
+
# Centralized webhook configuration with OAuth2 support, immutable resources, and zero-downtime credential rotation.
|
|
9
|
+
#
|
|
10
|
+
# NOTE: This class is auto generated by OpenAPI Generator.
|
|
11
|
+
# https://openapi-generator.tech
|
|
12
|
+
# Do not edit the class manually.
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
module Twilio
|
|
17
|
+
module REST
|
|
18
|
+
class Webhooks < WebhooksBase
|
|
19
|
+
class V1 < Version
|
|
20
|
+
class AuthProfileList < ListResource
|
|
21
|
+
|
|
22
|
+
class PatchAuthProfile
|
|
23
|
+
# @param [friendly_name]: [String] Human-readable name for identification
|
|
24
|
+
attr_accessor :friendly_name
|
|
25
|
+
def initialize(payload)
|
|
26
|
+
@friendly_name = payload["friendly_name"]
|
|
27
|
+
end
|
|
28
|
+
def to_json(options = {})
|
|
29
|
+
{
|
|
30
|
+
"friendlyName": @friendly_name,
|
|
31
|
+
}.to_json(options)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class PostAuthProfile
|
|
36
|
+
# @param [type]: [String] Authentication type
|
|
37
|
+
# @param [friendly_name]: [String] Human-readable name for identification (optional, defaults to blank)
|
|
38
|
+
# @param [token_url]: [String] OAuth2 token endpoint URL
|
|
39
|
+
# @param [client_id]: [String] OAuth2 client identifier
|
|
40
|
+
# @param [client_secret]: [String] OAuth2 client secret (never returned, stored securely as secret)
|
|
41
|
+
# @param [scope]: [String] OAuth2 scope to request
|
|
42
|
+
# @param [audience]: [String] OAuth2 audience parameter
|
|
43
|
+
# @param [client_credentials_auth_method]: [String] Client credentials authentication method (defaults to CLIENT_SECRET_POST)
|
|
44
|
+
# @param [username]: [String] Digest auth username
|
|
45
|
+
# @param [password]: [String] Digest auth password (never returned, stored securely as secret)
|
|
46
|
+
attr_accessor :type, :friendly_name, :token_url, :client_id, :client_secret, :scope, :audience, :client_credentials_auth_method, :username, :password
|
|
47
|
+
def initialize(payload)
|
|
48
|
+
@type = payload["type"]
|
|
49
|
+
@friendly_name = payload["friendly_name"]
|
|
50
|
+
@token_url = payload["token_url"]
|
|
51
|
+
@client_id = payload["client_id"]
|
|
52
|
+
@client_secret = payload["client_secret"]
|
|
53
|
+
@scope = payload["scope"]
|
|
54
|
+
@audience = payload["audience"]
|
|
55
|
+
@client_credentials_auth_method = payload["client_credentials_auth_method"]
|
|
56
|
+
@username = payload["username"]
|
|
57
|
+
@password = payload["password"]
|
|
58
|
+
end
|
|
59
|
+
def to_json(options = {})
|
|
60
|
+
{
|
|
61
|
+
"type": @type,
|
|
62
|
+
"friendlyName": @friendly_name,
|
|
63
|
+
"tokenUrl": @token_url,
|
|
64
|
+
"clientId": @client_id,
|
|
65
|
+
"clientSecret": @client_secret,
|
|
66
|
+
"scope": @scope,
|
|
67
|
+
"audience": @audience,
|
|
68
|
+
"clientCredentialsAuthMethod": @client_credentials_auth_method,
|
|
69
|
+
"username": @username,
|
|
70
|
+
"password": @password,
|
|
71
|
+
}.to_json(options)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class PatchAuthProfile
|
|
77
|
+
# @param [friendly_name]: [String] Human-readable name for identification
|
|
78
|
+
attr_accessor :friendly_name
|
|
79
|
+
def initialize(payload)
|
|
80
|
+
@friendly_name = payload["friendly_name"]
|
|
81
|
+
end
|
|
82
|
+
def to_json(options = {})
|
|
83
|
+
{
|
|
84
|
+
"friendlyName": @friendly_name,
|
|
85
|
+
}.to_json(options)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
class PostAuthProfile
|
|
90
|
+
# @param [type]: [String] Authentication type
|
|
91
|
+
# @param [friendly_name]: [String] Human-readable name for identification (optional, defaults to blank)
|
|
92
|
+
# @param [token_url]: [String] OAuth2 token endpoint URL
|
|
93
|
+
# @param [client_id]: [String] OAuth2 client identifier
|
|
94
|
+
# @param [client_secret]: [String] OAuth2 client secret (never returned, stored securely as secret)
|
|
95
|
+
# @param [scope]: [String] OAuth2 scope to request
|
|
96
|
+
# @param [audience]: [String] OAuth2 audience parameter
|
|
97
|
+
# @param [client_credentials_auth_method]: [String] Client credentials authentication method (defaults to CLIENT_SECRET_POST)
|
|
98
|
+
# @param [username]: [String] Digest auth username
|
|
99
|
+
# @param [password]: [String] Digest auth password (never returned, stored securely as secret)
|
|
100
|
+
attr_accessor :type, :friendly_name, :token_url, :client_id, :client_secret, :scope, :audience, :client_credentials_auth_method, :username, :password
|
|
101
|
+
def initialize(payload)
|
|
102
|
+
@type = payload["type"]
|
|
103
|
+
@friendly_name = payload["friendly_name"]
|
|
104
|
+
@token_url = payload["token_url"]
|
|
105
|
+
@client_id = payload["client_id"]
|
|
106
|
+
@client_secret = payload["client_secret"]
|
|
107
|
+
@scope = payload["scope"]
|
|
108
|
+
@audience = payload["audience"]
|
|
109
|
+
@client_credentials_auth_method = payload["client_credentials_auth_method"]
|
|
110
|
+
@username = payload["username"]
|
|
111
|
+
@password = payload["password"]
|
|
112
|
+
end
|
|
113
|
+
def to_json(options = {})
|
|
114
|
+
{
|
|
115
|
+
"type": @type,
|
|
116
|
+
"friendlyName": @friendly_name,
|
|
117
|
+
"tokenUrl": @token_url,
|
|
118
|
+
"clientId": @client_id,
|
|
119
|
+
"clientSecret": @client_secret,
|
|
120
|
+
"scope": @scope,
|
|
121
|
+
"audience": @audience,
|
|
122
|
+
"clientCredentialsAuthMethod": @client_credentials_auth_method,
|
|
123
|
+
"username": @username,
|
|
124
|
+
"password": @password,
|
|
125
|
+
}.to_json(options)
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
##
|
|
131
|
+
# Initialize the AuthProfileList
|
|
132
|
+
# @param [Version] version Version that contains the resource
|
|
133
|
+
# @return [AuthProfileList] AuthProfileList
|
|
134
|
+
def initialize(version)
|
|
135
|
+
|
|
136
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
137
|
+
super(apiV1Version)
|
|
138
|
+
# Path Solution
|
|
139
|
+
@solution = { }
|
|
140
|
+
@uri = "/Webhooks/AuthProfiles"
|
|
141
|
+
|
|
142
|
+
end
|
|
143
|
+
##
|
|
144
|
+
# Create the AuthProfileInstance
|
|
145
|
+
# @param [String] idempotency_key Idempotency key for mutation operations. Must be a UUIDv7 (other UUID versions are rejected with a 400).
|
|
146
|
+
# @param [PostAuthProfile] post_auth_profile
|
|
147
|
+
# @return [AuthProfileInstance] Created AuthProfileInstance
|
|
148
|
+
def create(
|
|
149
|
+
idempotency_key: :unset,
|
|
150
|
+
post_auth_profile: nil
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Idempotency-Key' => idempotency_key, })
|
|
154
|
+
headers['Content-Type'] = 'application/json'
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
headers['Accept'] = '*/*'
|
|
159
|
+
payload = @version.create('POST', @uri, headers: headers, data: post_auth_profile.to_json)
|
|
160
|
+
AuthProfileInstance.new(
|
|
161
|
+
@version,
|
|
162
|
+
payload,
|
|
163
|
+
)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
##
|
|
167
|
+
# Create the AuthProfileInstanceMetadata
|
|
168
|
+
# @param [String] idempotency_key Idempotency key for mutation operations. Must be a UUIDv7 (other UUID versions are rejected with a 400).
|
|
169
|
+
# @param [PostAuthProfile] post_auth_profile
|
|
170
|
+
# @return [AuthProfileInstance] Created AuthProfileInstance
|
|
171
|
+
def create_with_metadata(
|
|
172
|
+
idempotency_key: :unset,
|
|
173
|
+
post_auth_profile: nil
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Idempotency-Key' => idempotency_key, })
|
|
177
|
+
headers['Content-Type'] = 'application/json'
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
headers['Accept'] = '*/*'
|
|
182
|
+
response = @version.create_with_metadata('POST', @uri, headers: headers, data: post_auth_profile.to_json)
|
|
183
|
+
auth_profile_instance = AuthProfileInstance.new(
|
|
184
|
+
@version,
|
|
185
|
+
response.body,
|
|
186
|
+
)
|
|
187
|
+
AuthProfileInstanceMetadata.new(
|
|
188
|
+
@version,
|
|
189
|
+
auth_profile_instance,
|
|
190
|
+
response.headers,
|
|
191
|
+
response.status_code
|
|
192
|
+
)
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
##
|
|
197
|
+
# Lists AuthProfileInstance records from the API as a list.
|
|
198
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
|
199
|
+
# memory before returning.
|
|
200
|
+
# @param [String] page_token Token for pagination
|
|
201
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
202
|
+
# guarantees to never return more than limit. Default is no limit
|
|
203
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
204
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
205
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
206
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
207
|
+
# @return [Array] Array of up to limit results
|
|
208
|
+
def list(page_token: :unset, limit: nil, page_size: nil)
|
|
209
|
+
self.stream(
|
|
210
|
+
page_token: page_token,
|
|
211
|
+
limit: limit,
|
|
212
|
+
page_size: page_size
|
|
213
|
+
).entries
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
##
|
|
217
|
+
# Streams Instance records from the API as an Enumerable.
|
|
218
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
219
|
+
# is reached.
|
|
220
|
+
# @param [String] page_token Token for pagination
|
|
221
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
222
|
+
# guarantees to never return more than limit. Default is no limit
|
|
223
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
224
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
225
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
226
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
227
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
228
|
+
def stream(page_token: :unset, limit: nil, page_size: nil)
|
|
229
|
+
limits = @version.read_limits(limit, page_size)
|
|
230
|
+
|
|
231
|
+
page = self.page(
|
|
232
|
+
page_token: page_token,
|
|
233
|
+
page_size: limits[:page_size], )
|
|
234
|
+
|
|
235
|
+
return [].each if page.nil?
|
|
236
|
+
|
|
237
|
+
result = @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
|
238
|
+
return [].each if result.nil?
|
|
239
|
+
result
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
##
|
|
243
|
+
# Lists AuthProfilePageMetadata records from the API as a list.
|
|
244
|
+
# @param [String] page_token Token for pagination
|
|
245
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
246
|
+
# guarantees to never return more than limit. Default is no limit
|
|
247
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
248
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
249
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
250
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
251
|
+
# @return [Array] Array of up to limit results
|
|
252
|
+
def list_with_metadata(page_token: :unset, limit: nil, page_size: nil)
|
|
253
|
+
limits = @version.read_limits(limit, page_size)
|
|
254
|
+
params = Twilio::Values.of({
|
|
255
|
+
'pageToken' => page_token,
|
|
256
|
+
|
|
257
|
+
'PageSize' => limits[:page_size],
|
|
258
|
+
});
|
|
259
|
+
headers = Twilio::Values.of({})
|
|
260
|
+
|
|
261
|
+
response = @version.page('GET', @uri, params: params, headers: headers)
|
|
262
|
+
|
|
263
|
+
AuthProfilePageMetadata.new(@version, response, @solution, limits[:limit])
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
##
|
|
267
|
+
# When passed a block, yields AuthProfileInstance records from the API.
|
|
268
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
269
|
+
# is reached.
|
|
270
|
+
def each
|
|
271
|
+
limits = @version.read_limits
|
|
272
|
+
|
|
273
|
+
page = self.page(page_size: limits[:page_size], )
|
|
274
|
+
|
|
275
|
+
return [].each if page.nil?
|
|
276
|
+
|
|
277
|
+
result = @version.stream(page,
|
|
278
|
+
limit: limits[:limit],
|
|
279
|
+
page_limit: limits[:page_limit])
|
|
280
|
+
return [].each if result.nil?
|
|
281
|
+
result.each {|x| yield x}
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
##
|
|
285
|
+
# Retrieve a single page of AuthProfileInstance records from the API.
|
|
286
|
+
# Request is executed immediately.
|
|
287
|
+
# @param [String] page_token Token for pagination
|
|
288
|
+
|
|
289
|
+
# @return [Page] Page of AuthProfileInstance
|
|
290
|
+
def page(page_token: :unset, page_size: :unset)
|
|
291
|
+
params = Twilio::Values.of({
|
|
292
|
+
'pageToken' => page_token,
|
|
293
|
+
'PageSize' => page_size,
|
|
294
|
+
})
|
|
295
|
+
headers = Twilio::Values.of({})
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
response = @version.page('GET', @uri, params: params, headers: headers)
|
|
300
|
+
|
|
301
|
+
AuthProfilePage.new(@version, response, @solution)
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
##
|
|
305
|
+
# Retrieve a single page of AuthProfileInstance records from the API.
|
|
306
|
+
# Request is executed immediately.
|
|
307
|
+
# @param [String] target_url API-generated URL for the requested results page
|
|
308
|
+
# @return [Page] Page of AuthProfileInstance
|
|
309
|
+
def get_page(target_url)
|
|
310
|
+
response = @version.domain.request(
|
|
311
|
+
'GET',
|
|
312
|
+
target_url
|
|
313
|
+
)
|
|
314
|
+
AuthProfilePage.new(@version, response, @solution)
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
# Provide a user friendly representation
|
|
320
|
+
def to_s
|
|
321
|
+
'#<Twilio.Webhooks.V1.AuthProfileList>'
|
|
322
|
+
end
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
class AuthProfileContext < InstanceContext
|
|
327
|
+
##
|
|
328
|
+
# Initialize the AuthProfileContext
|
|
329
|
+
# @param [Version] version Version that contains the resource
|
|
330
|
+
# @param [String] auth_profile_id
|
|
331
|
+
# @return [AuthProfileContext] AuthProfileContext
|
|
332
|
+
def initialize(version, auth_profile_id)
|
|
333
|
+
|
|
334
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
335
|
+
super(apiV1Version)
|
|
336
|
+
|
|
337
|
+
# Path Solution
|
|
338
|
+
@solution = { auth_profile_id: auth_profile_id, }
|
|
339
|
+
@uri = "/Webhooks/AuthProfiles/#{@solution[:auth_profile_id]}"
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
end
|
|
343
|
+
##
|
|
344
|
+
# Delete the AuthProfileInstance
|
|
345
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
|
346
|
+
def delete
|
|
347
|
+
|
|
348
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
response = @version.delete_with_metadata('DELETE', @uri, headers: headers)
|
|
353
|
+
AuthProfileInstance.new(
|
|
354
|
+
@version,
|
|
355
|
+
response.body,
|
|
356
|
+
auth_profile_id: @solution[:auth_profile_id],
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
##
|
|
362
|
+
# Delete the AuthProfileInstanceMetadata
|
|
363
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
|
364
|
+
def delete_with_metadata
|
|
365
|
+
|
|
366
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
response = @version.delete_with_metadata('DELETE', @uri, headers: headers)
|
|
371
|
+
authProfile_instance = AuthProfileInstance.new(
|
|
372
|
+
@version,
|
|
373
|
+
response.body,
|
|
374
|
+
account_sid: @solution[:account_sid],
|
|
375
|
+
sid: @solution[:sid],
|
|
376
|
+
)
|
|
377
|
+
AuthProfileInstanceMetadata.new(@version, authProfile_instance, response.headers, response.status_code)
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
##
|
|
381
|
+
# Fetch the AuthProfileInstance
|
|
382
|
+
# @return [AuthProfileInstance] Fetched AuthProfileInstance
|
|
383
|
+
def fetch
|
|
384
|
+
|
|
385
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
headers['Accept'] = '*/*'
|
|
391
|
+
payload = @version.fetch('GET', @uri, headers: headers)
|
|
392
|
+
AuthProfileInstance.new(
|
|
393
|
+
@version,
|
|
394
|
+
payload,
|
|
395
|
+
auth_profile_id: @solution[:auth_profile_id],
|
|
396
|
+
)
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
##
|
|
400
|
+
# Fetch the AuthProfileInstanceMetadata
|
|
401
|
+
# @return [AuthProfileInstance] Fetched AuthProfileInstance
|
|
402
|
+
def fetch_with_metadata
|
|
403
|
+
|
|
404
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
headers['Accept'] = '*/*'
|
|
410
|
+
response = @version.fetch_with_metadata('GET', @uri, headers: headers)
|
|
411
|
+
auth_profile_instance = AuthProfileInstance.new(
|
|
412
|
+
@version,
|
|
413
|
+
response.body,
|
|
414
|
+
auth_profile_id: @solution[:auth_profile_id],
|
|
415
|
+
)
|
|
416
|
+
AuthProfileInstanceMetadata.new(
|
|
417
|
+
@version,
|
|
418
|
+
auth_profile_instance,
|
|
419
|
+
response.headers,
|
|
420
|
+
response.status_code
|
|
421
|
+
)
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
##
|
|
425
|
+
# Patch the AuthProfileInstance
|
|
426
|
+
# @param [PatchAuthProfile] patch_auth_profile
|
|
427
|
+
# @return [AuthProfileInstance] Patched AuthProfileInstance
|
|
428
|
+
def patch(patch_auth_profile: nil
|
|
429
|
+
)
|
|
430
|
+
|
|
431
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
432
|
+
headers['Content-Type'] = 'application/json'
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
headers['Accept'] = '*/*'
|
|
437
|
+
payload = @version.patch('PATCH', @uri, headers: headers, data: patch_auth_profile.to_json)
|
|
438
|
+
AuthProfileInstance.new(
|
|
439
|
+
@version,
|
|
440
|
+
payload,
|
|
441
|
+
auth_profile_id: @solution[:auth_profile_id],
|
|
442
|
+
)
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
##
|
|
446
|
+
# Patch the AuthProfileInstanceMetadata
|
|
447
|
+
# @param [PatchAuthProfile] patch_auth_profile
|
|
448
|
+
# @return [AuthProfileInstance] Patchd AuthProfileInstance
|
|
449
|
+
def patch_with_metadata(patch_auth_profile: nil
|
|
450
|
+
)
|
|
451
|
+
|
|
452
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
453
|
+
headers['Content-Type'] = 'application/json'
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
headers['Accept'] = '*/*'
|
|
458
|
+
response = @version.patch_with_metadata('PATCH', @uri, headers: headers, data: patch_auth_profile.to_json)
|
|
459
|
+
auth_profile_instance = AuthProfileInstance.new(
|
|
460
|
+
@version,
|
|
461
|
+
response.body,
|
|
462
|
+
auth_profile_id: @solution[:auth_profile_id],
|
|
463
|
+
)
|
|
464
|
+
AuthProfileInstanceMetadata.new(
|
|
465
|
+
@version,
|
|
466
|
+
auth_profile_instance,
|
|
467
|
+
response.headers,
|
|
468
|
+
response.status_code
|
|
469
|
+
)
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
##
|
|
474
|
+
# Provide a user friendly representation
|
|
475
|
+
def to_s
|
|
476
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
477
|
+
"#<Twilio.Webhooks.V1.AuthProfileContext #{context}>"
|
|
478
|
+
end
|
|
479
|
+
|
|
480
|
+
##
|
|
481
|
+
# Provide a detailed, user friendly representation
|
|
482
|
+
def inspect
|
|
483
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
484
|
+
"#<Twilio.Webhooks.V1.AuthProfileContext #{context}>"
|
|
485
|
+
end
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
class AuthProfileInstanceMetadata < InstanceResourceMetadata
|
|
489
|
+
##
|
|
490
|
+
# Initializes a new AuthProfileInstanceMetadata.
|
|
491
|
+
# @param [Version] version Version that contains the resource
|
|
492
|
+
# @param [}AuthProfileInstance] auth_profile_instance The instance associated with the metadata.
|
|
493
|
+
# @param [Hash] headers Header object with response headers.
|
|
494
|
+
# @param [Integer] status_code The HTTP status code of the response.
|
|
495
|
+
# @return [AuthProfileInstanceMetadata] The initialized instance with metadata.
|
|
496
|
+
def initialize(version, auth_profile_instance, headers, status_code)
|
|
497
|
+
super(version, headers, status_code)
|
|
498
|
+
@auth_profile_instance = auth_profile_instance
|
|
499
|
+
end
|
|
500
|
+
|
|
501
|
+
def auth_profile
|
|
502
|
+
@auth_profile_instance
|
|
503
|
+
end
|
|
504
|
+
|
|
505
|
+
def headers
|
|
506
|
+
@headers
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
def status_code
|
|
510
|
+
@status_code
|
|
511
|
+
end
|
|
512
|
+
|
|
513
|
+
def to_s
|
|
514
|
+
"<Twilio.Api.V2010.AuthProfileInstanceMetadata status=#{@status_code}>"
|
|
515
|
+
end
|
|
516
|
+
end
|
|
517
|
+
|
|
518
|
+
class AuthProfileListResponse < InstanceListResource
|
|
519
|
+
# @param [Array<AuthProfileInstance>] instance
|
|
520
|
+
# @param [Hash{String => Object}] headers
|
|
521
|
+
# @param [Integer] status_code
|
|
522
|
+
def initialize(version, payload, key)
|
|
523
|
+
@auth_profile_instance = payload.body[key].map do |data|
|
|
524
|
+
AuthProfileInstance.new(version, data)
|
|
525
|
+
end
|
|
526
|
+
@headers = payload.headers
|
|
527
|
+
@status_code = payload.status_code
|
|
528
|
+
end
|
|
529
|
+
|
|
530
|
+
def auth_profile_instance
|
|
531
|
+
@instance
|
|
532
|
+
end
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
class AuthProfilePage < TokenPage
|
|
536
|
+
##
|
|
537
|
+
# Initialize the AuthProfilePage
|
|
538
|
+
# @param [Version] version Version that contains the resource
|
|
539
|
+
# @param [Response] response Response from the API
|
|
540
|
+
# @param [Hash] solution Path solution for the resource
|
|
541
|
+
# @return [AuthProfilePage] AuthProfilePage
|
|
542
|
+
def initialize(version, response, solution)
|
|
543
|
+
|
|
544
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
545
|
+
super(apiV1Version, response)
|
|
546
|
+
|
|
547
|
+
# Path Solution
|
|
548
|
+
@solution = solution
|
|
549
|
+
end
|
|
550
|
+
|
|
551
|
+
##
|
|
552
|
+
# Build an instance of AuthProfileInstance
|
|
553
|
+
# @param [Hash] payload Payload response from the API
|
|
554
|
+
# @return [AuthProfileInstance] AuthProfileInstance
|
|
555
|
+
def get_instance(payload)
|
|
556
|
+
AuthProfileInstance.new(@version, payload)
|
|
557
|
+
end
|
|
558
|
+
|
|
559
|
+
##
|
|
560
|
+
# Provide a user friendly representation
|
|
561
|
+
def to_s
|
|
562
|
+
'<Twilio.Webhooks.V1.AuthProfilePage>'
|
|
563
|
+
end
|
|
564
|
+
end
|
|
565
|
+
|
|
566
|
+
class AuthProfilePageMetadata < PageMetadata
|
|
567
|
+
attr_reader :auth_profile_page
|
|
568
|
+
|
|
569
|
+
def initialize(version, response, solution, limit)
|
|
570
|
+
super(version, response)
|
|
571
|
+
@auth_profile_page = []
|
|
572
|
+
@limit = limit
|
|
573
|
+
key = get_key(response.body)
|
|
574
|
+
records = 0
|
|
575
|
+
while( limit != :unset && records < limit )
|
|
576
|
+
@auth_profile_page << AuthProfileListResponse.new(version, @payload, key, limit - records)
|
|
577
|
+
@payload = self.next_page
|
|
578
|
+
break unless @payload
|
|
579
|
+
records += (@payload.body[key] || []).size
|
|
580
|
+
end
|
|
581
|
+
# Path Solution
|
|
582
|
+
@solution = solution
|
|
583
|
+
end
|
|
584
|
+
|
|
585
|
+
def each
|
|
586
|
+
@auth_profile_page.each do |record|
|
|
587
|
+
yield record
|
|
588
|
+
end
|
|
589
|
+
end
|
|
590
|
+
|
|
591
|
+
def to_s
|
|
592
|
+
'<Twilio::REST::Webhooks::V1PageMetadata>';
|
|
593
|
+
end
|
|
594
|
+
end
|
|
595
|
+
class AuthProfileListResponse < InstanceListResource
|
|
596
|
+
|
|
597
|
+
# @param [Array<AuthProfileInstance>] instance
|
|
598
|
+
# @param [Hash{String => Object}] headers
|
|
599
|
+
# @param [Integer] status_code
|
|
600
|
+
def initialize(version, payload, key, limit = :unset)
|
|
601
|
+
data_list = payload.body[key] || []
|
|
602
|
+
if limit != :unset
|
|
603
|
+
data_list = data_list[0, limit]
|
|
604
|
+
end
|
|
605
|
+
@auth_profile = data_list.map do |data|
|
|
606
|
+
AuthProfileInstance.new(version, data)
|
|
607
|
+
end
|
|
608
|
+
@headers = payload.headers
|
|
609
|
+
@status_code = payload.status_code
|
|
610
|
+
end
|
|
611
|
+
|
|
612
|
+
def auth_profile
|
|
613
|
+
@auth_profile
|
|
614
|
+
end
|
|
615
|
+
|
|
616
|
+
def headers
|
|
617
|
+
@headers
|
|
618
|
+
end
|
|
619
|
+
|
|
620
|
+
def status_code
|
|
621
|
+
@status_code
|
|
622
|
+
end
|
|
623
|
+
end
|
|
624
|
+
|
|
625
|
+
class AuthProfileInstance < InstanceResource
|
|
626
|
+
##
|
|
627
|
+
# Initialize the AuthProfileInstance
|
|
628
|
+
# @param [Version] version Version that contains the resource
|
|
629
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
630
|
+
# @param [String] account_sid The SID of the
|
|
631
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this AuthProfile
|
|
632
|
+
# resource.
|
|
633
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
|
634
|
+
# @return [AuthProfileInstance] AuthProfileInstance
|
|
635
|
+
def initialize(version, payload , auth_profile_id: nil)
|
|
636
|
+
|
|
637
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
638
|
+
super(apiV1Version)
|
|
639
|
+
|
|
640
|
+
# Marshaled Properties
|
|
641
|
+
@properties = {
|
|
642
|
+
'id' => payload['id'],
|
|
643
|
+
'type' => payload['type'],
|
|
644
|
+
'friendly_name' => payload['friendly_name'],
|
|
645
|
+
'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']),
|
|
646
|
+
'updated_at' => Twilio.deserialize_iso8601_datetime(payload['updated_at']),
|
|
647
|
+
'token_url' => payload['token_url'],
|
|
648
|
+
'client_id' => payload['client_id'],
|
|
649
|
+
'client_secret' => payload['client_secret'],
|
|
650
|
+
'scope' => payload['scope'],
|
|
651
|
+
'audience' => payload['audience'],
|
|
652
|
+
'client_credentials_auth_method' => payload['client_credentials_auth_method'],
|
|
653
|
+
'username' => payload['username'],
|
|
654
|
+
'password' => payload['password'],
|
|
655
|
+
'title' => payload['title'],
|
|
656
|
+
'status' => payload['status'] == nil ? payload['status'] : payload['status'].to_i,
|
|
657
|
+
'detail' => payload['detail'],
|
|
658
|
+
'code' => payload['code'] == nil ? payload['code'] : payload['code'].to_i,
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
# Context
|
|
662
|
+
@instance_context = nil
|
|
663
|
+
@params = { 'auth_profile_id' => auth_profile_id || @properties['auth_profile_id'] , }
|
|
664
|
+
end
|
|
665
|
+
|
|
666
|
+
##
|
|
667
|
+
# Generate an instance context for the instance, the context is capable of
|
|
668
|
+
# performing various actions. All instance actions are proxied to the context
|
|
669
|
+
# @return [AuthProfileContext] CallContext for this CallInstance
|
|
670
|
+
def context
|
|
671
|
+
unless @instance_context
|
|
672
|
+
@instance_context = AuthProfileContext.new(@version , @params['auth_profile_id'])
|
|
673
|
+
end
|
|
674
|
+
@instance_context
|
|
675
|
+
end
|
|
676
|
+
|
|
677
|
+
##
|
|
678
|
+
# @return [String] Unique AuthProfile identifier (TypeID/TTID format)
|
|
679
|
+
def id
|
|
680
|
+
@properties['id']
|
|
681
|
+
end
|
|
682
|
+
|
|
683
|
+
##
|
|
684
|
+
# @return [String] Authentication type
|
|
685
|
+
def type
|
|
686
|
+
@properties['type']
|
|
687
|
+
end
|
|
688
|
+
|
|
689
|
+
##
|
|
690
|
+
# @return [String] Human-readable name for identification
|
|
691
|
+
def friendly_name
|
|
692
|
+
@properties['friendly_name']
|
|
693
|
+
end
|
|
694
|
+
|
|
695
|
+
##
|
|
696
|
+
# @return [Time]
|
|
697
|
+
def created_at
|
|
698
|
+
@properties['created_at']
|
|
699
|
+
end
|
|
700
|
+
|
|
701
|
+
##
|
|
702
|
+
# @return [Time]
|
|
703
|
+
def updated_at
|
|
704
|
+
@properties['updated_at']
|
|
705
|
+
end
|
|
706
|
+
|
|
707
|
+
##
|
|
708
|
+
# @return [String] OAuth2 token endpoint URL
|
|
709
|
+
def token_url
|
|
710
|
+
@properties['token_url']
|
|
711
|
+
end
|
|
712
|
+
|
|
713
|
+
##
|
|
714
|
+
# @return [String] OAuth2 client identifier
|
|
715
|
+
def client_id
|
|
716
|
+
@properties['client_id']
|
|
717
|
+
end
|
|
718
|
+
|
|
719
|
+
##
|
|
720
|
+
# @return [String] OAuth2 client secret (never returned, stored securely as secret)
|
|
721
|
+
def client_secret
|
|
722
|
+
@properties['client_secret']
|
|
723
|
+
end
|
|
724
|
+
|
|
725
|
+
##
|
|
726
|
+
# @return [String] OAuth2 scope to request
|
|
727
|
+
def scope
|
|
728
|
+
@properties['scope']
|
|
729
|
+
end
|
|
730
|
+
|
|
731
|
+
##
|
|
732
|
+
# @return [String] OAuth2 audience parameter
|
|
733
|
+
def audience
|
|
734
|
+
@properties['audience']
|
|
735
|
+
end
|
|
736
|
+
|
|
737
|
+
##
|
|
738
|
+
# @return [String] Client credentials authentication method (defaults to CLIENT_SECRET_POST)
|
|
739
|
+
def client_credentials_auth_method
|
|
740
|
+
@properties['client_credentials_auth_method']
|
|
741
|
+
end
|
|
742
|
+
|
|
743
|
+
##
|
|
744
|
+
# @return [String] Digest auth username
|
|
745
|
+
def username
|
|
746
|
+
@properties['username']
|
|
747
|
+
end
|
|
748
|
+
|
|
749
|
+
##
|
|
750
|
+
# @return [String] Digest auth password (never returned, stored securely as secret)
|
|
751
|
+
def password
|
|
752
|
+
@properties['password']
|
|
753
|
+
end
|
|
754
|
+
|
|
755
|
+
##
|
|
756
|
+
# @return [String]
|
|
757
|
+
def title
|
|
758
|
+
@properties['title']
|
|
759
|
+
end
|
|
760
|
+
|
|
761
|
+
##
|
|
762
|
+
# @return [String]
|
|
763
|
+
def status
|
|
764
|
+
@properties['status']
|
|
765
|
+
end
|
|
766
|
+
|
|
767
|
+
##
|
|
768
|
+
# @return [String]
|
|
769
|
+
def detail
|
|
770
|
+
@properties['detail']
|
|
771
|
+
end
|
|
772
|
+
|
|
773
|
+
##
|
|
774
|
+
# @return [String]
|
|
775
|
+
def code
|
|
776
|
+
@properties['code']
|
|
777
|
+
end
|
|
778
|
+
|
|
779
|
+
##
|
|
780
|
+
# Delete the AuthProfileInstance
|
|
781
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
|
782
|
+
def delete
|
|
783
|
+
|
|
784
|
+
context.delete
|
|
785
|
+
end
|
|
786
|
+
|
|
787
|
+
##
|
|
788
|
+
# Fetch the AuthProfileInstance
|
|
789
|
+
# @return [AuthProfileInstance] Fetched AuthProfileInstance
|
|
790
|
+
def fetch
|
|
791
|
+
|
|
792
|
+
context.fetch
|
|
793
|
+
end
|
|
794
|
+
|
|
795
|
+
##
|
|
796
|
+
# Patch the AuthProfileInstance
|
|
797
|
+
# @param [PatchAuthProfile] patch_auth_profile
|
|
798
|
+
# @return [AuthProfileInstance] Patched AuthProfileInstance
|
|
799
|
+
def patch(patch_auth_profile: nil
|
|
800
|
+
)
|
|
801
|
+
|
|
802
|
+
context.patch(
|
|
803
|
+
patch_auth_profile: patch_auth_profile,
|
|
804
|
+
)
|
|
805
|
+
end
|
|
806
|
+
|
|
807
|
+
##
|
|
808
|
+
# Provide a user friendly representation
|
|
809
|
+
def to_s
|
|
810
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
811
|
+
"<Twilio.Webhooks.V1.AuthProfileInstance #{values}>"
|
|
812
|
+
end
|
|
813
|
+
|
|
814
|
+
##
|
|
815
|
+
# Provide a detailed, user friendly representation
|
|
816
|
+
def inspect
|
|
817
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
818
|
+
"<Twilio.Webhooks.V1.AuthProfileInstance #{values}>"
|
|
819
|
+
end
|
|
820
|
+
end
|
|
821
|
+
|
|
822
|
+
end
|
|
823
|
+
end
|
|
824
|
+
end
|
|
825
|
+
end
|