twilio-ruby 5.4.3 → 5.4.4
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 +12 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/framework/serialize.rb +9 -0
- data/lib/twilio-ruby/http/http_client.rb +1 -1
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +1 -1
- data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +8 -2
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +1 -1
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v1/service.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v1/service/role.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v2/service.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v2/service/binding.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v2/service/channel/member.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v2/service/role.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/binding.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb +1 -1
- data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +5 -1
- data/lib/twilio-ruby/rest/notify/v1/service/binding.rb +3 -3
- data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +4 -4
- data/lib/twilio-ruby/rest/notify/v1/service/user.rb +5 -2
- data/lib/twilio-ruby/rest/notify/v1/service/user/user_binding.rb +2 -2
- data/lib/twilio-ruby/rest/preview.rb +10 -3
- data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +4 -4
- data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +2 -2
- data/lib/twilio-ruby/rest/preview/proxy/service/session.rb +2 -2
- data/lib/twilio-ruby/rest/preview/proxy/service/session/participant/message_interaction.rb +1 -1
- data/lib/twilio-ruby/rest/preview/understand.rb +41 -0
- data/lib/twilio-ruby/rest/preview/understand/service.rb +503 -0
- data/lib/twilio-ruby/rest/preview/understand/service/field_type.rb +399 -0
- data/lib/twilio-ruby/rest/preview/understand/service/field_type/field_value.rb +375 -0
- data/lib/twilio-ruby/rest/preview/understand/service/intent.rb +421 -0
- data/lib/twilio-ruby/rest/preview/understand/service/intent/field.rb +371 -0
- data/lib/twilio-ruby/rest/preview/understand/service/intent/sample.rb +407 -0
- data/lib/twilio-ruby/rest/preview/understand/service/model_build.rb +358 -0
- data/lib/twilio-ruby/rest/preview/understand/service/query.rb +422 -0
- data/lib/twilio-ruby/rest/preview/wireless/rate_plan.rb +1 -1
- data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +2 -2
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb +1 -1
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +1 -1
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +3 -3
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +3 -3
- data/lib/twilio-ruby/rest/video/v1/recording.rb +1 -1
- data/lib/twilio-ruby/rest/video/v1/room.rb +27 -1
- data/lib/twilio-ruby/rest/video/v1/room/room_participant.rb +407 -0
- data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_published_track.rb +326 -0
- data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +1 -1
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/framework/serialize_spec.rb +21 -0
- data/spec/integration/chat/v1/service/role_spec.rb +6 -2
- data/spec/integration/chat/v2/service/role_spec.rb +6 -2
- data/spec/integration/ip_messaging/v1/service/role_spec.rb +6 -2
- data/spec/integration/ip_messaging/v2/service/role_spec.rb +6 -2
- data/spec/integration/preview/hosted_numbers/authorization_document_spec.rb +1 -1
- data/spec/integration/preview/understand/service/field_type/field_value_spec.rb +205 -0
- data/spec/integration/preview/understand/service/field_type_spec.rb +244 -0
- data/spec/integration/preview/understand/service/intent/field_spec.rb +205 -0
- data/spec/integration/preview/understand/service/intent/sample_spec.rb +247 -0
- data/spec/integration/preview/understand/service/intent_spec.rb +252 -0
- data/spec/integration/preview/understand/service/model_build_spec.rb +231 -0
- data/spec/integration/preview/understand/service/query_spec.rb +300 -0
- data/spec/integration/preview/understand/service_spec.rb +256 -0
- data/spec/integration/video/v1/room/room_participant/room_participant_published_track_spec.rb +94 -0
- data/spec/integration/video/v1/room/room_participant_spec.rb +182 -0
- data/spec/integration/video/v1/room_spec.rb +4 -0
- metadata +33 -2
|
@@ -48,8 +48,8 @@ module Twilio
|
|
|
48
48
|
# @return [NotificationInstance] Newly created NotificationInstance
|
|
49
49
|
def create(body: :unset, priority: :unset, ttl: :unset, title: :unset, sound: :unset, action: :unset, data: :unset, apn: :unset, gcm: :unset, sms: :unset, facebook_messenger: :unset, fcm: :unset, segment: :unset, alexa: :unset, to_binding: :unset, identity: :unset, tag: :unset)
|
|
50
50
|
data = Twilio::Values.of({
|
|
51
|
-
'Identity' => identity,
|
|
52
|
-
'Tag' => tag,
|
|
51
|
+
'Identity' => Twilio.serialize_list(identity) { |e| e },
|
|
52
|
+
'Tag' => Twilio.serialize_list(tag) { |e| e },
|
|
53
53
|
'Body' => body,
|
|
54
54
|
'Priority' => priority,
|
|
55
55
|
'Ttl' => ttl,
|
|
@@ -62,9 +62,9 @@ module Twilio
|
|
|
62
62
|
'Sms' => Twilio.serialize_object(sms),
|
|
63
63
|
'FacebookMessenger' => Twilio.serialize_object(facebook_messenger),
|
|
64
64
|
'Fcm' => Twilio.serialize_object(fcm),
|
|
65
|
-
'Segment' => segment,
|
|
65
|
+
'Segment' => Twilio.serialize_list(segment) { |e| e },
|
|
66
66
|
'Alexa' => Twilio.serialize_object(alexa),
|
|
67
|
-
'ToBinding' => to_binding,
|
|
67
|
+
'ToBinding' => Twilio.serialize_list(to_binding) { |e| e },
|
|
68
68
|
})
|
|
69
69
|
|
|
70
70
|
payload = @version.create(
|
|
@@ -32,7 +32,10 @@ module Twilio
|
|
|
32
32
|
# @param [String] segment The segment
|
|
33
33
|
# @return [UserInstance] Newly created UserInstance
|
|
34
34
|
def create(identity: nil, segment: :unset)
|
|
35
|
-
data = Twilio::Values.of({
|
|
35
|
+
data = Twilio::Values.of({
|
|
36
|
+
'Identity' => identity,
|
|
37
|
+
'Segment' => Twilio.serialize_list(segment) { |e| e },
|
|
38
|
+
})
|
|
36
39
|
|
|
37
40
|
payload = @version.create(
|
|
38
41
|
'POST',
|
|
@@ -106,7 +109,7 @@ module Twilio
|
|
|
106
109
|
# @return [Page] Page of UserInstance
|
|
107
110
|
def page(identity: :unset, segment: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
|
108
111
|
params = Twilio::Values.of({
|
|
109
|
-
'Identity' => identity,
|
|
112
|
+
'Identity' => Twilio.serialize_list(identity) { |e| e },
|
|
110
113
|
'Segment' => segment,
|
|
111
114
|
'PageToken' => page_token,
|
|
112
115
|
'Page' => page_number,
|
|
@@ -41,7 +41,7 @@ module Twilio
|
|
|
41
41
|
data = Twilio::Values.of({
|
|
42
42
|
'BindingType' => binding_type,
|
|
43
43
|
'Address' => address,
|
|
44
|
-
'Tag' => tag,
|
|
44
|
+
'Tag' => Twilio.serialize_list(tag) { |e| e },
|
|
45
45
|
'NotificationProtocolVersion' => notification_protocol_version,
|
|
46
46
|
'CredentialSid' => credential_sid,
|
|
47
47
|
'Endpoint' => endpoint,
|
|
@@ -135,7 +135,7 @@ module Twilio
|
|
|
135
135
|
params = Twilio::Values.of({
|
|
136
136
|
'StartDate' => Twilio.serialize_iso8601_date(start_date),
|
|
137
137
|
'EndDate' => Twilio.serialize_iso8601_date(end_date),
|
|
138
|
-
'Tag' => tag,
|
|
138
|
+
'Tag' => Twilio.serialize_list(tag) { |e| e },
|
|
139
139
|
'PageToken' => page_token,
|
|
140
140
|
'Page' => page_number,
|
|
141
141
|
'PageSize' => page_size,
|
|
@@ -24,6 +24,7 @@ module Twilio
|
|
|
24
24
|
@proxy = nil
|
|
25
25
|
@acc_security = nil
|
|
26
26
|
@sync = nil
|
|
27
|
+
@understand = nil
|
|
27
28
|
@wireless = nil
|
|
28
29
|
end
|
|
29
30
|
|
|
@@ -69,6 +70,12 @@ module Twilio
|
|
|
69
70
|
@sync ||= Sync.new self
|
|
70
71
|
end
|
|
71
72
|
|
|
73
|
+
##
|
|
74
|
+
# Version understand of preview
|
|
75
|
+
def understand
|
|
76
|
+
@understand ||= Understand.new self
|
|
77
|
+
end
|
|
78
|
+
|
|
72
79
|
##
|
|
73
80
|
# Version wireless of preview
|
|
74
81
|
def wireless
|
|
@@ -137,10 +144,10 @@ module Twilio
|
|
|
137
144
|
|
|
138
145
|
##
|
|
139
146
|
# @param [String] sid The sid
|
|
140
|
-
# @return [Twilio::REST::Preview::
|
|
141
|
-
# @return [Twilio::REST::Preview::
|
|
147
|
+
# @return [Twilio::REST::Preview::Understand::ServiceInstance] if sid was passed.
|
|
148
|
+
# @return [Twilio::REST::Preview::Understand::ServiceList]
|
|
142
149
|
def services(sid=:unset)
|
|
143
|
-
self.
|
|
150
|
+
self.understand.services(sid)
|
|
144
151
|
end
|
|
145
152
|
|
|
146
153
|
##
|
|
@@ -120,10 +120,10 @@ module Twilio
|
|
|
120
120
|
# @return [AuthorizationDocumentInstance] Newly created AuthorizationDocumentInstance
|
|
121
121
|
def create(hosted_number_order_sids: nil, address_sid: nil, email: nil, cc_emails: :unset)
|
|
122
122
|
data = Twilio::Values.of({
|
|
123
|
-
'HostedNumberOrderSids' => hosted_number_order_sids,
|
|
123
|
+
'HostedNumberOrderSids' => Twilio.serialize_list(hosted_number_order_sids) { |e| e },
|
|
124
124
|
'AddressSid' => address_sid,
|
|
125
125
|
'Email' => email,
|
|
126
|
-
'CcEmails' => cc_emails,
|
|
126
|
+
'CcEmails' => Twilio.serialize_list(cc_emails) { |e| e },
|
|
127
127
|
})
|
|
128
128
|
|
|
129
129
|
payload = @version.create(
|
|
@@ -223,10 +223,10 @@ module Twilio
|
|
|
223
223
|
# @return [AuthorizationDocumentInstance] Updated AuthorizationDocumentInstance
|
|
224
224
|
def update(hosted_number_order_sids: :unset, address_sid: :unset, email: :unset, cc_emails: :unset, status: :unset)
|
|
225
225
|
data = Twilio::Values.of({
|
|
226
|
-
'HostedNumberOrderSids' => hosted_number_order_sids,
|
|
226
|
+
'HostedNumberOrderSids' => Twilio.serialize_list(hosted_number_order_sids) { |e| e },
|
|
227
227
|
'AddressSid' => address_sid,
|
|
228
228
|
'Email' => email,
|
|
229
|
-
'CcEmails' => cc_emails,
|
|
229
|
+
'CcEmails' => Twilio.serialize_list(cc_emails) { |e| e },
|
|
230
230
|
'Status' => status,
|
|
231
231
|
})
|
|
232
232
|
|
|
@@ -208,7 +208,7 @@ module Twilio
|
|
|
208
208
|
'AccountSid' => account_sid,
|
|
209
209
|
'FriendlyName' => friendly_name,
|
|
210
210
|
'UniqueName' => unique_name,
|
|
211
|
-
'CcEmails' => cc_emails,
|
|
211
|
+
'CcEmails' => Twilio.serialize_list(cc_emails) { |e| e },
|
|
212
212
|
'SmsUrl' => sms_url,
|
|
213
213
|
'SmsMethod' => sms_method,
|
|
214
214
|
'SmsFallbackUrl' => sms_fallback_url,
|
|
@@ -327,7 +327,7 @@ module Twilio
|
|
|
327
327
|
'FriendlyName' => friendly_name,
|
|
328
328
|
'UniqueName' => unique_name,
|
|
329
329
|
'Email' => email,
|
|
330
|
-
'CcEmails' => cc_emails,
|
|
330
|
+
'CcEmails' => Twilio.serialize_list(cc_emails) { |e| e },
|
|
331
331
|
'Status' => status,
|
|
332
332
|
'VerificationCode' => verification_code,
|
|
333
333
|
})
|
|
@@ -141,7 +141,7 @@ module Twilio
|
|
|
141
141
|
'UniqueName' => unique_name,
|
|
142
142
|
'Ttl' => ttl,
|
|
143
143
|
'Status' => status,
|
|
144
|
-
'Participants' => participants,
|
|
144
|
+
'Participants' => Twilio.serialize_list(participants) { |e| e },
|
|
145
145
|
})
|
|
146
146
|
|
|
147
147
|
payload = @version.create(
|
|
@@ -250,7 +250,7 @@ module Twilio
|
|
|
250
250
|
'UniqueName' => unique_name,
|
|
251
251
|
'Ttl' => ttl,
|
|
252
252
|
'Status' => status,
|
|
253
|
-
'Participants' => participants,
|
|
253
|
+
'Participants' => Twilio.serialize_list(participants) { |e| e },
|
|
254
254
|
})
|
|
255
255
|
|
|
256
256
|
payload = @version.update(
|
|
@@ -38,7 +38,7 @@ module Twilio
|
|
|
38
38
|
# Participant.
|
|
39
39
|
# @return [MessageInteractionInstance] Newly created MessageInteractionInstance
|
|
40
40
|
def create(body: :unset, media_url: :unset)
|
|
41
|
-
data = Twilio::Values.of({'Body' => body, 'MediaUrl' => media_url,})
|
|
41
|
+
data = Twilio::Values.of({'Body' => body, 'MediaUrl' => Twilio.serialize_list(media_url) { |e| e },})
|
|
42
42
|
|
|
43
43
|
payload = @version.create(
|
|
44
44
|
'POST',
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# \ / _ _ _| _ _
|
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
# / /
|
|
6
|
+
|
|
7
|
+
module Twilio
|
|
8
|
+
module REST
|
|
9
|
+
class Preview
|
|
10
|
+
class Understand < Version
|
|
11
|
+
##
|
|
12
|
+
# Initialize the Understand version of Preview
|
|
13
|
+
def initialize(domain)
|
|
14
|
+
super
|
|
15
|
+
@version = 'understand'
|
|
16
|
+
@services = nil
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
##
|
|
20
|
+
# @param [String] sid The sid
|
|
21
|
+
# @return [Twilio::REST::Preview::Understand::ServiceInstance] if sid was passed.
|
|
22
|
+
# @return [Twilio::REST::Preview::Understand::ServiceList]
|
|
23
|
+
def services(sid=:unset)
|
|
24
|
+
if sid.nil?
|
|
25
|
+
raise ArgumentError, 'sid cannot be nil'
|
|
26
|
+
elsif sid == :unset
|
|
27
|
+
@services ||= ServiceList.new self
|
|
28
|
+
else
|
|
29
|
+
ServiceContext.new(self, sid)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
##
|
|
34
|
+
# Provide a user friendly representation
|
|
35
|
+
def to_s
|
|
36
|
+
'<Twilio::REST::Preview::Understand>'
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# \ / _ _ _| _ _
|
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
# / /
|
|
6
|
+
|
|
7
|
+
module Twilio
|
|
8
|
+
module REST
|
|
9
|
+
class Preview < Domain
|
|
10
|
+
class Understand < Version
|
|
11
|
+
##
|
|
12
|
+
# 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.
|
|
13
|
+
class ServiceList < ListResource
|
|
14
|
+
##
|
|
15
|
+
# Initialize the ServiceList
|
|
16
|
+
# @param [Version] version Version that contains the resource
|
|
17
|
+
# @return [ServiceList] ServiceList
|
|
18
|
+
def initialize(version)
|
|
19
|
+
super(version)
|
|
20
|
+
|
|
21
|
+
# Path Solution
|
|
22
|
+
@solution = {}
|
|
23
|
+
@uri = "/Services"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
##
|
|
27
|
+
# Lists ServiceInstance records from the API as a list.
|
|
28
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
|
29
|
+
# memory before returning.
|
|
30
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
31
|
+
# guarantees to never return more than limit. Default is no limit
|
|
32
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
33
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
34
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
35
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
36
|
+
# @return [Array] Array of up to limit results
|
|
37
|
+
def list(limit: nil, page_size: nil)
|
|
38
|
+
self.stream(limit: limit, page_size: page_size).entries
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
##
|
|
42
|
+
# Streams ServiceInstance records from the API as an Enumerable.
|
|
43
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
44
|
+
# is reached.
|
|
45
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
46
|
+
# guarantees to never return more than limit. Default is no limit.
|
|
47
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
48
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
49
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
50
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
51
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
52
|
+
def stream(limit: nil, page_size: nil)
|
|
53
|
+
limits = @version.read_limits(limit, page_size)
|
|
54
|
+
|
|
55
|
+
page = self.page(page_size: limits[:page_size],)
|
|
56
|
+
|
|
57
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
##
|
|
61
|
+
# When passed a block, yields ServiceInstance records from the API.
|
|
62
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
63
|
+
# is reached.
|
|
64
|
+
def each
|
|
65
|
+
limits = @version.read_limits
|
|
66
|
+
|
|
67
|
+
page = self.page(page_size: limits[:page_size],)
|
|
68
|
+
|
|
69
|
+
@version.stream(page,
|
|
70
|
+
limit: limits[:limit],
|
|
71
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
##
|
|
75
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
|
76
|
+
# Request is executed immediately.
|
|
77
|
+
# @param [String] page_token PageToken provided by the API
|
|
78
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
|
79
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
|
80
|
+
# @return [Page] Page of ServiceInstance
|
|
81
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
|
82
|
+
params = Twilio::Values.of({
|
|
83
|
+
'PageToken' => page_token,
|
|
84
|
+
'Page' => page_number,
|
|
85
|
+
'PageSize' => page_size,
|
|
86
|
+
})
|
|
87
|
+
response = @version.page(
|
|
88
|
+
'GET',
|
|
89
|
+
@uri,
|
|
90
|
+
params
|
|
91
|
+
)
|
|
92
|
+
ServicePage.new(@version, response, @solution)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
##
|
|
96
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
|
97
|
+
# Request is executed immediately.
|
|
98
|
+
# @param [String] target_url API-generated URL for the requested results page
|
|
99
|
+
# @return [Page] Page of ServiceInstance
|
|
100
|
+
def get_page(target_url)
|
|
101
|
+
response = @version.domain.request(
|
|
102
|
+
'GET',
|
|
103
|
+
target_url
|
|
104
|
+
)
|
|
105
|
+
ServicePage.new(@version, response, @solution)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
##
|
|
109
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
|
110
|
+
# Request is executed immediately.
|
|
111
|
+
# @param [String] friendly_name The friendly_name
|
|
112
|
+
# @param [Boolean] log_queries The log_queries
|
|
113
|
+
# @param [String] ttl The ttl
|
|
114
|
+
# @param [String] unique_name The unique_name
|
|
115
|
+
# @return [ServiceInstance] Newly created ServiceInstance
|
|
116
|
+
def create(friendly_name: :unset, log_queries: :unset, ttl: :unset, unique_name: :unset)
|
|
117
|
+
data = Twilio::Values.of({
|
|
118
|
+
'FriendlyName' => friendly_name,
|
|
119
|
+
'LogQueries' => log_queries,
|
|
120
|
+
'Ttl' => ttl,
|
|
121
|
+
'UniqueName' => unique_name,
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
payload = @version.create(
|
|
125
|
+
'POST',
|
|
126
|
+
@uri,
|
|
127
|
+
data: data
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
ServiceInstance.new(@version, payload,)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
##
|
|
134
|
+
# Provide a user friendly representation
|
|
135
|
+
def to_s
|
|
136
|
+
'#<Twilio.Preview.Understand.ServiceList>'
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
##
|
|
141
|
+
# 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.
|
|
142
|
+
class ServicePage < Page
|
|
143
|
+
##
|
|
144
|
+
# Initialize the ServicePage
|
|
145
|
+
# @param [Version] version Version that contains the resource
|
|
146
|
+
# @param [Response] response Response from the API
|
|
147
|
+
# @param [Hash] solution Path solution for the resource
|
|
148
|
+
# @return [ServicePage] ServicePage
|
|
149
|
+
def initialize(version, response, solution)
|
|
150
|
+
super(version, response)
|
|
151
|
+
|
|
152
|
+
# Path Solution
|
|
153
|
+
@solution = solution
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
##
|
|
157
|
+
# Build an instance of ServiceInstance
|
|
158
|
+
# @param [Hash] payload Payload response from the API
|
|
159
|
+
# @return [ServiceInstance] ServiceInstance
|
|
160
|
+
def get_instance(payload)
|
|
161
|
+
ServiceInstance.new(@version, payload,)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
##
|
|
165
|
+
# Provide a user friendly representation
|
|
166
|
+
def to_s
|
|
167
|
+
'<Twilio.Preview.Understand.ServicePage>'
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
##
|
|
172
|
+
# 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.
|
|
173
|
+
class ServiceContext < InstanceContext
|
|
174
|
+
##
|
|
175
|
+
# Initialize the ServiceContext
|
|
176
|
+
# @param [Version] version Version that contains the resource
|
|
177
|
+
# @param [String] sid The sid
|
|
178
|
+
# @return [ServiceContext] ServiceContext
|
|
179
|
+
def initialize(version, sid)
|
|
180
|
+
super(version)
|
|
181
|
+
|
|
182
|
+
# Path Solution
|
|
183
|
+
@solution = {sid: sid,}
|
|
184
|
+
@uri = "/Services/#{@solution[:sid]}"
|
|
185
|
+
|
|
186
|
+
# Dependents
|
|
187
|
+
@field_types = nil
|
|
188
|
+
@intents = nil
|
|
189
|
+
@model_builds = nil
|
|
190
|
+
@queries = nil
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
##
|
|
194
|
+
# Fetch a ServiceInstance
|
|
195
|
+
# @return [ServiceInstance] Fetched ServiceInstance
|
|
196
|
+
def fetch
|
|
197
|
+
params = Twilio::Values.of({})
|
|
198
|
+
|
|
199
|
+
payload = @version.fetch(
|
|
200
|
+
'GET',
|
|
201
|
+
@uri,
|
|
202
|
+
params,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
ServiceInstance.new(@version, payload, sid: @solution[:sid],)
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
##
|
|
209
|
+
# Update the ServiceInstance
|
|
210
|
+
# @param [String] friendly_name The friendly_name
|
|
211
|
+
# @param [Boolean] log_queries The log_queries
|
|
212
|
+
# @param [String] ttl The ttl
|
|
213
|
+
# @param [String] unique_name The unique_name
|
|
214
|
+
# @return [ServiceInstance] Updated ServiceInstance
|
|
215
|
+
def update(friendly_name: :unset, log_queries: :unset, ttl: :unset, unique_name: :unset)
|
|
216
|
+
data = Twilio::Values.of({
|
|
217
|
+
'FriendlyName' => friendly_name,
|
|
218
|
+
'LogQueries' => log_queries,
|
|
219
|
+
'Ttl' => ttl,
|
|
220
|
+
'UniqueName' => unique_name,
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
payload = @version.update(
|
|
224
|
+
'POST',
|
|
225
|
+
@uri,
|
|
226
|
+
data: data,
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
ServiceInstance.new(@version, payload, sid: @solution[:sid],)
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
##
|
|
233
|
+
# Deletes the ServiceInstance
|
|
234
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
|
235
|
+
def delete
|
|
236
|
+
@version.delete('delete', @uri)
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
##
|
|
240
|
+
# Access the field_types
|
|
241
|
+
# @return [FieldTypeList]
|
|
242
|
+
# @return [FieldTypeContext] if sid was passed.
|
|
243
|
+
def field_types(sid=:unset)
|
|
244
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
|
245
|
+
|
|
246
|
+
if sid != :unset
|
|
247
|
+
return FieldTypeContext.new(@version, @solution[:sid], sid,)
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
unless @field_types
|
|
251
|
+
@field_types = FieldTypeList.new(@version, service_sid: @solution[:sid],)
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
@field_types
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
##
|
|
258
|
+
# Access the intents
|
|
259
|
+
# @return [IntentList]
|
|
260
|
+
# @return [IntentContext] if sid was passed.
|
|
261
|
+
def intents(sid=:unset)
|
|
262
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
|
263
|
+
|
|
264
|
+
if sid != :unset
|
|
265
|
+
return IntentContext.new(@version, @solution[:sid], sid,)
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
unless @intents
|
|
269
|
+
@intents = IntentList.new(@version, service_sid: @solution[:sid],)
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
@intents
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
##
|
|
276
|
+
# Access the model_builds
|
|
277
|
+
# @return [ModelBuildList]
|
|
278
|
+
# @return [ModelBuildContext] if sid was passed.
|
|
279
|
+
def model_builds(sid=:unset)
|
|
280
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
|
281
|
+
|
|
282
|
+
if sid != :unset
|
|
283
|
+
return ModelBuildContext.new(@version, @solution[:sid], sid,)
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
unless @model_builds
|
|
287
|
+
@model_builds = ModelBuildList.new(@version, service_sid: @solution[:sid],)
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
@model_builds
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
##
|
|
294
|
+
# Access the queries
|
|
295
|
+
# @return [QueryList]
|
|
296
|
+
# @return [QueryContext] if sid was passed.
|
|
297
|
+
def queries(sid=:unset)
|
|
298
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
|
299
|
+
|
|
300
|
+
if sid != :unset
|
|
301
|
+
return QueryContext.new(@version, @solution[:sid], sid,)
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
unless @queries
|
|
305
|
+
@queries = QueryList.new(@version, service_sid: @solution[:sid],)
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
@queries
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
##
|
|
312
|
+
# Provide a user friendly representation
|
|
313
|
+
def to_s
|
|
314
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
315
|
+
"#<Twilio.Preview.Understand.ServiceContext #{context}>"
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
##
|
|
320
|
+
# 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.
|
|
321
|
+
class ServiceInstance < InstanceResource
|
|
322
|
+
##
|
|
323
|
+
# Initialize the ServiceInstance
|
|
324
|
+
# @param [Version] version Version that contains the resource
|
|
325
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
326
|
+
# @param [String] sid The sid
|
|
327
|
+
# @return [ServiceInstance] ServiceInstance
|
|
328
|
+
def initialize(version, payload, sid: nil)
|
|
329
|
+
super(version)
|
|
330
|
+
|
|
331
|
+
# Marshaled Properties
|
|
332
|
+
@properties = {
|
|
333
|
+
'account_sid' => payload['account_sid'],
|
|
334
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
|
335
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
|
336
|
+
'friendly_name' => payload['friendly_name'],
|
|
337
|
+
'latest_model_build_sid' => payload['latest_model_build_sid'],
|
|
338
|
+
'links' => payload['links'],
|
|
339
|
+
'log_queries' => payload['log_queries'],
|
|
340
|
+
'sid' => payload['sid'],
|
|
341
|
+
'ttl' => payload['ttl'].to_i,
|
|
342
|
+
'unique_name' => payload['unique_name'],
|
|
343
|
+
'url' => payload['url'],
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
# Context
|
|
347
|
+
@instance_context = nil
|
|
348
|
+
@params = {'sid' => sid || @properties['sid'],}
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
##
|
|
352
|
+
# Generate an instance context for the instance, the context is capable of
|
|
353
|
+
# performing various actions. All instance actions are proxied to the context
|
|
354
|
+
# @return [ServiceContext] ServiceContext for this ServiceInstance
|
|
355
|
+
def context
|
|
356
|
+
unless @instance_context
|
|
357
|
+
@instance_context = ServiceContext.new(@version, @params['sid'],)
|
|
358
|
+
end
|
|
359
|
+
@instance_context
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
##
|
|
363
|
+
# @return [String] The account_sid
|
|
364
|
+
def account_sid
|
|
365
|
+
@properties['account_sid']
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
##
|
|
369
|
+
# @return [Time] The date_created
|
|
370
|
+
def date_created
|
|
371
|
+
@properties['date_created']
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
##
|
|
375
|
+
# @return [Time] The date_updated
|
|
376
|
+
def date_updated
|
|
377
|
+
@properties['date_updated']
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
##
|
|
381
|
+
# @return [String] The friendly_name
|
|
382
|
+
def friendly_name
|
|
383
|
+
@properties['friendly_name']
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
##
|
|
387
|
+
# @return [String] The latest_model_build_sid
|
|
388
|
+
def latest_model_build_sid
|
|
389
|
+
@properties['latest_model_build_sid']
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
##
|
|
393
|
+
# @return [String] The links
|
|
394
|
+
def links
|
|
395
|
+
@properties['links']
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
##
|
|
399
|
+
# @return [Boolean] The log_queries
|
|
400
|
+
def log_queries
|
|
401
|
+
@properties['log_queries']
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
##
|
|
405
|
+
# @return [String] The sid
|
|
406
|
+
def sid
|
|
407
|
+
@properties['sid']
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
##
|
|
411
|
+
# @return [String] The ttl
|
|
412
|
+
def ttl
|
|
413
|
+
@properties['ttl']
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
##
|
|
417
|
+
# @return [String] The unique_name
|
|
418
|
+
def unique_name
|
|
419
|
+
@properties['unique_name']
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
##
|
|
423
|
+
# @return [String] The url
|
|
424
|
+
def url
|
|
425
|
+
@properties['url']
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
##
|
|
429
|
+
# Fetch a ServiceInstance
|
|
430
|
+
# @return [ServiceInstance] Fetched ServiceInstance
|
|
431
|
+
def fetch
|
|
432
|
+
context.fetch
|
|
433
|
+
end
|
|
434
|
+
|
|
435
|
+
##
|
|
436
|
+
# Update the ServiceInstance
|
|
437
|
+
# @param [String] friendly_name The friendly_name
|
|
438
|
+
# @param [Boolean] log_queries The log_queries
|
|
439
|
+
# @param [String] ttl The ttl
|
|
440
|
+
# @param [String] unique_name The unique_name
|
|
441
|
+
# @return [ServiceInstance] Updated ServiceInstance
|
|
442
|
+
def update(friendly_name: :unset, log_queries: :unset, ttl: :unset, unique_name: :unset)
|
|
443
|
+
context.update(
|
|
444
|
+
friendly_name: friendly_name,
|
|
445
|
+
log_queries: log_queries,
|
|
446
|
+
ttl: ttl,
|
|
447
|
+
unique_name: unique_name,
|
|
448
|
+
)
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
##
|
|
452
|
+
# Deletes the ServiceInstance
|
|
453
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
|
454
|
+
def delete
|
|
455
|
+
context.delete
|
|
456
|
+
end
|
|
457
|
+
|
|
458
|
+
##
|
|
459
|
+
# Access the field_types
|
|
460
|
+
# @return [field_types] field_types
|
|
461
|
+
def field_types
|
|
462
|
+
context.field_types
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
##
|
|
466
|
+
# Access the intents
|
|
467
|
+
# @return [intents] intents
|
|
468
|
+
def intents
|
|
469
|
+
context.intents
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
##
|
|
473
|
+
# Access the model_builds
|
|
474
|
+
# @return [model_builds] model_builds
|
|
475
|
+
def model_builds
|
|
476
|
+
context.model_builds
|
|
477
|
+
end
|
|
478
|
+
|
|
479
|
+
##
|
|
480
|
+
# Access the queries
|
|
481
|
+
# @return [queries] queries
|
|
482
|
+
def queries
|
|
483
|
+
context.queries
|
|
484
|
+
end
|
|
485
|
+
|
|
486
|
+
##
|
|
487
|
+
# Provide a user friendly representation
|
|
488
|
+
def to_s
|
|
489
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
490
|
+
"<Twilio.Preview.Understand.ServiceInstance #{values}>"
|
|
491
|
+
end
|
|
492
|
+
|
|
493
|
+
##
|
|
494
|
+
# Provide a detailed, user friendly representation
|
|
495
|
+
def inspect
|
|
496
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
497
|
+
"<Twilio.Preview.Understand.ServiceInstance #{values}>"
|
|
498
|
+
end
|
|
499
|
+
end
|
|
500
|
+
end
|
|
501
|
+
end
|
|
502
|
+
end
|
|
503
|
+
end
|