twilio-ruby 6.8.1 → 6.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +29 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +4 -4
- data/lib/twilio-ruby/rest/client.rb +0 -5
- data/lib/twilio-ruby/rest/content/v1/content.rb +1 -1
- data/lib/twilio-ruby/rest/content/v1/content_and_approvals.rb +1 -1
- data/lib/twilio-ruby/rest/content/v1/legacy_content.rb +1 -1
- data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +2 -2
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +2 -2
- data/lib/twilio-ruby/rest/insights/v1/call/annotation.rb +1 -1
- data/lib/twilio-ruby/rest/intelligence/v2/service.rb +4 -4
- data/lib/twilio-ruby/rest/intelligence/v2/transcript.rb +1 -1
- data/lib/twilio-ruby/rest/messaging/v1/service/channel_sender.rb +1 -1
- data/lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb +15 -2
- data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +1 -1
- data/lib/twilio-ruby/rest/notify/v1/service.rb +4 -4
- data/lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb +1 -1
- data/lib/twilio-ruby/rest/proxy/v1/service/short_code.rb +1 -1
- data/lib/twilio-ruby/rest/supersim/v1/esim_profile.rb +4 -4
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +4 -4
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +8 -0
- data/lib/twilio-ruby/rest/trusthub/v1/compliance_tollfree_inquiries.rb +12 -90
- data/lib/twilio-ruby/rest/trusthub/v1.rb +2 -11
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +4 -1
- data/lib/twilio-ruby/rest/verify/v2/service.rb +19 -3
- data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +1 -1
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +2 -10
- data/lib/twilio-ruby/rest/oauth/v1/device_code.rb +0 -171
- data/lib/twilio-ruby/rest/oauth/v1/oauth.rb +0 -185
- data/lib/twilio-ruby/rest/oauth/v1/openid_discovery.rb +0 -262
- data/lib/twilio-ruby/rest/oauth/v1/token.rb +0 -179
- data/lib/twilio-ruby/rest/oauth/v1/user_info.rb +0 -213
- data/lib/twilio-ruby/rest/oauth/v1.rb +0 -64
- data/lib/twilio-ruby/rest/oauth.rb +0 -33
- data/lib/twilio-ruby/rest/oauth_base.rb +0 -38
@@ -1,185 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# This code was generated by
|
3
|
-
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
4
|
-
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
5
|
-
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
6
|
-
#
|
7
|
-
# Twilio - Oauth
|
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 Oauth < OauthBase
|
19
|
-
class V1 < Version
|
20
|
-
class OauthList < ListResource
|
21
|
-
##
|
22
|
-
# Initialize the OauthList
|
23
|
-
# @param [Version] version Version that contains the resource
|
24
|
-
# @return [OauthList] OauthList
|
25
|
-
def initialize(version)
|
26
|
-
super(version)
|
27
|
-
# Path Solution
|
28
|
-
@solution = { }
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
# Provide a user friendly representation
|
36
|
-
def to_s
|
37
|
-
'#<Twilio.Oauth.V1.OauthList>'
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
class OauthContext < InstanceContext
|
43
|
-
##
|
44
|
-
# Initialize the OauthContext
|
45
|
-
# @param [Version] version Version that contains the resource
|
46
|
-
# @return [OauthContext] OauthContext
|
47
|
-
def initialize(version)
|
48
|
-
super(version)
|
49
|
-
|
50
|
-
# Path Solution
|
51
|
-
@solution = { }
|
52
|
-
@uri = "/certs"
|
53
|
-
|
54
|
-
|
55
|
-
end
|
56
|
-
##
|
57
|
-
# Fetch the OauthInstance
|
58
|
-
# @return [OauthInstance] Fetched OauthInstance
|
59
|
-
def fetch
|
60
|
-
|
61
|
-
payload = @version.fetch('GET', @uri)
|
62
|
-
OauthInstance.new(
|
63
|
-
@version,
|
64
|
-
payload,
|
65
|
-
)
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
##
|
70
|
-
# Provide a user friendly representation
|
71
|
-
def to_s
|
72
|
-
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
73
|
-
"#<Twilio.Oauth.V1.OauthContext #{context}>"
|
74
|
-
end
|
75
|
-
|
76
|
-
##
|
77
|
-
# Provide a detailed, user friendly representation
|
78
|
-
def inspect
|
79
|
-
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
80
|
-
"#<Twilio.Oauth.V1.OauthContext #{context}>"
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
class OauthPage < Page
|
85
|
-
##
|
86
|
-
# Initialize the OauthPage
|
87
|
-
# @param [Version] version Version that contains the resource
|
88
|
-
# @param [Response] response Response from the API
|
89
|
-
# @param [Hash] solution Path solution for the resource
|
90
|
-
# @return [OauthPage] OauthPage
|
91
|
-
def initialize(version, response, solution)
|
92
|
-
super(version, response)
|
93
|
-
|
94
|
-
# Path Solution
|
95
|
-
@solution = solution
|
96
|
-
end
|
97
|
-
|
98
|
-
##
|
99
|
-
# Build an instance of OauthInstance
|
100
|
-
# @param [Hash] payload Payload response from the API
|
101
|
-
# @return [OauthInstance] OauthInstance
|
102
|
-
def get_instance(payload)
|
103
|
-
OauthInstance.new(@version, payload)
|
104
|
-
end
|
105
|
-
|
106
|
-
##
|
107
|
-
# Provide a user friendly representation
|
108
|
-
def to_s
|
109
|
-
'<Twilio.Oauth.V1.OauthPage>'
|
110
|
-
end
|
111
|
-
end
|
112
|
-
class OauthInstance < InstanceResource
|
113
|
-
##
|
114
|
-
# Initialize the OauthInstance
|
115
|
-
# @param [Version] version Version that contains the resource
|
116
|
-
# @param [Hash] payload payload that contains response from Twilio
|
117
|
-
# @param [String] account_sid The SID of the
|
118
|
-
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this Oauth
|
119
|
-
# resource.
|
120
|
-
# @param [String] sid The SID of the Call resource to fetch.
|
121
|
-
# @return [OauthInstance] OauthInstance
|
122
|
-
def initialize(version, payload )
|
123
|
-
super(version)
|
124
|
-
|
125
|
-
# Marshaled Properties
|
126
|
-
@properties = {
|
127
|
-
'keys' => payload['keys'],
|
128
|
-
'url' => payload['url'],
|
129
|
-
}
|
130
|
-
|
131
|
-
# Context
|
132
|
-
@instance_context = nil
|
133
|
-
@params = { }
|
134
|
-
end
|
135
|
-
|
136
|
-
##
|
137
|
-
# Generate an instance context for the instance, the context is capable of
|
138
|
-
# performing various actions. All instance actions are proxied to the context
|
139
|
-
# @return [OauthContext] CallContext for this CallInstance
|
140
|
-
def context
|
141
|
-
unless @instance_context
|
142
|
-
@instance_context = OauthContext.new(@version )
|
143
|
-
end
|
144
|
-
@instance_context
|
145
|
-
end
|
146
|
-
|
147
|
-
##
|
148
|
-
# @return [Hash] A collection of certificates where are signed Twilio-issued tokens.
|
149
|
-
def keys
|
150
|
-
@properties['keys']
|
151
|
-
end
|
152
|
-
|
153
|
-
##
|
154
|
-
# @return [String]
|
155
|
-
def url
|
156
|
-
@properties['url']
|
157
|
-
end
|
158
|
-
|
159
|
-
##
|
160
|
-
# Fetch the OauthInstance
|
161
|
-
# @return [OauthInstance] Fetched OauthInstance
|
162
|
-
def fetch
|
163
|
-
|
164
|
-
context.fetch
|
165
|
-
end
|
166
|
-
|
167
|
-
##
|
168
|
-
# Provide a user friendly representation
|
169
|
-
def to_s
|
170
|
-
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
171
|
-
"<Twilio.Oauth.V1.OauthInstance #{values}>"
|
172
|
-
end
|
173
|
-
|
174
|
-
##
|
175
|
-
# Provide a detailed, user friendly representation
|
176
|
-
def inspect
|
177
|
-
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
178
|
-
"<Twilio.Oauth.V1.OauthInstance #{values}>"
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
@@ -1,262 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# This code was generated by
|
3
|
-
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
4
|
-
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
5
|
-
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
6
|
-
#
|
7
|
-
# Twilio - Oauth
|
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 Oauth < OauthBase
|
19
|
-
class V1 < Version
|
20
|
-
class OpenidDiscoveryList < ListResource
|
21
|
-
##
|
22
|
-
# Initialize the OpenidDiscoveryList
|
23
|
-
# @param [Version] version Version that contains the resource
|
24
|
-
# @return [OpenidDiscoveryList] OpenidDiscoveryList
|
25
|
-
def initialize(version)
|
26
|
-
super(version)
|
27
|
-
# Path Solution
|
28
|
-
@solution = { }
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
# Provide a user friendly representation
|
36
|
-
def to_s
|
37
|
-
'#<Twilio.Oauth.V1.OpenidDiscoveryList>'
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
class OpenidDiscoveryContext < InstanceContext
|
43
|
-
##
|
44
|
-
# Initialize the OpenidDiscoveryContext
|
45
|
-
# @param [Version] version Version that contains the resource
|
46
|
-
# @return [OpenidDiscoveryContext] OpenidDiscoveryContext
|
47
|
-
def initialize(version)
|
48
|
-
super(version)
|
49
|
-
|
50
|
-
# Path Solution
|
51
|
-
@solution = { }
|
52
|
-
@uri = "/.well-known/openid-configuration"
|
53
|
-
|
54
|
-
|
55
|
-
end
|
56
|
-
##
|
57
|
-
# Fetch the OpenidDiscoveryInstance
|
58
|
-
# @return [OpenidDiscoveryInstance] Fetched OpenidDiscoveryInstance
|
59
|
-
def fetch
|
60
|
-
|
61
|
-
payload = @version.fetch('GET', @uri)
|
62
|
-
OpenidDiscoveryInstance.new(
|
63
|
-
@version,
|
64
|
-
payload,
|
65
|
-
)
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
##
|
70
|
-
# Provide a user friendly representation
|
71
|
-
def to_s
|
72
|
-
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
73
|
-
"#<Twilio.Oauth.V1.OpenidDiscoveryContext #{context}>"
|
74
|
-
end
|
75
|
-
|
76
|
-
##
|
77
|
-
# Provide a detailed, user friendly representation
|
78
|
-
def inspect
|
79
|
-
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
80
|
-
"#<Twilio.Oauth.V1.OpenidDiscoveryContext #{context}>"
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
class OpenidDiscoveryPage < Page
|
85
|
-
##
|
86
|
-
# Initialize the OpenidDiscoveryPage
|
87
|
-
# @param [Version] version Version that contains the resource
|
88
|
-
# @param [Response] response Response from the API
|
89
|
-
# @param [Hash] solution Path solution for the resource
|
90
|
-
# @return [OpenidDiscoveryPage] OpenidDiscoveryPage
|
91
|
-
def initialize(version, response, solution)
|
92
|
-
super(version, response)
|
93
|
-
|
94
|
-
# Path Solution
|
95
|
-
@solution = solution
|
96
|
-
end
|
97
|
-
|
98
|
-
##
|
99
|
-
# Build an instance of OpenidDiscoveryInstance
|
100
|
-
# @param [Hash] payload Payload response from the API
|
101
|
-
# @return [OpenidDiscoveryInstance] OpenidDiscoveryInstance
|
102
|
-
def get_instance(payload)
|
103
|
-
OpenidDiscoveryInstance.new(@version, payload)
|
104
|
-
end
|
105
|
-
|
106
|
-
##
|
107
|
-
# Provide a user friendly representation
|
108
|
-
def to_s
|
109
|
-
'<Twilio.Oauth.V1.OpenidDiscoveryPage>'
|
110
|
-
end
|
111
|
-
end
|
112
|
-
class OpenidDiscoveryInstance < InstanceResource
|
113
|
-
##
|
114
|
-
# Initialize the OpenidDiscoveryInstance
|
115
|
-
# @param [Version] version Version that contains the resource
|
116
|
-
# @param [Hash] payload payload that contains response from Twilio
|
117
|
-
# @param [String] account_sid The SID of the
|
118
|
-
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this OpenidDiscovery
|
119
|
-
# resource.
|
120
|
-
# @param [String] sid The SID of the Call resource to fetch.
|
121
|
-
# @return [OpenidDiscoveryInstance] OpenidDiscoveryInstance
|
122
|
-
def initialize(version, payload )
|
123
|
-
super(version)
|
124
|
-
|
125
|
-
# Marshaled Properties
|
126
|
-
@properties = {
|
127
|
-
'issuer' => payload['issuer'],
|
128
|
-
'authorization_endpoint' => payload['authorization_endpoint'],
|
129
|
-
'device_authorization_endpoint' => payload['device_authorization_endpoint'],
|
130
|
-
'token_endpoint' => payload['token_endpoint'],
|
131
|
-
'userinfo_endpoint' => payload['userinfo_endpoint'],
|
132
|
-
'revocation_endpoint' => payload['revocation_endpoint'],
|
133
|
-
'jwk_uri' => payload['jwk_uri'],
|
134
|
-
'response_type_supported' => payload['response_type_supported'],
|
135
|
-
'subject_type_supported' => payload['subject_type_supported'],
|
136
|
-
'id_token_signing_alg_values_supported' => payload['id_token_signing_alg_values_supported'],
|
137
|
-
'scopes_supported' => payload['scopes_supported'],
|
138
|
-
'claims_supported' => payload['claims_supported'],
|
139
|
-
'url' => payload['url'],
|
140
|
-
}
|
141
|
-
|
142
|
-
# Context
|
143
|
-
@instance_context = nil
|
144
|
-
@params = { }
|
145
|
-
end
|
146
|
-
|
147
|
-
##
|
148
|
-
# Generate an instance context for the instance, the context is capable of
|
149
|
-
# performing various actions. All instance actions are proxied to the context
|
150
|
-
# @return [OpenidDiscoveryContext] CallContext for this CallInstance
|
151
|
-
def context
|
152
|
-
unless @instance_context
|
153
|
-
@instance_context = OpenidDiscoveryContext.new(@version )
|
154
|
-
end
|
155
|
-
@instance_context
|
156
|
-
end
|
157
|
-
|
158
|
-
##
|
159
|
-
# @return [String] The URL of the party that will create the token and sign it with its private key.
|
160
|
-
def issuer
|
161
|
-
@properties['issuer']
|
162
|
-
end
|
163
|
-
|
164
|
-
##
|
165
|
-
# @return [String] The endpoint that validates all authorization requests.
|
166
|
-
def authorization_endpoint
|
167
|
-
@properties['authorization_endpoint']
|
168
|
-
end
|
169
|
-
|
170
|
-
##
|
171
|
-
# @return [String] The endpoint that validates all device code related authorization requests.
|
172
|
-
def device_authorization_endpoint
|
173
|
-
@properties['device_authorization_endpoint']
|
174
|
-
end
|
175
|
-
|
176
|
-
##
|
177
|
-
# @return [String] The URL of the token endpoint. After a client has received an authorization code, that code is presented to the token endpoint and exchanged for an identity token, an access token, and a refresh token.
|
178
|
-
def token_endpoint
|
179
|
-
@properties['token_endpoint']
|
180
|
-
end
|
181
|
-
|
182
|
-
##
|
183
|
-
# @return [String] The URL of the user info endpoint, which returns user profile information to a client. Keep in mind that the user info endpoint returns only the information that has been requested.
|
184
|
-
def userinfo_endpoint
|
185
|
-
@properties['userinfo_endpoint']
|
186
|
-
end
|
187
|
-
|
188
|
-
##
|
189
|
-
# @return [String] The endpoint used to revoke access or refresh tokens issued by the authorization server.
|
190
|
-
def revocation_endpoint
|
191
|
-
@properties['revocation_endpoint']
|
192
|
-
end
|
193
|
-
|
194
|
-
##
|
195
|
-
# @return [String] The URL of your JSON Web Key Set. This set is a collection of JSON Web Keys, a standard method for representing cryptographic keys in a JSON structure.
|
196
|
-
def jwk_uri
|
197
|
-
@properties['jwk_uri']
|
198
|
-
end
|
199
|
-
|
200
|
-
##
|
201
|
-
# @return [Array<String>] A collection of response type supported by authorization server.
|
202
|
-
def response_type_supported
|
203
|
-
@properties['response_type_supported']
|
204
|
-
end
|
205
|
-
|
206
|
-
##
|
207
|
-
# @return [Array<String>] A collection of subject by authorization server.
|
208
|
-
def subject_type_supported
|
209
|
-
@properties['subject_type_supported']
|
210
|
-
end
|
211
|
-
|
212
|
-
##
|
213
|
-
# @return [Array<String>] A collection of JWS signing algorithms supported by authorization server to sign identity token.
|
214
|
-
def id_token_signing_alg_values_supported
|
215
|
-
@properties['id_token_signing_alg_values_supported']
|
216
|
-
end
|
217
|
-
|
218
|
-
##
|
219
|
-
# @return [Array<String>] A collection of scopes supported by authorization server for identity token
|
220
|
-
def scopes_supported
|
221
|
-
@properties['scopes_supported']
|
222
|
-
end
|
223
|
-
|
224
|
-
##
|
225
|
-
# @return [Array<String>] A collection of claims supported by authorization server for identity token
|
226
|
-
def claims_supported
|
227
|
-
@properties['claims_supported']
|
228
|
-
end
|
229
|
-
|
230
|
-
##
|
231
|
-
# @return [String]
|
232
|
-
def url
|
233
|
-
@properties['url']
|
234
|
-
end
|
235
|
-
|
236
|
-
##
|
237
|
-
# Fetch the OpenidDiscoveryInstance
|
238
|
-
# @return [OpenidDiscoveryInstance] Fetched OpenidDiscoveryInstance
|
239
|
-
def fetch
|
240
|
-
|
241
|
-
context.fetch
|
242
|
-
end
|
243
|
-
|
244
|
-
##
|
245
|
-
# Provide a user friendly representation
|
246
|
-
def to_s
|
247
|
-
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
248
|
-
"<Twilio.Oauth.V1.OpenidDiscoveryInstance #{values}>"
|
249
|
-
end
|
250
|
-
|
251
|
-
##
|
252
|
-
# Provide a detailed, user friendly representation
|
253
|
-
def inspect
|
254
|
-
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
255
|
-
"<Twilio.Oauth.V1.OpenidDiscoveryInstance #{values}>"
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
end
|
260
|
-
end
|
261
|
-
end
|
262
|
-
end
|
@@ -1,179 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# This code was generated by
|
3
|
-
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
4
|
-
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
5
|
-
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
6
|
-
#
|
7
|
-
# Twilio - Oauth
|
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 Oauth < OauthBase
|
19
|
-
class V1 < Version
|
20
|
-
class TokenList < ListResource
|
21
|
-
##
|
22
|
-
# Initialize the TokenList
|
23
|
-
# @param [Version] version Version that contains the resource
|
24
|
-
# @return [TokenList] TokenList
|
25
|
-
def initialize(version)
|
26
|
-
super(version)
|
27
|
-
# Path Solution
|
28
|
-
@solution = { }
|
29
|
-
@uri = "/token"
|
30
|
-
|
31
|
-
end
|
32
|
-
##
|
33
|
-
# Create the TokenInstance
|
34
|
-
# @param [String] grant_type Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token.
|
35
|
-
# @param [String] client_sid A 34 character string that uniquely identifies this OAuth App.
|
36
|
-
# @param [String] client_secret The credential for confidential OAuth App.
|
37
|
-
# @param [String] code JWT token related to the authorization code grant type.
|
38
|
-
# @param [String] code_verifier A code which is generation cryptographically.
|
39
|
-
# @param [String] device_code JWT token related to the device code grant type.
|
40
|
-
# @param [String] refresh_token JWT token related to the refresh token grant type.
|
41
|
-
# @param [String] device_id The Id of the device associated with the token (refresh token).
|
42
|
-
# @return [TokenInstance] Created TokenInstance
|
43
|
-
def create(
|
44
|
-
grant_type: nil,
|
45
|
-
client_sid: nil,
|
46
|
-
client_secret: :unset,
|
47
|
-
code: :unset,
|
48
|
-
code_verifier: :unset,
|
49
|
-
device_code: :unset,
|
50
|
-
refresh_token: :unset,
|
51
|
-
device_id: :unset
|
52
|
-
)
|
53
|
-
|
54
|
-
data = Twilio::Values.of({
|
55
|
-
'GrantType' => grant_type,
|
56
|
-
'ClientSid' => client_sid,
|
57
|
-
'ClientSecret' => client_secret,
|
58
|
-
'Code' => code,
|
59
|
-
'CodeVerifier' => code_verifier,
|
60
|
-
'DeviceCode' => device_code,
|
61
|
-
'RefreshToken' => refresh_token,
|
62
|
-
'DeviceId' => device_id,
|
63
|
-
})
|
64
|
-
|
65
|
-
payload = @version.create('POST', @uri, data: data)
|
66
|
-
TokenInstance.new(
|
67
|
-
@version,
|
68
|
-
payload,
|
69
|
-
)
|
70
|
-
end
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
# Provide a user friendly representation
|
76
|
-
def to_s
|
77
|
-
'#<Twilio.Oauth.V1.TokenList>'
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
class TokenPage < Page
|
82
|
-
##
|
83
|
-
# Initialize the TokenPage
|
84
|
-
# @param [Version] version Version that contains the resource
|
85
|
-
# @param [Response] response Response from the API
|
86
|
-
# @param [Hash] solution Path solution for the resource
|
87
|
-
# @return [TokenPage] TokenPage
|
88
|
-
def initialize(version, response, solution)
|
89
|
-
super(version, response)
|
90
|
-
|
91
|
-
# Path Solution
|
92
|
-
@solution = solution
|
93
|
-
end
|
94
|
-
|
95
|
-
##
|
96
|
-
# Build an instance of TokenInstance
|
97
|
-
# @param [Hash] payload Payload response from the API
|
98
|
-
# @return [TokenInstance] TokenInstance
|
99
|
-
def get_instance(payload)
|
100
|
-
TokenInstance.new(@version, payload)
|
101
|
-
end
|
102
|
-
|
103
|
-
##
|
104
|
-
# Provide a user friendly representation
|
105
|
-
def to_s
|
106
|
-
'<Twilio.Oauth.V1.TokenPage>'
|
107
|
-
end
|
108
|
-
end
|
109
|
-
class TokenInstance < InstanceResource
|
110
|
-
##
|
111
|
-
# Initialize the TokenInstance
|
112
|
-
# @param [Version] version Version that contains the resource
|
113
|
-
# @param [Hash] payload payload that contains response from Twilio
|
114
|
-
# @param [String] account_sid The SID of the
|
115
|
-
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this Token
|
116
|
-
# resource.
|
117
|
-
# @param [String] sid The SID of the Call resource to fetch.
|
118
|
-
# @return [TokenInstance] TokenInstance
|
119
|
-
def initialize(version, payload )
|
120
|
-
super(version)
|
121
|
-
|
122
|
-
# Marshaled Properties
|
123
|
-
@properties = {
|
124
|
-
'access_token' => payload['access_token'],
|
125
|
-
'refresh_token' => payload['refresh_token'],
|
126
|
-
'id_token' => payload['id_token'],
|
127
|
-
'refresh_token_expires_at' => Twilio.deserialize_iso8601_datetime(payload['refresh_token_expires_at']),
|
128
|
-
'access_token_expires_at' => Twilio.deserialize_iso8601_datetime(payload['access_token_expires_at']),
|
129
|
-
}
|
130
|
-
end
|
131
|
-
|
132
|
-
|
133
|
-
##
|
134
|
-
# @return [String] Token which carries the necessary information to access a Twilio resource directly.
|
135
|
-
def access_token
|
136
|
-
@properties['access_token']
|
137
|
-
end
|
138
|
-
|
139
|
-
##
|
140
|
-
# @return [String] Token which carries the information necessary to get a new access token.
|
141
|
-
def refresh_token
|
142
|
-
@properties['refresh_token']
|
143
|
-
end
|
144
|
-
|
145
|
-
##
|
146
|
-
# @return [String]
|
147
|
-
def id_token
|
148
|
-
@properties['id_token']
|
149
|
-
end
|
150
|
-
|
151
|
-
##
|
152
|
-
# @return [Time] The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
|
153
|
-
def refresh_token_expires_at
|
154
|
-
@properties['refresh_token_expires_at']
|
155
|
-
end
|
156
|
-
|
157
|
-
##
|
158
|
-
# @return [Time] The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
|
159
|
-
def access_token_expires_at
|
160
|
-
@properties['access_token_expires_at']
|
161
|
-
end
|
162
|
-
|
163
|
-
##
|
164
|
-
# Provide a user friendly representation
|
165
|
-
def to_s
|
166
|
-
"<Twilio.Oauth.V1.TokenInstance>"
|
167
|
-
end
|
168
|
-
|
169
|
-
##
|
170
|
-
# Provide a detailed, user friendly representation
|
171
|
-
def inspect
|
172
|
-
"<Twilio.Oauth.V1.TokenInstance>"
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|