twilio-ruby 7.8.0 → 7.8.1
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 +20 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/local.rb +3 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/machine_to_machine.rb +3 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/mobile.rb +3 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/national.rb +3 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/shared_cost.rb +3 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/toll_free.rb +3 -3
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/voip.rb +3 -3
- data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +1 -1
- data/lib/twilio-ruby/rest/content/v1/content.rb +38 -1
- data/lib/twilio-ruby/rest/intelligence/v2/service.rb +17 -1
- data/lib/twilio-ruby/rest/intelligence/v2/transcript/encrypted_operator_results.rb +217 -0
- data/lib/twilio-ruby/rest/intelligence/v2/transcript/encrypted_sentences.rb +217 -0
- data/lib/twilio-ruby/rest/intelligence/v2/transcript.rb +43 -0
- data/lib/twilio-ruby/rest/numbers/v1/porting_port_in.rb +3 -3
- data/lib/twilio-ruby/rest/numbers/v3/hosted_number_order.rb +339 -0
- data/lib/twilio-ruby/rest/numbers/v3.rb +40 -0
- data/lib/twilio-ruby/rest/numbers_base.rb +5 -0
- data/lib/twilio-ruby/rest/oauth/v2/token.rb +186 -0
- data/lib/twilio-ruby/rest/oauth/v2.rb +40 -0
- data/lib/twilio-ruby/rest/oauth_base.rb +6 -1
- data/lib/twilio-ruby/rest/verify/v2/new_challenge.rb +335 -0
- data/lib/twilio-ruby/rest/verify/v2/service/new_factor.rb +297 -0
- data/lib/twilio-ruby/rest/verify/v2/service.rb +38 -0
- data/lib/twilio-ruby/rest/verify/v2.rb +15 -0
- data/lib/twilio-ruby/rest/voice_base.rb +6 -1
- data/lib/twilio-ruby/twiml/voice_response.rb +20 -0
- data/lib/twilio-ruby/version.rb +1 -1
- data/twilio-ruby.gemspec +1 -1
- metadata +12 -4
@@ -0,0 +1,339 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
6
|
+
#
|
7
|
+
# Twilio - Numbers
|
8
|
+
# This is the public Twilio REST API.
|
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 Numbers < NumbersBase
|
19
|
+
class V3 < Version
|
20
|
+
class HostedNumberOrderList < ListResource
|
21
|
+
|
22
|
+
##
|
23
|
+
# Initialize the HostedNumberOrderList
|
24
|
+
# @param [Version] version Version that contains the resource
|
25
|
+
# @return [HostedNumberOrderList] HostedNumberOrderList
|
26
|
+
def initialize(version)
|
27
|
+
super(version)
|
28
|
+
# Path Solution
|
29
|
+
@solution = { }
|
30
|
+
@uri = "/HostedNumbers/HostedNumberOrders"
|
31
|
+
|
32
|
+
end
|
33
|
+
##
|
34
|
+
# Create the HostedNumberOrderInstance
|
35
|
+
# @param [String] phone_number The number to host in [+E.164](https://en.wikipedia.org/wiki/E.164) format
|
36
|
+
# @param [Boolean] sms_capability Used to specify that the SMS capability will be hosted on Twilio's platform.
|
37
|
+
# @param [String] account_sid This defaults to the AccountSid of the authorization the user is using. This can be provided to specify a subaccount to add the HostedNumberOrder to.
|
38
|
+
# @param [String] friendly_name A 64 character string that is a human readable text that describes this resource.
|
39
|
+
# @param [String] unique_name Optional. Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID.
|
40
|
+
# @param [Array[String]] cc_emails Optional. A list of emails that the LOA document for this HostedNumberOrder will be carbon copied to.
|
41
|
+
# @param [String] sms_url The URL that Twilio should request when somebody sends an SMS to the phone number. This will be copied onto the IncomingPhoneNumber resource.
|
42
|
+
# @param [String] sms_method The HTTP method that should be used to request the SmsUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource.
|
43
|
+
# @param [String] sms_fallback_url A URL that Twilio will request if an error occurs requesting or executing the TwiML defined by SmsUrl. This will be copied onto the IncomingPhoneNumber resource.
|
44
|
+
# @param [String] sms_fallback_method The HTTP method that should be used to request the SmsFallbackUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource.
|
45
|
+
# @param [String] status_callback_url Optional. The Status Callback URL attached to the IncomingPhoneNumber resource.
|
46
|
+
# @param [String] status_callback_method Optional. The Status Callback Method attached to the IncomingPhoneNumber resource.
|
47
|
+
# @param [String] sms_application_sid Optional. The 34 character sid of the application Twilio should use to handle SMS messages sent to this number. If a `SmsApplicationSid` is present, Twilio will ignore all of the SMS urls above and use those set on the application.
|
48
|
+
# @param [String] address_sid Optional. A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number.
|
49
|
+
# @param [String] email Optional. Email of the owner of this phone number that is being hosted.
|
50
|
+
# @param [VerificationType] verification_type
|
51
|
+
# @param [String] verification_document_sid Optional. The unique sid identifier of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when VerificationType is phone-bill.
|
52
|
+
# @return [HostedNumberOrderInstance] Created HostedNumberOrderInstance
|
53
|
+
def create(
|
54
|
+
phone_number: nil,
|
55
|
+
sms_capability: nil,
|
56
|
+
account_sid: :unset,
|
57
|
+
friendly_name: :unset,
|
58
|
+
unique_name: :unset,
|
59
|
+
cc_emails: :unset,
|
60
|
+
sms_url: :unset,
|
61
|
+
sms_method: :unset,
|
62
|
+
sms_fallback_url: :unset,
|
63
|
+
sms_fallback_method: :unset,
|
64
|
+
status_callback_url: :unset,
|
65
|
+
status_callback_method: :unset,
|
66
|
+
sms_application_sid: :unset,
|
67
|
+
address_sid: :unset,
|
68
|
+
email: :unset,
|
69
|
+
verification_type: :unset,
|
70
|
+
verification_document_sid: :unset
|
71
|
+
)
|
72
|
+
|
73
|
+
data = Twilio::Values.of({
|
74
|
+
'phoneNumber' => phone_number,
|
75
|
+
'smsCapability' => sms_capability,
|
76
|
+
'accountSid' => account_sid,
|
77
|
+
'friendlyName' => friendly_name,
|
78
|
+
'uniqueName' => unique_name,
|
79
|
+
'ccEmails' => Twilio.serialize_list(cc_emails) { |e| e },
|
80
|
+
'smsUrl' => sms_url,
|
81
|
+
'smsMethod' => sms_method,
|
82
|
+
'smsFallbackUrl' => sms_fallback_url,
|
83
|
+
'smsFallbackMethod' => sms_fallback_method,
|
84
|
+
'statusCallbackUrl' => status_callback_url,
|
85
|
+
'statusCallbackMethod' => status_callback_method,
|
86
|
+
'smsApplicationSid' => sms_application_sid,
|
87
|
+
'addressSid' => address_sid,
|
88
|
+
'email' => email,
|
89
|
+
'verificationType' => verification_type,
|
90
|
+
'verificationDocumentSid' => verification_document_sid,
|
91
|
+
})
|
92
|
+
|
93
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
payload = @version.create('POST', @uri, data: data, headers: headers)
|
100
|
+
HostedNumberOrderInstance.new(
|
101
|
+
@version,
|
102
|
+
payload,
|
103
|
+
)
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
# Provide a user friendly representation
|
110
|
+
def to_s
|
111
|
+
'#<Twilio.Numbers.V3.HostedNumberOrderList>'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
class HostedNumberOrderPage < Page
|
116
|
+
##
|
117
|
+
# Initialize the HostedNumberOrderPage
|
118
|
+
# @param [Version] version Version that contains the resource
|
119
|
+
# @param [Response] response Response from the API
|
120
|
+
# @param [Hash] solution Path solution for the resource
|
121
|
+
# @return [HostedNumberOrderPage] HostedNumberOrderPage
|
122
|
+
def initialize(version, response, solution)
|
123
|
+
super(version, response)
|
124
|
+
|
125
|
+
# Path Solution
|
126
|
+
@solution = solution
|
127
|
+
end
|
128
|
+
|
129
|
+
##
|
130
|
+
# Build an instance of HostedNumberOrderInstance
|
131
|
+
# @param [Hash] payload Payload response from the API
|
132
|
+
# @return [HostedNumberOrderInstance] HostedNumberOrderInstance
|
133
|
+
def get_instance(payload)
|
134
|
+
HostedNumberOrderInstance.new(@version, payload)
|
135
|
+
end
|
136
|
+
|
137
|
+
##
|
138
|
+
# Provide a user friendly representation
|
139
|
+
def to_s
|
140
|
+
'<Twilio.Numbers.V3.HostedNumberOrderPage>'
|
141
|
+
end
|
142
|
+
end
|
143
|
+
class HostedNumberOrderInstance < InstanceResource
|
144
|
+
##
|
145
|
+
# Initialize the HostedNumberOrderInstance
|
146
|
+
# @param [Version] version Version that contains the resource
|
147
|
+
# @param [Hash] payload payload that contains response from Twilio
|
148
|
+
# @param [String] account_sid The SID of the
|
149
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this HostedNumberOrder
|
150
|
+
# resource.
|
151
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
152
|
+
# @return [HostedNumberOrderInstance] HostedNumberOrderInstance
|
153
|
+
def initialize(version, payload )
|
154
|
+
super(version)
|
155
|
+
|
156
|
+
# Marshaled Properties
|
157
|
+
@properties = {
|
158
|
+
'sid' => payload['sid'],
|
159
|
+
'account_sid' => payload['account_sid'],
|
160
|
+
'incoming_phone_number_sid' => payload['incoming_phone_number_sid'],
|
161
|
+
'address_sid' => payload['address_sid'],
|
162
|
+
'signing_document_sid' => payload['signing_document_sid'],
|
163
|
+
'phone_number' => payload['phone_number'],
|
164
|
+
'capabilities' => payload['capabilities'],
|
165
|
+
'friendly_name' => payload['friendly_name'],
|
166
|
+
'unique_name' => payload['unique_name'],
|
167
|
+
'status' => payload['status'],
|
168
|
+
'failure_reason' => payload['failure_reason'],
|
169
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
170
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
171
|
+
'verification_attempts' => payload['verification_attempts'] == nil ? payload['verification_attempts'] : payload['verification_attempts'].to_i,
|
172
|
+
'email' => payload['email'],
|
173
|
+
'cc_emails' => payload['cc_emails'],
|
174
|
+
'url' => payload['url'],
|
175
|
+
'verification_type' => payload['verification_type'],
|
176
|
+
'verification_document_sid' => payload['verification_document_sid'],
|
177
|
+
'extension' => payload['extension'],
|
178
|
+
'call_delay' => payload['call_delay'] == nil ? payload['call_delay'] : payload['call_delay'].to_i,
|
179
|
+
'verification_code' => payload['verification_code'],
|
180
|
+
'verification_call_sids' => payload['verification_call_sids'],
|
181
|
+
}
|
182
|
+
end
|
183
|
+
|
184
|
+
|
185
|
+
##
|
186
|
+
# @return [String] A 34 character string that uniquely identifies this HostedNumberOrder.
|
187
|
+
def sid
|
188
|
+
@properties['sid']
|
189
|
+
end
|
190
|
+
|
191
|
+
##
|
192
|
+
# @return [String] A 34 character string that uniquely identifies the account.
|
193
|
+
def account_sid
|
194
|
+
@properties['account_sid']
|
195
|
+
end
|
196
|
+
|
197
|
+
##
|
198
|
+
# @return [String] A 34 character string that uniquely identifies the [IncomingPhoneNumber](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) resource that represents the phone number being hosted.
|
199
|
+
def incoming_phone_number_sid
|
200
|
+
@properties['incoming_phone_number_sid']
|
201
|
+
end
|
202
|
+
|
203
|
+
##
|
204
|
+
# @return [String] A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number.
|
205
|
+
def address_sid
|
206
|
+
@properties['address_sid']
|
207
|
+
end
|
208
|
+
|
209
|
+
##
|
210
|
+
# @return [String] A 34 character string that uniquely identifies the [Authorization Document](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource) the user needs to sign.
|
211
|
+
def signing_document_sid
|
212
|
+
@properties['signing_document_sid']
|
213
|
+
end
|
214
|
+
|
215
|
+
##
|
216
|
+
# @return [String] Phone number to be hosted. This must be in [E.164](https://en.wikipedia.org/wiki/E.164) format, e.g., +16175551212
|
217
|
+
def phone_number
|
218
|
+
@properties['phone_number']
|
219
|
+
end
|
220
|
+
|
221
|
+
##
|
222
|
+
# @return [NumbersV3HostedNumbersHostedNumberOrderCapabilities]
|
223
|
+
def capabilities
|
224
|
+
@properties['capabilities']
|
225
|
+
end
|
226
|
+
|
227
|
+
##
|
228
|
+
# @return [String] A 64 character string that is a human-readable text that describes this resource.
|
229
|
+
def friendly_name
|
230
|
+
@properties['friendly_name']
|
231
|
+
end
|
232
|
+
|
233
|
+
##
|
234
|
+
# @return [String] Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID.
|
235
|
+
def unique_name
|
236
|
+
@properties['unique_name']
|
237
|
+
end
|
238
|
+
|
239
|
+
##
|
240
|
+
# @return [Status]
|
241
|
+
def status
|
242
|
+
@properties['status']
|
243
|
+
end
|
244
|
+
|
245
|
+
##
|
246
|
+
# @return [String] A message that explains why a hosted_number_order went to status \"action-required\"
|
247
|
+
def failure_reason
|
248
|
+
@properties['failure_reason']
|
249
|
+
end
|
250
|
+
|
251
|
+
##
|
252
|
+
# @return [Time] The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
|
253
|
+
def date_created
|
254
|
+
@properties['date_created']
|
255
|
+
end
|
256
|
+
|
257
|
+
##
|
258
|
+
# @return [Time] The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
|
259
|
+
def date_updated
|
260
|
+
@properties['date_updated']
|
261
|
+
end
|
262
|
+
|
263
|
+
##
|
264
|
+
# @return [String] The number of attempts made to verify ownership of the phone number that is being hosted.
|
265
|
+
def verification_attempts
|
266
|
+
@properties['verification_attempts']
|
267
|
+
end
|
268
|
+
|
269
|
+
##
|
270
|
+
# @return [String] Email of the owner of this phone number that is being hosted.
|
271
|
+
def email
|
272
|
+
@properties['email']
|
273
|
+
end
|
274
|
+
|
275
|
+
##
|
276
|
+
# @return [Array<String>] A list of emails that LOA document for this HostedNumberOrder will be carbon copied to.
|
277
|
+
def cc_emails
|
278
|
+
@properties['cc_emails']
|
279
|
+
end
|
280
|
+
|
281
|
+
##
|
282
|
+
# @return [String] The URL of this HostedNumberOrder.
|
283
|
+
def url
|
284
|
+
@properties['url']
|
285
|
+
end
|
286
|
+
|
287
|
+
##
|
288
|
+
# @return [VerificationType]
|
289
|
+
def verification_type
|
290
|
+
@properties['verification_type']
|
291
|
+
end
|
292
|
+
|
293
|
+
##
|
294
|
+
# @return [String] A 34 character string that uniquely identifies the Identity Document resource that represents the document for verifying ownership of the number to be hosted.
|
295
|
+
def verification_document_sid
|
296
|
+
@properties['verification_document_sid']
|
297
|
+
end
|
298
|
+
|
299
|
+
##
|
300
|
+
# @return [String] A numerical extension to be used when making the ownership verification call.
|
301
|
+
def extension
|
302
|
+
@properties['extension']
|
303
|
+
end
|
304
|
+
|
305
|
+
##
|
306
|
+
# @return [String] A value between 0-30 specifying the number of seconds to delay initiating the ownership verification call.
|
307
|
+
def call_delay
|
308
|
+
@properties['call_delay']
|
309
|
+
end
|
310
|
+
|
311
|
+
##
|
312
|
+
# @return [String] A verification code provided in the response for a user to enter when they pick up the phone call.
|
313
|
+
def verification_code
|
314
|
+
@properties['verification_code']
|
315
|
+
end
|
316
|
+
|
317
|
+
##
|
318
|
+
# @return [Array<String>] A list of 34 character strings that are unique identifiers for the calls placed as part of ownership verification.
|
319
|
+
def verification_call_sids
|
320
|
+
@properties['verification_call_sids']
|
321
|
+
end
|
322
|
+
|
323
|
+
##
|
324
|
+
# Provide a user friendly representation
|
325
|
+
def to_s
|
326
|
+
"<Twilio.Numbers.V3.HostedNumberOrderInstance>"
|
327
|
+
end
|
328
|
+
|
329
|
+
##
|
330
|
+
# Provide a detailed, user friendly representation
|
331
|
+
def inspect
|
332
|
+
"<Twilio.Numbers.V3.HostedNumberOrderInstance>"
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
end
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
6
|
+
#
|
7
|
+
# Twilio - Numbers
|
8
|
+
# This is the public Twilio REST API.
|
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
|
+
module Twilio
|
16
|
+
module REST
|
17
|
+
class Numbers
|
18
|
+
class V3 < Version
|
19
|
+
##
|
20
|
+
# Initialize the V3 version of Numbers
|
21
|
+
def initialize(domain)
|
22
|
+
super
|
23
|
+
@version = 'v3'
|
24
|
+
@hosted_number_orders = nil
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# @return [Twilio::REST::Numbers::V3::HostedNumberOrderList]
|
29
|
+
def hosted_number_orders
|
30
|
+
@hosted_number_orders ||= HostedNumberOrderList.new self
|
31
|
+
end
|
32
|
+
##
|
33
|
+
# Provide a user friendly representation
|
34
|
+
def to_s
|
35
|
+
'<Twilio::REST::Numbers::V3>';
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -23,6 +23,7 @@ module Twilio
|
|
23
23
|
@port = 443
|
24
24
|
@v1 = nil
|
25
25
|
@v2 = nil
|
26
|
+
@v3 = nil
|
26
27
|
end
|
27
28
|
|
28
29
|
def v1
|
@@ -33,6 +34,10 @@ module Twilio
|
|
33
34
|
@v2 ||= Numbers::V2.new self
|
34
35
|
end
|
35
36
|
|
37
|
+
def v3
|
38
|
+
@v3 ||= Numbers::V3.new self
|
39
|
+
end
|
40
|
+
|
36
41
|
##
|
37
42
|
# Provide a user friendly representation
|
38
43
|
def to_s
|
@@ -0,0 +1,186 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
6
|
+
#
|
7
|
+
# User OAuth API
|
8
|
+
# User OAuth API
|
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 Oauth < OauthBase
|
19
|
+
class V2 < Version
|
20
|
+
class TokenList < ListResource
|
21
|
+
|
22
|
+
##
|
23
|
+
# Initialize the TokenList
|
24
|
+
# @param [Version] version Version that contains the resource
|
25
|
+
# @return [TokenList] TokenList
|
26
|
+
def initialize(version)
|
27
|
+
super(version)
|
28
|
+
# Path Solution
|
29
|
+
@solution = { }
|
30
|
+
@uri = "/token"
|
31
|
+
|
32
|
+
end
|
33
|
+
##
|
34
|
+
# Create the TokenInstance
|
35
|
+
# @param [String] grant_type Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token.
|
36
|
+
# @param [String] client_id A 34 character string that uniquely identifies this OAuth App.
|
37
|
+
# @param [String] client_secret The credential for confidential OAuth App.
|
38
|
+
# @param [String] code JWT token related to the authorization code grant type.
|
39
|
+
# @param [String] redirect_uri The redirect uri
|
40
|
+
# @param [String] audience The targeted audience uri
|
41
|
+
# @param [String] refresh_token JWT token related to refresh access token.
|
42
|
+
# @param [String] scope The scope of token
|
43
|
+
# @return [TokenInstance] Created TokenInstance
|
44
|
+
def create(
|
45
|
+
grant_type: nil,
|
46
|
+
client_id: nil,
|
47
|
+
client_secret: :unset,
|
48
|
+
code: :unset,
|
49
|
+
redirect_uri: :unset,
|
50
|
+
audience: :unset,
|
51
|
+
refresh_token: :unset,
|
52
|
+
scope: :unset
|
53
|
+
)
|
54
|
+
|
55
|
+
data = Twilio::Values.of({
|
56
|
+
'grant_type' => grant_type,
|
57
|
+
'client_id' => client_id,
|
58
|
+
'client_secret' => client_secret,
|
59
|
+
'code' => code,
|
60
|
+
'redirect_uri' => redirect_uri,
|
61
|
+
'audience' => audience,
|
62
|
+
'refresh_token' => refresh_token,
|
63
|
+
'scope' => scope,
|
64
|
+
})
|
65
|
+
|
66
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
payload = @version.create('POST', @uri, data: data, headers: headers)
|
73
|
+
TokenInstance.new(
|
74
|
+
@version,
|
75
|
+
payload,
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
# Provide a user friendly representation
|
83
|
+
def to_s
|
84
|
+
'#<Twilio.Oauth.V2.TokenList>'
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
class TokenPage < Page
|
89
|
+
##
|
90
|
+
# Initialize the TokenPage
|
91
|
+
# @param [Version] version Version that contains the resource
|
92
|
+
# @param [Response] response Response from the API
|
93
|
+
# @param [Hash] solution Path solution for the resource
|
94
|
+
# @return [TokenPage] TokenPage
|
95
|
+
def initialize(version, response, solution)
|
96
|
+
super(version, response)
|
97
|
+
|
98
|
+
# Path Solution
|
99
|
+
@solution = solution
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# Build an instance of TokenInstance
|
104
|
+
# @param [Hash] payload Payload response from the API
|
105
|
+
# @return [TokenInstance] TokenInstance
|
106
|
+
def get_instance(payload)
|
107
|
+
TokenInstance.new(@version, payload)
|
108
|
+
end
|
109
|
+
|
110
|
+
##
|
111
|
+
# Provide a user friendly representation
|
112
|
+
def to_s
|
113
|
+
'<Twilio.Oauth.V2.TokenPage>'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
class TokenInstance < InstanceResource
|
117
|
+
##
|
118
|
+
# Initialize the TokenInstance
|
119
|
+
# @param [Version] version Version that contains the resource
|
120
|
+
# @param [Hash] payload payload that contains response from Twilio
|
121
|
+
# @param [String] account_sid The SID of the
|
122
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this Token
|
123
|
+
# resource.
|
124
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
125
|
+
# @return [TokenInstance] TokenInstance
|
126
|
+
def initialize(version, payload )
|
127
|
+
super(version)
|
128
|
+
|
129
|
+
# Marshaled Properties
|
130
|
+
@properties = {
|
131
|
+
'access_token' => payload['access_token'],
|
132
|
+
'refresh_token' => payload['refresh_token'],
|
133
|
+
'id_token' => payload['id_token'],
|
134
|
+
'token_type' => payload['token_type'],
|
135
|
+
'expires_in' => payload['expires_in'],
|
136
|
+
}
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
##
|
141
|
+
# @return [String] Token which carries the necessary information to access a Twilio resource directly.
|
142
|
+
def access_token
|
143
|
+
@properties['access_token']
|
144
|
+
end
|
145
|
+
|
146
|
+
##
|
147
|
+
# @return [String] Token which carries the information necessary to get a new access token.
|
148
|
+
def refresh_token
|
149
|
+
@properties['refresh_token']
|
150
|
+
end
|
151
|
+
|
152
|
+
##
|
153
|
+
# @return [String] Token which carries the information necessary of user profile.
|
154
|
+
def id_token
|
155
|
+
@properties['id_token']
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# @return [String] Token type
|
160
|
+
def token_type
|
161
|
+
@properties['token_type']
|
162
|
+
end
|
163
|
+
|
164
|
+
##
|
165
|
+
# @return [String]
|
166
|
+
def expires_in
|
167
|
+
@properties['expires_in']
|
168
|
+
end
|
169
|
+
|
170
|
+
##
|
171
|
+
# Provide a user friendly representation
|
172
|
+
def to_s
|
173
|
+
"<Twilio.Oauth.V2.TokenInstance>"
|
174
|
+
end
|
175
|
+
|
176
|
+
##
|
177
|
+
# Provide a detailed, user friendly representation
|
178
|
+
def inspect
|
179
|
+
"<Twilio.Oauth.V2.TokenInstance>"
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
6
|
+
#
|
7
|
+
# User OAuth API
|
8
|
+
# User OAuth API
|
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
|
+
module Twilio
|
16
|
+
module REST
|
17
|
+
class Oauth
|
18
|
+
class V2 < Version
|
19
|
+
##
|
20
|
+
# Initialize the V2 version of Oauth
|
21
|
+
def initialize(domain)
|
22
|
+
super
|
23
|
+
@version = 'v2'
|
24
|
+
@token = nil
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# @return [Twilio::REST::Oauth::V2::TokenList]
|
29
|
+
def token
|
30
|
+
@token ||= TokenList.new self
|
31
|
+
end
|
32
|
+
##
|
33
|
+
# Provide a user friendly representation
|
34
|
+
def to_s
|
35
|
+
'<Twilio::REST::Oauth::V2>';
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -22,16 +22,21 @@ module Twilio
|
|
22
22
|
@host = "oauth.twilio.com"
|
23
23
|
@port = 443
|
24
24
|
@v1 = nil
|
25
|
+
@v2 = nil
|
25
26
|
end
|
26
27
|
|
27
28
|
def v1
|
28
29
|
@v1 ||= Oauth::V1.new self
|
29
30
|
end
|
30
31
|
|
32
|
+
def v2
|
33
|
+
@v2 ||= Oauth::V2.new self
|
34
|
+
end
|
35
|
+
|
31
36
|
##
|
32
37
|
# Provide a user friendly representation
|
33
38
|
def to_s
|
34
|
-
'<Twilio::REST::Oauth
|
39
|
+
'<Twilio::REST::Oauth>';
|
35
40
|
end
|
36
41
|
end
|
37
42
|
end
|