twilio-ruby 5.14.1 → 5.15.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 +33 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +2 -1
- data/lib/twilio-ruby/rest/authy.rb +55 -0
- data/lib/twilio-ruby/rest/authy/v1.rb +59 -0
- data/lib/twilio-ruby/rest/authy/v1/form.rb +190 -0
- data/lib/twilio-ruby/rest/authy/v1/service.rb +378 -0
- data/lib/twilio-ruby/rest/authy/v1/service/entity.rb +372 -0
- data/lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb +474 -0
- data/lib/twilio-ruby/rest/authy/v1/service/entity/factor/challenge.rb +405 -0
- data/lib/twilio-ruby/rest/autopilot.rb +47 -0
- data/lib/twilio-ruby/rest/autopilot/v1.rb +43 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +606 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb +215 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb +205 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb +417 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb +393 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb +390 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb +443 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb +215 -0
- data/lib/twilio-ruby/rest/{preview/understand/assistant/intent.rb → autopilot/v1/assistant/task.rb} +91 -84
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.rb +377 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb +442 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb +244 -0
- data/lib/twilio-ruby/rest/{preview/understand/assistant/intent/intent_statistics.rb → autopilot/v1/assistant/task/task_statistics.rb} +49 -51
- data/lib/twilio-ruby/rest/chat/v1/service.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +12 -6
- data/lib/twilio-ruby/rest/client.rb +14 -0
- data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +12 -6
- data/lib/twilio-ruby/rest/preview/understand.rb +2 -1
- data/lib/twilio-ruby/rest/preview/understand/assistant.rb +59 -29
- data/lib/twilio-ruby/rest/preview/understand/assistant/query.rb +17 -13
- data/lib/twilio-ruby/rest/preview/understand/assistant/style_sheet.rb +215 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/task.rb +505 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/{intent → task}/field.rb +25 -25
- data/lib/twilio-ruby/rest/preview/understand/assistant/{intent → task}/sample.rb +30 -30
- data/lib/twilio-ruby/rest/preview/understand/assistant/{intent/intent_actions.rb → task/task_actions.rb} +50 -54
- data/lib/twilio-ruby/rest/preview/understand/assistant/task/task_statistics.rb +224 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +7 -7
- data/lib/twilio-ruby/rest/verify/v1/service.rb +45 -6
- data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +9 -2
- data/lib/twilio-ruby/rest/wireless/v1/command.rb +32 -5
- data/lib/twilio-ruby/twiml/voice_response.rb +66 -5
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/call/recording_spec.rb +3 -3
- data/spec/integration/api/v2010/account/conference/participant_spec.rb +42 -1
- data/spec/integration/api/v2010/account/conference/recording_spec.rb +2 -2
- data/spec/integration/authy/v1/form_spec.rb +48 -0
- data/spec/integration/authy/v1/service/entity/factor/challenge_spec.rb +267 -0
- data/spec/integration/authy/v1/service/entity/factor_spec.rb +269 -0
- data/spec/integration/authy/v1/service/entity_spec.rb +201 -0
- data/spec/integration/authy/v1/service_spec.rb +227 -0
- data/spec/integration/autopilot/v1/assistant/defaults_spec.rb +81 -0
- data/spec/integration/autopilot/v1/assistant/dialogue_spec.rb +47 -0
- data/spec/integration/autopilot/v1/assistant/field_type/field_value_spec.rb +210 -0
- data/spec/integration/autopilot/v1/assistant/field_type_spec.rb +246 -0
- data/spec/integration/autopilot/v1/assistant/model_build_spec.rb +241 -0
- data/spec/integration/autopilot/v1/assistant/query_spec.rb +306 -0
- data/spec/integration/autopilot/v1/assistant/style_sheet_spec.rb +81 -0
- data/spec/integration/autopilot/v1/assistant/task/field_spec.rb +207 -0
- data/spec/integration/autopilot/v1/assistant/task/sample_spec.rb +253 -0
- data/spec/integration/autopilot/v1/assistant/task/task_actions_spec.rb +87 -0
- data/spec/integration/autopilot/v1/assistant/task/task_statistics_spec.rb +50 -0
- data/spec/integration/autopilot/v1/assistant/task_spec.rb +262 -0
- data/spec/integration/autopilot/v1/assistant_spec.rb +270 -0
- data/spec/integration/preview/understand/assistant/query_spec.rb +8 -8
- data/spec/integration/preview/understand/assistant/style_sheet_spec.rb +81 -0
- data/spec/integration/preview/understand/assistant/{intent → task}/field_spec.rb +23 -23
- data/spec/integration/preview/understand/assistant/{intent → task}/sample_spec.rb +28 -28
- data/spec/integration/preview/understand/assistant/{intent/intent_actions_spec.rb → task/task_actions_spec.rb} +15 -15
- data/spec/integration/preview/understand/assistant/{intent/intent_statistics_spec.rb → task/task_statistics_spec.rb} +6 -6
- data/spec/integration/preview/understand/assistant/{intent_spec.rb → task_spec.rb} +53 -49
- data/spec/integration/preview/understand/assistant_spec.rb +12 -8
- data/spec/integration/taskrouter/v1/workspace/task_queue_spec.rb +3 -7
- data/spec/integration/verify/v1/service_spec.rb +30 -0
- data/spec/integration/wireless/v1/command_spec.rb +99 -2
- data/spec/twiml/voice_response_spec.rb +25 -2
- metadata +78 -17
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# \ / _ _ _| _ _
|
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
# / /
|
|
6
|
+
#
|
|
7
|
+
# frozen_string_literal: true
|
|
8
|
+
|
|
9
|
+
module Twilio
|
|
10
|
+
module REST
|
|
11
|
+
class Autopilot < Domain
|
|
12
|
+
class V1 < Version
|
|
13
|
+
class AssistantContext < InstanceContext
|
|
14
|
+
class FieldTypeContext < InstanceContext
|
|
15
|
+
##
|
|
16
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
|
17
|
+
class FieldValueList < ListResource
|
|
18
|
+
##
|
|
19
|
+
# Initialize the FieldValueList
|
|
20
|
+
# @param [Version] version Version that contains the resource
|
|
21
|
+
# @param [String] assistant_sid The unique ID of the Assistant.
|
|
22
|
+
# @param [String] field_type_sid The unique ID of the Field Type associated with
|
|
23
|
+
# this Field Value.
|
|
24
|
+
# @return [FieldValueList] FieldValueList
|
|
25
|
+
def initialize(version, assistant_sid: nil, field_type_sid: nil)
|
|
26
|
+
super(version)
|
|
27
|
+
|
|
28
|
+
# Path Solution
|
|
29
|
+
@solution = {assistant_sid: assistant_sid, field_type_sid: field_type_sid}
|
|
30
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/FieldTypes/#{@solution[:field_type_sid]}/FieldValues"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
##
|
|
34
|
+
# Lists FieldValueInstance records from the API as a list.
|
|
35
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
|
36
|
+
# memory before returning.
|
|
37
|
+
# @param [String] language An ISO language-country string that specifies the
|
|
38
|
+
# language used for this field value. For example: en-US
|
|
39
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
40
|
+
# guarantees to never return more than limit. Default is no limit
|
|
41
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
42
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
43
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
44
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
45
|
+
# @return [Array] Array of up to limit results
|
|
46
|
+
def list(language: :unset, limit: nil, page_size: nil)
|
|
47
|
+
self.stream(language: language, limit: limit, page_size: page_size).entries
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
##
|
|
51
|
+
# Streams FieldValueInstance records from the API as an Enumerable.
|
|
52
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
53
|
+
# is reached.
|
|
54
|
+
# @param [String] language An ISO language-country string that specifies the
|
|
55
|
+
# language used for this field value. For example: en-US
|
|
56
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
57
|
+
# guarantees to never return more than limit. Default is no limit.
|
|
58
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
59
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
60
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
61
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
62
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
63
|
+
def stream(language: :unset, limit: nil, page_size: nil)
|
|
64
|
+
limits = @version.read_limits(limit, page_size)
|
|
65
|
+
|
|
66
|
+
page = self.page(language: language, page_size: limits[:page_size], )
|
|
67
|
+
|
|
68
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
##
|
|
72
|
+
# When passed a block, yields FieldValueInstance records from the API.
|
|
73
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
74
|
+
# is reached.
|
|
75
|
+
def each
|
|
76
|
+
limits = @version.read_limits
|
|
77
|
+
|
|
78
|
+
page = self.page(page_size: limits[:page_size], )
|
|
79
|
+
|
|
80
|
+
@version.stream(page,
|
|
81
|
+
limit: limits[:limit],
|
|
82
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
##
|
|
86
|
+
# Retrieve a single page of FieldValueInstance records from the API.
|
|
87
|
+
# Request is executed immediately.
|
|
88
|
+
# @param [String] language An ISO language-country string that specifies the
|
|
89
|
+
# language used for this field value. For example: en-US
|
|
90
|
+
# @param [String] page_token PageToken provided by the API
|
|
91
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
|
92
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
|
93
|
+
# @return [Page] Page of FieldValueInstance
|
|
94
|
+
def page(language: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
|
95
|
+
params = Twilio::Values.of({
|
|
96
|
+
'Language' => language,
|
|
97
|
+
'PageToken' => page_token,
|
|
98
|
+
'Page' => page_number,
|
|
99
|
+
'PageSize' => page_size,
|
|
100
|
+
})
|
|
101
|
+
response = @version.page(
|
|
102
|
+
'GET',
|
|
103
|
+
@uri,
|
|
104
|
+
params
|
|
105
|
+
)
|
|
106
|
+
FieldValuePage.new(@version, response, @solution)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
##
|
|
110
|
+
# Retrieve a single page of FieldValueInstance records from the API.
|
|
111
|
+
# Request is executed immediately.
|
|
112
|
+
# @param [String] target_url API-generated URL for the requested results page
|
|
113
|
+
# @return [Page] Page of FieldValueInstance
|
|
114
|
+
def get_page(target_url)
|
|
115
|
+
response = @version.domain.request(
|
|
116
|
+
'GET',
|
|
117
|
+
target_url
|
|
118
|
+
)
|
|
119
|
+
FieldValuePage.new(@version, response, @solution)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
##
|
|
123
|
+
# Retrieve a single page of FieldValueInstance records from the API.
|
|
124
|
+
# Request is executed immediately.
|
|
125
|
+
# @param [String] language An ISO language-country string that specifies the
|
|
126
|
+
# language used for this field value. For example: en-US
|
|
127
|
+
# @param [String] value A user-provided string that uniquely identifies this
|
|
128
|
+
# resource as an alternative to the sid. Unique up to 64 characters long.
|
|
129
|
+
# @param [String] synonym_of A string value that indicates which word this field
|
|
130
|
+
# value is a synonym of.
|
|
131
|
+
# @return [FieldValueInstance] Newly created FieldValueInstance
|
|
132
|
+
def create(language: nil, value: nil, synonym_of: :unset)
|
|
133
|
+
data = Twilio::Values.of({'Language' => language, 'Value' => value, 'SynonymOf' => synonym_of, })
|
|
134
|
+
|
|
135
|
+
payload = @version.create(
|
|
136
|
+
'POST',
|
|
137
|
+
@uri,
|
|
138
|
+
data: data
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
FieldValueInstance.new(
|
|
142
|
+
@version,
|
|
143
|
+
payload,
|
|
144
|
+
assistant_sid: @solution[:assistant_sid],
|
|
145
|
+
field_type_sid: @solution[:field_type_sid],
|
|
146
|
+
)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
##
|
|
150
|
+
# Provide a user friendly representation
|
|
151
|
+
def to_s
|
|
152
|
+
'#<Twilio.Autopilot.V1.FieldValueList>'
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
##
|
|
157
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
|
158
|
+
class FieldValuePage < Page
|
|
159
|
+
##
|
|
160
|
+
# Initialize the FieldValuePage
|
|
161
|
+
# @param [Version] version Version that contains the resource
|
|
162
|
+
# @param [Response] response Response from the API
|
|
163
|
+
# @param [Hash] solution Path solution for the resource
|
|
164
|
+
# @return [FieldValuePage] FieldValuePage
|
|
165
|
+
def initialize(version, response, solution)
|
|
166
|
+
super(version, response)
|
|
167
|
+
|
|
168
|
+
# Path Solution
|
|
169
|
+
@solution = solution
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
##
|
|
173
|
+
# Build an instance of FieldValueInstance
|
|
174
|
+
# @param [Hash] payload Payload response from the API
|
|
175
|
+
# @return [FieldValueInstance] FieldValueInstance
|
|
176
|
+
def get_instance(payload)
|
|
177
|
+
FieldValueInstance.new(
|
|
178
|
+
@version,
|
|
179
|
+
payload,
|
|
180
|
+
assistant_sid: @solution[:assistant_sid],
|
|
181
|
+
field_type_sid: @solution[:field_type_sid],
|
|
182
|
+
)
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
##
|
|
186
|
+
# Provide a user friendly representation
|
|
187
|
+
def to_s
|
|
188
|
+
'<Twilio.Autopilot.V1.FieldValuePage>'
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
##
|
|
193
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
|
194
|
+
class FieldValueContext < InstanceContext
|
|
195
|
+
##
|
|
196
|
+
# Initialize the FieldValueContext
|
|
197
|
+
# @param [Version] version Version that contains the resource
|
|
198
|
+
# @param [String] assistant_sid The assistant_sid
|
|
199
|
+
# @param [String] field_type_sid The field_type_sid
|
|
200
|
+
# @param [String] sid The sid
|
|
201
|
+
# @return [FieldValueContext] FieldValueContext
|
|
202
|
+
def initialize(version, assistant_sid, field_type_sid, sid)
|
|
203
|
+
super(version)
|
|
204
|
+
|
|
205
|
+
# Path Solution
|
|
206
|
+
@solution = {assistant_sid: assistant_sid, field_type_sid: field_type_sid, sid: sid, }
|
|
207
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/FieldTypes/#{@solution[:field_type_sid]}/FieldValues/#{@solution[:sid]}"
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
##
|
|
211
|
+
# Fetch a FieldValueInstance
|
|
212
|
+
# @return [FieldValueInstance] Fetched FieldValueInstance
|
|
213
|
+
def fetch
|
|
214
|
+
params = Twilio::Values.of({})
|
|
215
|
+
|
|
216
|
+
payload = @version.fetch(
|
|
217
|
+
'GET',
|
|
218
|
+
@uri,
|
|
219
|
+
params,
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
FieldValueInstance.new(
|
|
223
|
+
@version,
|
|
224
|
+
payload,
|
|
225
|
+
assistant_sid: @solution[:assistant_sid],
|
|
226
|
+
field_type_sid: @solution[:field_type_sid],
|
|
227
|
+
sid: @solution[:sid],
|
|
228
|
+
)
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
##
|
|
232
|
+
# Deletes the FieldValueInstance
|
|
233
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
|
234
|
+
def delete
|
|
235
|
+
@version.delete('delete', @uri)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
##
|
|
239
|
+
# Provide a user friendly representation
|
|
240
|
+
def to_s
|
|
241
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
242
|
+
"#<Twilio.Autopilot.V1.FieldValueContext #{context}>"
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
##
|
|
247
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
|
248
|
+
class FieldValueInstance < InstanceResource
|
|
249
|
+
##
|
|
250
|
+
# Initialize the FieldValueInstance
|
|
251
|
+
# @param [Version] version Version that contains the resource
|
|
252
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
253
|
+
# @param [String] assistant_sid The unique ID of the Assistant.
|
|
254
|
+
# @param [String] field_type_sid The unique ID of the Field Type associated with
|
|
255
|
+
# this Field Value.
|
|
256
|
+
# @param [String] sid The sid
|
|
257
|
+
# @return [FieldValueInstance] FieldValueInstance
|
|
258
|
+
def initialize(version, payload, assistant_sid: nil, field_type_sid: nil, sid: nil)
|
|
259
|
+
super(version)
|
|
260
|
+
|
|
261
|
+
# Marshaled Properties
|
|
262
|
+
@properties = {
|
|
263
|
+
'account_sid' => payload['account_sid'],
|
|
264
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
|
265
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
|
266
|
+
'field_type_sid' => payload['field_type_sid'],
|
|
267
|
+
'language' => payload['language'],
|
|
268
|
+
'assistant_sid' => payload['assistant_sid'],
|
|
269
|
+
'sid' => payload['sid'],
|
|
270
|
+
'value' => payload['value'],
|
|
271
|
+
'url' => payload['url'],
|
|
272
|
+
'synonym_of' => payload['synonym_of'],
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
# Context
|
|
276
|
+
@instance_context = nil
|
|
277
|
+
@params = {
|
|
278
|
+
'assistant_sid' => assistant_sid,
|
|
279
|
+
'field_type_sid' => field_type_sid,
|
|
280
|
+
'sid' => sid || @properties['sid'],
|
|
281
|
+
}
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
##
|
|
285
|
+
# Generate an instance context for the instance, the context is capable of
|
|
286
|
+
# performing various actions. All instance actions are proxied to the context
|
|
287
|
+
# @return [FieldValueContext] FieldValueContext for this FieldValueInstance
|
|
288
|
+
def context
|
|
289
|
+
unless @instance_context
|
|
290
|
+
@instance_context = FieldValueContext.new(
|
|
291
|
+
@version,
|
|
292
|
+
@params['assistant_sid'],
|
|
293
|
+
@params['field_type_sid'],
|
|
294
|
+
@params['sid'],
|
|
295
|
+
)
|
|
296
|
+
end
|
|
297
|
+
@instance_context
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
##
|
|
301
|
+
# @return [String] The unique ID of the Account that created this Field Value.
|
|
302
|
+
def account_sid
|
|
303
|
+
@properties['account_sid']
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
##
|
|
307
|
+
# @return [Time] The date that this resource was created
|
|
308
|
+
def date_created
|
|
309
|
+
@properties['date_created']
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
##
|
|
313
|
+
# @return [Time] The date that this resource was last updated
|
|
314
|
+
def date_updated
|
|
315
|
+
@properties['date_updated']
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
##
|
|
319
|
+
# @return [String] The unique ID of the Field Type associated with this Field Value.
|
|
320
|
+
def field_type_sid
|
|
321
|
+
@properties['field_type_sid']
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
##
|
|
325
|
+
# @return [String] An ISO language-country string of the value (currently supported: `en-US`, `nl-NL`)
|
|
326
|
+
def language
|
|
327
|
+
@properties['language']
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
##
|
|
331
|
+
# @return [String] The unique ID of the Assistant.
|
|
332
|
+
def assistant_sid
|
|
333
|
+
@properties['assistant_sid']
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
##
|
|
337
|
+
# @return [String] A 34 character string that uniquely identifies this resource.
|
|
338
|
+
def sid
|
|
339
|
+
@properties['sid']
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
##
|
|
343
|
+
# @return [String] The Field Value itself.
|
|
344
|
+
def value
|
|
345
|
+
@properties['value']
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
##
|
|
349
|
+
# @return [String] The url
|
|
350
|
+
def url
|
|
351
|
+
@properties['url']
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
##
|
|
355
|
+
# @return [String] A string value that indicates which word this field value is a synonym of.
|
|
356
|
+
def synonym_of
|
|
357
|
+
@properties['synonym_of']
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
##
|
|
361
|
+
# Fetch a FieldValueInstance
|
|
362
|
+
# @return [FieldValueInstance] Fetched FieldValueInstance
|
|
363
|
+
def fetch
|
|
364
|
+
context.fetch
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
##
|
|
368
|
+
# Deletes the FieldValueInstance
|
|
369
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
|
370
|
+
def delete
|
|
371
|
+
context.delete
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
##
|
|
375
|
+
# Provide a user friendly representation
|
|
376
|
+
def to_s
|
|
377
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
378
|
+
"<Twilio.Autopilot.V1.FieldValueInstance #{values}>"
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
##
|
|
382
|
+
# Provide a detailed, user friendly representation
|
|
383
|
+
def inspect
|
|
384
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
385
|
+
"<Twilio.Autopilot.V1.FieldValueInstance #{values}>"
|
|
386
|
+
end
|
|
387
|
+
end
|
|
388
|
+
end
|
|
389
|
+
end
|
|
390
|
+
end
|
|
391
|
+
end
|
|
392
|
+
end
|
|
393
|
+
end
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# \ / _ _ _| _ _
|
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
# / /
|
|
6
|
+
#
|
|
7
|
+
# frozen_string_literal: true
|
|
8
|
+
|
|
9
|
+
module Twilio
|
|
10
|
+
module REST
|
|
11
|
+
class Autopilot < Domain
|
|
12
|
+
class V1 < Version
|
|
13
|
+
class AssistantContext < InstanceContext
|
|
14
|
+
##
|
|
15
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
|
16
|
+
class ModelBuildList < ListResource
|
|
17
|
+
##
|
|
18
|
+
# Initialize the ModelBuildList
|
|
19
|
+
# @param [Version] version Version that contains the resource
|
|
20
|
+
# @param [String] assistant_sid The unique ID of the parent Assistant.
|
|
21
|
+
# @return [ModelBuildList] ModelBuildList
|
|
22
|
+
def initialize(version, assistant_sid: nil)
|
|
23
|
+
super(version)
|
|
24
|
+
|
|
25
|
+
# Path Solution
|
|
26
|
+
@solution = {assistant_sid: assistant_sid}
|
|
27
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/ModelBuilds"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
##
|
|
31
|
+
# Lists ModelBuildInstance records from the API as a list.
|
|
32
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
|
33
|
+
# memory before returning.
|
|
34
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
35
|
+
# guarantees to never return more than limit. Default is no limit
|
|
36
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
37
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
38
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
39
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
40
|
+
# @return [Array] Array of up to limit results
|
|
41
|
+
def list(limit: nil, page_size: nil)
|
|
42
|
+
self.stream(limit: limit, page_size: page_size).entries
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
##
|
|
46
|
+
# Streams ModelBuildInstance records from the API as an Enumerable.
|
|
47
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
48
|
+
# is reached.
|
|
49
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
50
|
+
# guarantees to never return more than limit. Default is no limit.
|
|
51
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
52
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
53
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
54
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
55
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
56
|
+
def stream(limit: nil, page_size: nil)
|
|
57
|
+
limits = @version.read_limits(limit, page_size)
|
|
58
|
+
|
|
59
|
+
page = self.page(page_size: limits[:page_size], )
|
|
60
|
+
|
|
61
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
##
|
|
65
|
+
# When passed a block, yields ModelBuildInstance records from the API.
|
|
66
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
67
|
+
# is reached.
|
|
68
|
+
def each
|
|
69
|
+
limits = @version.read_limits
|
|
70
|
+
|
|
71
|
+
page = self.page(page_size: limits[:page_size], )
|
|
72
|
+
|
|
73
|
+
@version.stream(page,
|
|
74
|
+
limit: limits[:limit],
|
|
75
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
##
|
|
79
|
+
# Retrieve a single page of ModelBuildInstance records from the API.
|
|
80
|
+
# Request is executed immediately.
|
|
81
|
+
# @param [String] page_token PageToken provided by the API
|
|
82
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
|
83
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
|
84
|
+
# @return [Page] Page of ModelBuildInstance
|
|
85
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
|
86
|
+
params = Twilio::Values.of({
|
|
87
|
+
'PageToken' => page_token,
|
|
88
|
+
'Page' => page_number,
|
|
89
|
+
'PageSize' => page_size,
|
|
90
|
+
})
|
|
91
|
+
response = @version.page(
|
|
92
|
+
'GET',
|
|
93
|
+
@uri,
|
|
94
|
+
params
|
|
95
|
+
)
|
|
96
|
+
ModelBuildPage.new(@version, response, @solution)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
##
|
|
100
|
+
# Retrieve a single page of ModelBuildInstance records from the API.
|
|
101
|
+
# Request is executed immediately.
|
|
102
|
+
# @param [String] target_url API-generated URL for the requested results page
|
|
103
|
+
# @return [Page] Page of ModelBuildInstance
|
|
104
|
+
def get_page(target_url)
|
|
105
|
+
response = @version.domain.request(
|
|
106
|
+
'GET',
|
|
107
|
+
target_url
|
|
108
|
+
)
|
|
109
|
+
ModelBuildPage.new(@version, response, @solution)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
##
|
|
113
|
+
# Retrieve a single page of ModelBuildInstance records from the API.
|
|
114
|
+
# Request is executed immediately.
|
|
115
|
+
# @param [String] status_callback The status_callback
|
|
116
|
+
# @param [String] unique_name A user-provided string that uniquely identifies this
|
|
117
|
+
# resource as an alternative to the sid. Unique up to 64 characters long. For
|
|
118
|
+
# example: v0.1
|
|
119
|
+
# @return [ModelBuildInstance] Newly created ModelBuildInstance
|
|
120
|
+
def create(status_callback: :unset, unique_name: :unset)
|
|
121
|
+
data = Twilio::Values.of({'StatusCallback' => status_callback, 'UniqueName' => unique_name, })
|
|
122
|
+
|
|
123
|
+
payload = @version.create(
|
|
124
|
+
'POST',
|
|
125
|
+
@uri,
|
|
126
|
+
data: data
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
ModelBuildInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], )
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
##
|
|
133
|
+
# Provide a user friendly representation
|
|
134
|
+
def to_s
|
|
135
|
+
'#<Twilio.Autopilot.V1.ModelBuildList>'
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
##
|
|
140
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
|
141
|
+
class ModelBuildPage < Page
|
|
142
|
+
##
|
|
143
|
+
# Initialize the ModelBuildPage
|
|
144
|
+
# @param [Version] version Version that contains the resource
|
|
145
|
+
# @param [Response] response Response from the API
|
|
146
|
+
# @param [Hash] solution Path solution for the resource
|
|
147
|
+
# @return [ModelBuildPage] ModelBuildPage
|
|
148
|
+
def initialize(version, response, solution)
|
|
149
|
+
super(version, response)
|
|
150
|
+
|
|
151
|
+
# Path Solution
|
|
152
|
+
@solution = solution
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
##
|
|
156
|
+
# Build an instance of ModelBuildInstance
|
|
157
|
+
# @param [Hash] payload Payload response from the API
|
|
158
|
+
# @return [ModelBuildInstance] ModelBuildInstance
|
|
159
|
+
def get_instance(payload)
|
|
160
|
+
ModelBuildInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], )
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
##
|
|
164
|
+
# Provide a user friendly representation
|
|
165
|
+
def to_s
|
|
166
|
+
'<Twilio.Autopilot.V1.ModelBuildPage>'
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
##
|
|
171
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
|
172
|
+
class ModelBuildContext < InstanceContext
|
|
173
|
+
##
|
|
174
|
+
# Initialize the ModelBuildContext
|
|
175
|
+
# @param [Version] version Version that contains the resource
|
|
176
|
+
# @param [String] assistant_sid The assistant_sid
|
|
177
|
+
# @param [String] sid The sid
|
|
178
|
+
# @return [ModelBuildContext] ModelBuildContext
|
|
179
|
+
def initialize(version, assistant_sid, sid)
|
|
180
|
+
super(version)
|
|
181
|
+
|
|
182
|
+
# Path Solution
|
|
183
|
+
@solution = {assistant_sid: assistant_sid, sid: sid, }
|
|
184
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/ModelBuilds/#{@solution[:sid]}"
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
##
|
|
188
|
+
# Fetch a ModelBuildInstance
|
|
189
|
+
# @return [ModelBuildInstance] Fetched ModelBuildInstance
|
|
190
|
+
def fetch
|
|
191
|
+
params = Twilio::Values.of({})
|
|
192
|
+
|
|
193
|
+
payload = @version.fetch(
|
|
194
|
+
'GET',
|
|
195
|
+
@uri,
|
|
196
|
+
params,
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
ModelBuildInstance.new(
|
|
200
|
+
@version,
|
|
201
|
+
payload,
|
|
202
|
+
assistant_sid: @solution[:assistant_sid],
|
|
203
|
+
sid: @solution[:sid],
|
|
204
|
+
)
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
##
|
|
208
|
+
# Update the ModelBuildInstance
|
|
209
|
+
# @param [String] unique_name A user-provided string that uniquely identifies this
|
|
210
|
+
# resource as an alternative to the sid. Unique up to 64 characters long. For
|
|
211
|
+
# example: v0.1
|
|
212
|
+
# @return [ModelBuildInstance] Updated ModelBuildInstance
|
|
213
|
+
def update(unique_name: :unset)
|
|
214
|
+
data = Twilio::Values.of({'UniqueName' => unique_name, })
|
|
215
|
+
|
|
216
|
+
payload = @version.update(
|
|
217
|
+
'POST',
|
|
218
|
+
@uri,
|
|
219
|
+
data: data,
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
ModelBuildInstance.new(
|
|
223
|
+
@version,
|
|
224
|
+
payload,
|
|
225
|
+
assistant_sid: @solution[:assistant_sid],
|
|
226
|
+
sid: @solution[:sid],
|
|
227
|
+
)
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
##
|
|
231
|
+
# Deletes the ModelBuildInstance
|
|
232
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
|
233
|
+
def delete
|
|
234
|
+
@version.delete('delete', @uri)
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
##
|
|
238
|
+
# Provide a user friendly representation
|
|
239
|
+
def to_s
|
|
240
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
241
|
+
"#<Twilio.Autopilot.V1.ModelBuildContext #{context}>"
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
##
|
|
246
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
|
247
|
+
class ModelBuildInstance < InstanceResource
|
|
248
|
+
##
|
|
249
|
+
# Initialize the ModelBuildInstance
|
|
250
|
+
# @param [Version] version Version that contains the resource
|
|
251
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
252
|
+
# @param [String] assistant_sid The unique ID of the parent Assistant.
|
|
253
|
+
# @param [String] sid The sid
|
|
254
|
+
# @return [ModelBuildInstance] ModelBuildInstance
|
|
255
|
+
def initialize(version, payload, assistant_sid: nil, sid: nil)
|
|
256
|
+
super(version)
|
|
257
|
+
|
|
258
|
+
# Marshaled Properties
|
|
259
|
+
@properties = {
|
|
260
|
+
'account_sid' => payload['account_sid'],
|
|
261
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
|
262
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
|
263
|
+
'assistant_sid' => payload['assistant_sid'],
|
|
264
|
+
'sid' => payload['sid'],
|
|
265
|
+
'status' => payload['status'],
|
|
266
|
+
'unique_name' => payload['unique_name'],
|
|
267
|
+
'url' => payload['url'],
|
|
268
|
+
'build_duration' => payload['build_duration'] == nil ? payload['build_duration'] : payload['build_duration'].to_i,
|
|
269
|
+
'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i,
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
# Context
|
|
273
|
+
@instance_context = nil
|
|
274
|
+
@params = {'assistant_sid' => assistant_sid, 'sid' => sid || @properties['sid'], }
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
##
|
|
278
|
+
# Generate an instance context for the instance, the context is capable of
|
|
279
|
+
# performing various actions. All instance actions are proxied to the context
|
|
280
|
+
# @return [ModelBuildContext] ModelBuildContext for this ModelBuildInstance
|
|
281
|
+
def context
|
|
282
|
+
unless @instance_context
|
|
283
|
+
@instance_context = ModelBuildContext.new(@version, @params['assistant_sid'], @params['sid'], )
|
|
284
|
+
end
|
|
285
|
+
@instance_context
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
##
|
|
289
|
+
# @return [String] The unique ID of the Account that created this Model Build.
|
|
290
|
+
def account_sid
|
|
291
|
+
@properties['account_sid']
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
##
|
|
295
|
+
# @return [Time] The date that this resource was created
|
|
296
|
+
def date_created
|
|
297
|
+
@properties['date_created']
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
##
|
|
301
|
+
# @return [Time] The date that this resource was last updated
|
|
302
|
+
def date_updated
|
|
303
|
+
@properties['date_updated']
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
##
|
|
307
|
+
# @return [String] The unique ID of the parent Assistant.
|
|
308
|
+
def assistant_sid
|
|
309
|
+
@properties['assistant_sid']
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
##
|
|
313
|
+
# @return [String] A 34 character string that uniquely identifies this resource.
|
|
314
|
+
def sid
|
|
315
|
+
@properties['sid']
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
##
|
|
319
|
+
# @return [model_build.Status] A string that described the model build status. The values can be: `enqueued`, `building`, `completed`, `failed`
|
|
320
|
+
def status
|
|
321
|
+
@properties['status']
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
##
|
|
325
|
+
# @return [String] A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long.
|
|
326
|
+
def unique_name
|
|
327
|
+
@properties['unique_name']
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
##
|
|
331
|
+
# @return [String] The url
|
|
332
|
+
def url
|
|
333
|
+
@properties['url']
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
##
|
|
337
|
+
# @return [String] The time in seconds it took to build the model.
|
|
338
|
+
def build_duration
|
|
339
|
+
@properties['build_duration']
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
##
|
|
343
|
+
# @return [String] The error_code
|
|
344
|
+
def error_code
|
|
345
|
+
@properties['error_code']
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
##
|
|
349
|
+
# Fetch a ModelBuildInstance
|
|
350
|
+
# @return [ModelBuildInstance] Fetched ModelBuildInstance
|
|
351
|
+
def fetch
|
|
352
|
+
context.fetch
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
##
|
|
356
|
+
# Update the ModelBuildInstance
|
|
357
|
+
# @param [String] unique_name A user-provided string that uniquely identifies this
|
|
358
|
+
# resource as an alternative to the sid. Unique up to 64 characters long. For
|
|
359
|
+
# example: v0.1
|
|
360
|
+
# @return [ModelBuildInstance] Updated ModelBuildInstance
|
|
361
|
+
def update(unique_name: :unset)
|
|
362
|
+
context.update(unique_name: unique_name, )
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
##
|
|
366
|
+
# Deletes the ModelBuildInstance
|
|
367
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
|
368
|
+
def delete
|
|
369
|
+
context.delete
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
##
|
|
373
|
+
# Provide a user friendly representation
|
|
374
|
+
def to_s
|
|
375
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
376
|
+
"<Twilio.Autopilot.V1.ModelBuildInstance #{values}>"
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
##
|
|
380
|
+
# Provide a detailed, user friendly representation
|
|
381
|
+
def inspect
|
|
382
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
383
|
+
"<Twilio.Autopilot.V1.ModelBuildInstance #{values}>"
|
|
384
|
+
end
|
|
385
|
+
end
|
|
386
|
+
end
|
|
387
|
+
end
|
|
388
|
+
end
|
|
389
|
+
end
|
|
390
|
+
end
|