twilio-ruby 7.2.4 → 7.3.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/assistants/v1/assistant/feedback.rb +303 -0
- data/lib/twilio-ruby/rest/assistants/v1/assistant.rb +626 -0
- data/lib/twilio-ruby/rest/assistants/v1/knowledge/chunk.rb +229 -0
- data/lib/twilio-ruby/rest/assistants/v1/knowledge.rb +593 -0
- data/lib/twilio-ruby/rest/assistants/v1/policy.rb +264 -0
- data/lib/twilio-ruby/rest/assistants/v1/session/message.rb +264 -0
- data/lib/twilio-ruby/rest/assistants/v1/session.rb +328 -0
- data/lib/twilio-ruby/rest/assistants/v1/tool.rb +549 -0
- data/lib/twilio-ruby/rest/assistants/v1.rb +100 -0
- data/lib/twilio-ruby/rest/assistants.rb +6 -0
- data/lib/twilio-ruby/rest/assistants_base.rb +38 -0
- data/lib/twilio-ruby/rest/client.rb +10 -0
- data/lib/twilio-ruby/rest/content/v1/content/approval_fetch.rb +11 -11
- data/lib/twilio-ruby/rest/content/v1/content.rb +103 -6
- data/lib/twilio-ruby/rest/iam/v1/api_key.rb +270 -0
- data/lib/twilio-ruby/rest/iam/v1/get_api_keys.rb +223 -0
- data/lib/twilio-ruby/rest/iam/v1/new_api_key.rb +177 -0
- data/lib/twilio-ruby/rest/iam/v1.rb +61 -0
- data/lib/twilio-ruby/rest/iam.rb +6 -0
- data/lib/twilio-ruby/rest/iam_base.rb +38 -0
- data/lib/twilio-ruby/rest/marketplace/v1/installed_add_on/installed_add_on_usage.rb +11 -24
- data/lib/twilio-ruby/rest/marketplace/v1/module_data_management.rb +28 -15
- data/lib/twilio-ruby/rest/numbers/v1/porting_port_in.rb +2 -2
- data/lib/twilio-ruby/rest/numbers/v2/bundle_clone.rb +2 -2
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +4 -4
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +7 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb +1 -1
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +19 -2
@@ -0,0 +1,38 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
6
|
+
#
|
7
|
+
# NOTE: This class is auto generated by OpenAPI Generator.
|
8
|
+
# https://openapi-generator.tech
|
9
|
+
# Do not edit the class manually.
|
10
|
+
# frozen_string_literal: true
|
11
|
+
module Twilio
|
12
|
+
module REST
|
13
|
+
class AssistantsBase < Domain
|
14
|
+
##
|
15
|
+
# Initialize assistants domain
|
16
|
+
#
|
17
|
+
# @param twilio - The twilio client
|
18
|
+
#
|
19
|
+
def initialize(twilio)
|
20
|
+
super(twilio)
|
21
|
+
@base_url = "https://assistants.twilio.com"
|
22
|
+
@host = "assistants.twilio.com"
|
23
|
+
@port = 443
|
24
|
+
@v1 = nil
|
25
|
+
end
|
26
|
+
|
27
|
+
def v1
|
28
|
+
@v1 ||= Assistants::V1.new self
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
# Provide a user friendly representation
|
33
|
+
def to_s
|
34
|
+
'<Twilio::REST::Assistants::V1>';
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -27,6 +27,11 @@ module Twilio
|
|
27
27
|
@api ||= Api.new self
|
28
28
|
end
|
29
29
|
##
|
30
|
+
# Access the Assistants Twilio Domain
|
31
|
+
def assistants
|
32
|
+
@assistants ||= Assistants.new self
|
33
|
+
end
|
34
|
+
##
|
30
35
|
# Access the Bulkexports Twilio Domain
|
31
36
|
def bulkexports
|
32
37
|
@bulkexports ||= Bulkexports.new self
|
@@ -62,6 +67,11 @@ module Twilio
|
|
62
67
|
@frontline_api ||= FrontlineApi.new self
|
63
68
|
end
|
64
69
|
##
|
70
|
+
# Access the Iam Twilio Domain
|
71
|
+
def iam
|
72
|
+
@iam ||= Iam.new self
|
73
|
+
end
|
74
|
+
##
|
65
75
|
# Access the Insights Twilio Domain
|
66
76
|
def insights
|
67
77
|
@insights ||= Insights.new self
|
@@ -25,10 +25,10 @@ module Twilio
|
|
25
25
|
# Initialize the ApprovalFetchList
|
26
26
|
# @param [Version] version Version that contains the resource
|
27
27
|
# @return [ApprovalFetchList] ApprovalFetchList
|
28
|
-
def initialize(version,
|
28
|
+
def initialize(version, sid: nil)
|
29
29
|
super(version)
|
30
30
|
# Path Solution
|
31
|
-
@solution = {
|
31
|
+
@solution = { sid: sid }
|
32
32
|
|
33
33
|
|
34
34
|
end
|
@@ -46,14 +46,14 @@ module Twilio
|
|
46
46
|
##
|
47
47
|
# Initialize the ApprovalFetchContext
|
48
48
|
# @param [Version] version Version that contains the resource
|
49
|
-
# @param [String]
|
49
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch.
|
50
50
|
# @return [ApprovalFetchContext] ApprovalFetchContext
|
51
|
-
def initialize(version,
|
51
|
+
def initialize(version, sid)
|
52
52
|
super(version)
|
53
53
|
|
54
54
|
# Path Solution
|
55
|
-
@solution = {
|
56
|
-
@uri = "/Content/#{@solution[:
|
55
|
+
@solution = { sid: sid, }
|
56
|
+
@uri = "/Content/#{@solution[:sid]}/ApprovalRequests"
|
57
57
|
|
58
58
|
|
59
59
|
end
|
@@ -68,7 +68,7 @@ module Twilio
|
|
68
68
|
ApprovalFetchInstance.new(
|
69
69
|
@version,
|
70
70
|
payload,
|
71
|
-
|
71
|
+
sid: @solution[:sid],
|
72
72
|
)
|
73
73
|
end
|
74
74
|
|
@@ -107,7 +107,7 @@ module Twilio
|
|
107
107
|
# @param [Hash] payload Payload response from the API
|
108
108
|
# @return [ApprovalFetchInstance] ApprovalFetchInstance
|
109
109
|
def get_instance(payload)
|
110
|
-
ApprovalFetchInstance.new(@version, payload,
|
110
|
+
ApprovalFetchInstance.new(@version, payload, sid: @solution[:sid])
|
111
111
|
end
|
112
112
|
|
113
113
|
##
|
@@ -126,7 +126,7 @@ module Twilio
|
|
126
126
|
# resource.
|
127
127
|
# @param [String] sid The SID of the Call resource to fetch.
|
128
128
|
# @return [ApprovalFetchInstance] ApprovalFetchInstance
|
129
|
-
def initialize(version, payload ,
|
129
|
+
def initialize(version, payload , sid: nil)
|
130
130
|
super(version)
|
131
131
|
|
132
132
|
# Marshaled Properties
|
@@ -139,7 +139,7 @@ module Twilio
|
|
139
139
|
|
140
140
|
# Context
|
141
141
|
@instance_context = nil
|
142
|
-
@params = { '
|
142
|
+
@params = { 'sid' => sid || @properties['sid'] , }
|
143
143
|
end
|
144
144
|
|
145
145
|
##
|
@@ -148,7 +148,7 @@ module Twilio
|
|
148
148
|
# @return [ApprovalFetchContext] CallContext for this CallInstance
|
149
149
|
def context
|
150
150
|
unless @instance_context
|
151
|
-
@instance_context = ApprovalFetchContext.new(@version , @params['
|
151
|
+
@instance_context = ApprovalFetchContext.new(@version , @params['sid'])
|
152
152
|
end
|
153
153
|
@instance_context
|
154
154
|
end
|
@@ -40,14 +40,14 @@ module Twilio
|
|
40
40
|
# @param [title]: [String]
|
41
41
|
# @param [url]: [String]
|
42
42
|
# @param [phone]: [String]
|
43
|
-
# @param [
|
44
|
-
attr_accessor :type, :title, :url, :phone, :
|
43
|
+
# @param [code]: [String]
|
44
|
+
attr_accessor :type, :title, :url, :phone, :code
|
45
45
|
def initialize(payload)
|
46
46
|
@type = payload["type"]
|
47
47
|
@title = payload["title"]
|
48
48
|
@url = payload["url"]
|
49
49
|
@phone = payload["phone"]
|
50
|
-
@
|
50
|
+
@code = payload["code"]
|
51
51
|
end
|
52
52
|
def to_json(options = {})
|
53
53
|
{
|
@@ -55,7 +55,7 @@ module Twilio
|
|
55
55
|
title: @title,
|
56
56
|
url: @url,
|
57
57
|
phone: @phone,
|
58
|
-
|
58
|
+
code: @code,
|
59
59
|
}.to_json(options)
|
60
60
|
end
|
61
61
|
end
|
@@ -66,13 +66,15 @@ module Twilio
|
|
66
66
|
# @param [url]: [String]
|
67
67
|
# @param [phone]: [String]
|
68
68
|
# @param [id]: [String]
|
69
|
-
|
69
|
+
# @param [code]: [String]
|
70
|
+
attr_accessor :type, :title, :url, :phone, :id, :code
|
70
71
|
def initialize(payload)
|
71
72
|
@type = payload["type"]
|
72
73
|
@title = payload["title"]
|
73
74
|
@url = payload["url"]
|
74
75
|
@phone = payload["phone"]
|
75
76
|
@id = payload["id"]
|
77
|
+
@code = payload["code"]
|
76
78
|
end
|
77
79
|
def to_json(options = {})
|
78
80
|
{
|
@@ -81,6 +83,7 @@ module Twilio
|
|
81
83
|
url: @url,
|
82
84
|
phone: @phone,
|
83
85
|
id: @id,
|
86
|
+
code: @code,
|
84
87
|
}.to_json(options)
|
85
88
|
end
|
86
89
|
end
|
@@ -182,6 +185,69 @@ module Twilio
|
|
182
185
|
end
|
183
186
|
end
|
184
187
|
|
188
|
+
class FlowsPage
|
189
|
+
# @param [id]: [String]
|
190
|
+
# @param [next_page_id]: [String]
|
191
|
+
# @param [title]: [String]
|
192
|
+
# @param [subtitle]: [String]
|
193
|
+
# @param [layout]: [Array<ContentList.FlowsPageComponent>]
|
194
|
+
attr_accessor :id, :next_page_id, :title, :subtitle, :layout
|
195
|
+
def initialize(payload)
|
196
|
+
@id = payload["id"]
|
197
|
+
@next_page_id = payload["next_page_id"]
|
198
|
+
@title = payload["title"]
|
199
|
+
@subtitle = payload["subtitle"]
|
200
|
+
@layout = payload["layout"]
|
201
|
+
end
|
202
|
+
def to_json(options = {})
|
203
|
+
{
|
204
|
+
id: @id,
|
205
|
+
next_page_id: @next_page_id,
|
206
|
+
title: @title,
|
207
|
+
subtitle: @subtitle,
|
208
|
+
layout: @layout,
|
209
|
+
}.to_json(options)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
class FlowsPageComponent
|
214
|
+
# @param [label]: [String]
|
215
|
+
# @param [type]: [String]
|
216
|
+
# @param [text]: [String]
|
217
|
+
# @param [options]: [Array<ContentList.FlowsPageComponentSelectItem>]
|
218
|
+
attr_accessor :label, :type, :text, :options
|
219
|
+
def initialize(payload)
|
220
|
+
@label = payload["label"]
|
221
|
+
@type = payload["type"]
|
222
|
+
@text = payload["text"]
|
223
|
+
@options = payload["options"]
|
224
|
+
end
|
225
|
+
def to_json(options = {})
|
226
|
+
{
|
227
|
+
label: @label,
|
228
|
+
type: @type,
|
229
|
+
text: @text,
|
230
|
+
options: @options,
|
231
|
+
}.to_json(options)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
class FlowsPageComponentSelectItem
|
236
|
+
# @param [id]: [String]
|
237
|
+
# @param [title]: [String]
|
238
|
+
attr_accessor :id, :title
|
239
|
+
def initialize(payload)
|
240
|
+
@id = payload["id"]
|
241
|
+
@title = payload["title"]
|
242
|
+
end
|
243
|
+
def to_json(options = {})
|
244
|
+
{
|
245
|
+
id: @id,
|
246
|
+
title: @title,
|
247
|
+
}.to_json(options)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
185
251
|
class ListItem
|
186
252
|
# @param [id]: [String]
|
187
253
|
# @param [item]: [String]
|
@@ -302,6 +368,34 @@ module Twilio
|
|
302
368
|
end
|
303
369
|
end
|
304
370
|
|
371
|
+
class TwilioFlows
|
372
|
+
# @param [body]: [String]
|
373
|
+
# @param [button_text]: [String]
|
374
|
+
# @param [subtitle]: [String]
|
375
|
+
# @param [media_url]: [String]
|
376
|
+
# @param [pages]: [Array<ContentList.FlowsPage>]
|
377
|
+
# @param [type]: [String]
|
378
|
+
attr_accessor :body, :button_text, :subtitle, :media_url, :pages, :type
|
379
|
+
def initialize(payload)
|
380
|
+
@body = payload["body"]
|
381
|
+
@button_text = payload["button_text"]
|
382
|
+
@subtitle = payload["subtitle"]
|
383
|
+
@media_url = payload["media_url"]
|
384
|
+
@pages = payload["pages"]
|
385
|
+
@type = payload["type"]
|
386
|
+
end
|
387
|
+
def to_json(options = {})
|
388
|
+
{
|
389
|
+
body: @body,
|
390
|
+
button_text: @button_text,
|
391
|
+
subtitle: @subtitle,
|
392
|
+
media_url: @media_url,
|
393
|
+
pages: @pages,
|
394
|
+
type: @type,
|
395
|
+
}.to_json(options)
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
305
399
|
class TwilioListPicker
|
306
400
|
# @param [body]: [String]
|
307
401
|
# @param [button]: [String]
|
@@ -395,9 +489,10 @@ module Twilio
|
|
395
489
|
# @param [twilio_card]: [ContentList.TwilioCard]
|
396
490
|
# @param [twilio_catalog]: [ContentList.TwilioCatalog]
|
397
491
|
# @param [twilio_carousel]: [ContentList.TwilioCarousel]
|
492
|
+
# @param [twilio_flows]: [ContentList.TwilioFlows]
|
398
493
|
# @param [whatsapp_card]: [ContentList.WhatsappCard]
|
399
494
|
# @param [whatsapp_authentication]: [ContentList.WhatsappAuthentication]
|
400
|
-
attr_accessor :twilio_text, :twilio_media, :twilio_location, :twilio_list_picker, :twilio_call_to_action, :twilio_quick_reply, :twilio_card, :twilio_catalog, :twilio_carousel, :whatsapp_card, :whatsapp_authentication
|
495
|
+
attr_accessor :twilio_text, :twilio_media, :twilio_location, :twilio_list_picker, :twilio_call_to_action, :twilio_quick_reply, :twilio_card, :twilio_catalog, :twilio_carousel, :twilio_flows, :whatsapp_card, :whatsapp_authentication
|
401
496
|
def initialize(payload)
|
402
497
|
@twilio_text = payload["twilio_text"]
|
403
498
|
@twilio_media = payload["twilio_media"]
|
@@ -408,6 +503,7 @@ module Twilio
|
|
408
503
|
@twilio_card = payload["twilio_card"]
|
409
504
|
@twilio_catalog = payload["twilio_catalog"]
|
410
505
|
@twilio_carousel = payload["twilio_carousel"]
|
506
|
+
@twilio_flows = payload["twilio_flows"]
|
411
507
|
@whatsapp_card = payload["whatsapp_card"]
|
412
508
|
@whatsapp_authentication = payload["whatsapp_authentication"]
|
413
509
|
end
|
@@ -422,6 +518,7 @@ module Twilio
|
|
422
518
|
twilio_card: @twilio_card,
|
423
519
|
twilio_catalog: @twilio_catalog,
|
424
520
|
twilio_carousel: @twilio_carousel,
|
521
|
+
twilio_flows: @twilio_flows,
|
425
522
|
whatsapp_card: @whatsapp_card,
|
426
523
|
whatsapp_authentication: @whatsapp_authentication,
|
427
524
|
}.to_json(options)
|
@@ -0,0 +1,270 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
6
|
+
#
|
7
|
+
# Twilio - Iam
|
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 Iam < IamBase
|
19
|
+
class V1 < Version
|
20
|
+
class ApiKeyList < ListResource
|
21
|
+
|
22
|
+
##
|
23
|
+
# Initialize the ApiKeyList
|
24
|
+
# @param [Version] version Version that contains the resource
|
25
|
+
# @return [ApiKeyList] ApiKeyList
|
26
|
+
def initialize(version)
|
27
|
+
super(version)
|
28
|
+
# Path Solution
|
29
|
+
@solution = { }
|
30
|
+
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
# Provide a user friendly representation
|
37
|
+
def to_s
|
38
|
+
'#<Twilio.Iam.V1.ApiKeyList>'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
class ApiKeyContext < InstanceContext
|
44
|
+
##
|
45
|
+
# Initialize the ApiKeyContext
|
46
|
+
# @param [Version] version Version that contains the resource
|
47
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the Key resource to update.
|
48
|
+
# @return [ApiKeyContext] ApiKeyContext
|
49
|
+
def initialize(version, sid)
|
50
|
+
super(version)
|
51
|
+
|
52
|
+
# Path Solution
|
53
|
+
@solution = { sid: sid, }
|
54
|
+
@uri = "/Keys/#{@solution[:sid]}"
|
55
|
+
|
56
|
+
|
57
|
+
end
|
58
|
+
##
|
59
|
+
# Delete the ApiKeyInstance
|
60
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
61
|
+
def delete
|
62
|
+
|
63
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
64
|
+
|
65
|
+
@version.delete('DELETE', @uri, headers: headers)
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
# Fetch the ApiKeyInstance
|
70
|
+
# @return [ApiKeyInstance] Fetched ApiKeyInstance
|
71
|
+
def fetch
|
72
|
+
|
73
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
74
|
+
|
75
|
+
payload = @version.fetch('GET', @uri, headers: headers)
|
76
|
+
ApiKeyInstance.new(
|
77
|
+
@version,
|
78
|
+
payload,
|
79
|
+
sid: @solution[:sid],
|
80
|
+
)
|
81
|
+
end
|
82
|
+
|
83
|
+
##
|
84
|
+
# Update the ApiKeyInstance
|
85
|
+
# @param [String] friendly_name A descriptive string that you create to describe the resource. It can be up to 64 characters long.
|
86
|
+
# @param [Object] policy The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys).
|
87
|
+
# @return [ApiKeyInstance] Updated ApiKeyInstance
|
88
|
+
def update(
|
89
|
+
friendly_name: :unset,
|
90
|
+
policy: :unset
|
91
|
+
)
|
92
|
+
|
93
|
+
data = Twilio::Values.of({
|
94
|
+
'FriendlyName' => friendly_name,
|
95
|
+
'Policy' => Twilio.serialize_object(policy),
|
96
|
+
})
|
97
|
+
|
98
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
99
|
+
|
100
|
+
payload = @version.update('POST', @uri, data: data, headers: headers)
|
101
|
+
ApiKeyInstance.new(
|
102
|
+
@version,
|
103
|
+
payload,
|
104
|
+
sid: @solution[:sid],
|
105
|
+
)
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
##
|
110
|
+
# Provide a user friendly representation
|
111
|
+
def to_s
|
112
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
113
|
+
"#<Twilio.Iam.V1.ApiKeyContext #{context}>"
|
114
|
+
end
|
115
|
+
|
116
|
+
##
|
117
|
+
# Provide a detailed, user friendly representation
|
118
|
+
def inspect
|
119
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
120
|
+
"#<Twilio.Iam.V1.ApiKeyContext #{context}>"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
class ApiKeyPage < Page
|
125
|
+
##
|
126
|
+
# Initialize the ApiKeyPage
|
127
|
+
# @param [Version] version Version that contains the resource
|
128
|
+
# @param [Response] response Response from the API
|
129
|
+
# @param [Hash] solution Path solution for the resource
|
130
|
+
# @return [ApiKeyPage] ApiKeyPage
|
131
|
+
def initialize(version, response, solution)
|
132
|
+
super(version, response)
|
133
|
+
|
134
|
+
# Path Solution
|
135
|
+
@solution = solution
|
136
|
+
end
|
137
|
+
|
138
|
+
##
|
139
|
+
# Build an instance of ApiKeyInstance
|
140
|
+
# @param [Hash] payload Payload response from the API
|
141
|
+
# @return [ApiKeyInstance] ApiKeyInstance
|
142
|
+
def get_instance(payload)
|
143
|
+
ApiKeyInstance.new(@version, payload)
|
144
|
+
end
|
145
|
+
|
146
|
+
##
|
147
|
+
# Provide a user friendly representation
|
148
|
+
def to_s
|
149
|
+
'<Twilio.Iam.V1.ApiKeyPage>'
|
150
|
+
end
|
151
|
+
end
|
152
|
+
class ApiKeyInstance < InstanceResource
|
153
|
+
##
|
154
|
+
# Initialize the ApiKeyInstance
|
155
|
+
# @param [Version] version Version that contains the resource
|
156
|
+
# @param [Hash] payload payload that contains response from Twilio
|
157
|
+
# @param [String] account_sid The SID of the
|
158
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this ApiKey
|
159
|
+
# resource.
|
160
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
161
|
+
# @return [ApiKeyInstance] ApiKeyInstance
|
162
|
+
def initialize(version, payload , sid: nil)
|
163
|
+
super(version)
|
164
|
+
|
165
|
+
# Marshaled Properties
|
166
|
+
@properties = {
|
167
|
+
'sid' => payload['sid'],
|
168
|
+
'friendly_name' => payload['friendly_name'],
|
169
|
+
'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
|
170
|
+
'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
|
171
|
+
'policy' => payload['policy'],
|
172
|
+
}
|
173
|
+
|
174
|
+
# Context
|
175
|
+
@instance_context = nil
|
176
|
+
@params = { 'sid' => sid || @properties['sid'] , }
|
177
|
+
end
|
178
|
+
|
179
|
+
##
|
180
|
+
# Generate an instance context for the instance, the context is capable of
|
181
|
+
# performing various actions. All instance actions are proxied to the context
|
182
|
+
# @return [ApiKeyContext] CallContext for this CallInstance
|
183
|
+
def context
|
184
|
+
unless @instance_context
|
185
|
+
@instance_context = ApiKeyContext.new(@version , @params['sid'])
|
186
|
+
end
|
187
|
+
@instance_context
|
188
|
+
end
|
189
|
+
|
190
|
+
##
|
191
|
+
# @return [String] The unique string that we created to identify the Key resource.
|
192
|
+
def sid
|
193
|
+
@properties['sid']
|
194
|
+
end
|
195
|
+
|
196
|
+
##
|
197
|
+
# @return [String] The string that you assigned to describe the resource.
|
198
|
+
def friendly_name
|
199
|
+
@properties['friendly_name']
|
200
|
+
end
|
201
|
+
|
202
|
+
##
|
203
|
+
# @return [Time] The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
|
204
|
+
def date_created
|
205
|
+
@properties['date_created']
|
206
|
+
end
|
207
|
+
|
208
|
+
##
|
209
|
+
# @return [Time] The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
|
210
|
+
def date_updated
|
211
|
+
@properties['date_updated']
|
212
|
+
end
|
213
|
+
|
214
|
+
##
|
215
|
+
# @return [Hash] The \\`Policy\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys).
|
216
|
+
def policy
|
217
|
+
@properties['policy']
|
218
|
+
end
|
219
|
+
|
220
|
+
##
|
221
|
+
# Delete the ApiKeyInstance
|
222
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
223
|
+
def delete
|
224
|
+
|
225
|
+
context.delete
|
226
|
+
end
|
227
|
+
|
228
|
+
##
|
229
|
+
# Fetch the ApiKeyInstance
|
230
|
+
# @return [ApiKeyInstance] Fetched ApiKeyInstance
|
231
|
+
def fetch
|
232
|
+
|
233
|
+
context.fetch
|
234
|
+
end
|
235
|
+
|
236
|
+
##
|
237
|
+
# Update the ApiKeyInstance
|
238
|
+
# @param [String] friendly_name A descriptive string that you create to describe the resource. It can be up to 64 characters long.
|
239
|
+
# @param [Object] policy The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys).
|
240
|
+
# @return [ApiKeyInstance] Updated ApiKeyInstance
|
241
|
+
def update(
|
242
|
+
friendly_name: :unset,
|
243
|
+
policy: :unset
|
244
|
+
)
|
245
|
+
|
246
|
+
context.update(
|
247
|
+
friendly_name: friendly_name,
|
248
|
+
policy: policy,
|
249
|
+
)
|
250
|
+
end
|
251
|
+
|
252
|
+
##
|
253
|
+
# Provide a user friendly representation
|
254
|
+
def to_s
|
255
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
256
|
+
"<Twilio.Iam.V1.ApiKeyInstance #{values}>"
|
257
|
+
end
|
258
|
+
|
259
|
+
##
|
260
|
+
# Provide a detailed, user friendly representation
|
261
|
+
def inspect
|
262
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
263
|
+
"<Twilio.Iam.V1.ApiKeyInstance #{values}>"
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|