twilio-ruby 5.0.0.rc16 → 5.0.0.rc17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHORS.md +1 -0
- data/CHANGES.md +1 -1
- data/README.md +2 -2
- data/lib/twilio-ruby/jwt/access_token.rb +23 -1
- data/lib/twilio-ruby/rest/api.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account.rb +19 -11
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +29 -5
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +5 -5
- data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +25 -0
- data/lib/twilio-ruby/rest/api/v2010/account/short_code.rb +406 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +2 -6
- data/lib/twilio-ruby/rest/{notifications.rb → chat.rb} +6 -6
- data/lib/twilio-ruby/rest/{notifications → chat}/v1.rb +3 -3
- data/lib/twilio-ruby/rest/{notifications → chat}/v1/credential.rb +5 -5
- data/lib/twilio-ruby/rest/chat/v1/service.rb +501 -0
- data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +468 -0
- data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +351 -0
- data/lib/twilio-ruby/rest/{api/v2010/account/sms/sms_message.rb → chat/v1/service/channel/message.rb} +120 -168
- data/lib/twilio-ruby/rest/chat/v1/service/role.rb +373 -0
- data/lib/twilio-ruby/rest/chat/v1/service/user.rb +378 -0
- data/lib/twilio-ruby/rest/client.rb +19 -8
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +3 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +2 -6
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +5 -1
- data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +5 -0
- data/lib/twilio-ruby/rest/notify.rb +44 -0
- data/lib/twilio-ruby/rest/notify/v1.rb +44 -0
- data/lib/twilio-ruby/rest/notify/v1/credential.rb +375 -0
- data/lib/twilio-ruby/rest/{notifications → notify}/v1/service.rb +5 -5
- data/lib/twilio-ruby/rest/{notifications → notify}/v1/service/binding.rb +5 -5
- data/lib/twilio-ruby/rest/{notifications → notify}/v1/service/notification.rb +4 -4
- data/lib/twilio-ruby/rest/preview.rb +11 -0
- data/lib/twilio-ruby/rest/preview/sync.rb +35 -0
- data/lib/twilio-ruby/rest/preview/sync/service.rb +458 -0
- data/lib/twilio-ruby/rest/preview/sync/service/document.rb +376 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb +375 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb +409 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb +375 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb +411 -0
- data/lib/twilio-ruby/rest/preview/wireless/device.rb +6 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +55 -3
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +29 -6
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +294 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +32 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb +374 -0
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/conference/participant_spec.rb +6 -6
- data/spec/integration/api/v2010/account/recording_spec.rb +10 -1
- data/spec/integration/api/v2010/account/{sms/short_code_spec.rb → short_code_spec.rb} +0 -7
- data/spec/integration/api/v2010/account/sip/credential_list/credential_spec.rb +3 -7
- data/spec/integration/chat/v1/credential_spec.rb +223 -0
- data/spec/integration/chat/v1/service/channel/member_spec.rb +213 -0
- data/spec/integration/chat/v1/service/channel/message_spec.rb +100 -0
- data/spec/integration/chat/v1/service/channel_spec.rb +259 -0
- data/spec/integration/chat/v1/service/role_spec.rb +263 -0
- data/spec/integration/chat/v1/service/user_spec.rb +242 -0
- data/spec/integration/chat/v1/service_spec.rb +263 -0
- data/spec/integration/ip_messaging/v1/service/role_spec.rb +2 -3
- data/spec/integration/ip_messaging/v1/service/user_spec.rb +2 -3
- data/spec/integration/lookups/v1/phone_number_spec.rb +5 -0
- data/spec/integration/{notifications → notify}/v1/credential_spec.rb +24 -24
- data/spec/integration/{notifications → notify}/v1/service/binding_spec.rb +29 -29
- data/spec/integration/{notifications → notify}/v1/service/notification_spec.rb +5 -5
- data/spec/integration/{notifications → notify}/v1/service_spec.rb +32 -32
- data/spec/integration/preview/sync/service/document_spec.rb +92 -0
- data/spec/integration/preview/sync/service/sync_list/sync_list_item_spec.rb +100 -0
- data/spec/integration/preview/sync/service/sync_list_spec.rb +73 -0
- data/spec/integration/preview/sync/service/sync_map/sync_map_item_spec.rb +101 -0
- data/spec/integration/preview/sync/service/sync_map_spec.rb +73 -0
- data/spec/integration/preview/sync/service_spec.rb +84 -0
- data/spec/integration/taskrouter/v1/workspace/task_channel_spec.rb +127 -0
- data/spec/integration/taskrouter/v1/workspace/task_spec.rb +8 -0
- data/spec/integration/taskrouter/v1/workspace/worker/worker_channel_spec.rb +201 -0
- data/spec/integration/taskrouter/v1/workspace/workflow_spec.rb +2 -3
- data/spec/integration/taskrouter/v1/workspace_spec.rb +8 -0
- data/spec/jwt/access_token_spec.rb +27 -0
- metadata +84 -42
- data/lib/twilio-ruby/rest/api/v2010/account/sms.rb +0 -134
- data/lib/twilio-ruby/rest/api/v2010/account/sms/short_code.rb +0 -408
- data/spec/integration/api/v2010/account/sms/sms_message_spec.rb +0 -275
- data/spec/integration/api/v2010/account/sms_spec.rb +0 -10
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Twilio
|
8
8
|
module REST
|
9
|
-
class
|
9
|
+
class Notify < Domain
|
10
10
|
class V1 < Version
|
11
11
|
class ServiceList < ListResource
|
12
12
|
##
|
@@ -149,7 +149,7 @@ module Twilio
|
|
149
149
|
##
|
150
150
|
# Provide a user friendly representation
|
151
151
|
def to_s
|
152
|
-
'#<Twilio.
|
152
|
+
'#<Twilio.Notify.V1.ServiceList>'
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
@@ -181,7 +181,7 @@ module Twilio
|
|
181
181
|
##
|
182
182
|
# Provide a user friendly representation
|
183
183
|
def to_s
|
184
|
-
'<Twilio.
|
184
|
+
'<Twilio.Notify.V1.ServicePage>'
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
@@ -307,7 +307,7 @@ module Twilio
|
|
307
307
|
# Provide a user friendly representation
|
308
308
|
def to_s
|
309
309
|
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
310
|
-
"#<Twilio.
|
310
|
+
"#<Twilio.Notify.V1.ServiceContext #{context}>"
|
311
311
|
end
|
312
312
|
end
|
313
313
|
|
@@ -468,7 +468,7 @@ module Twilio
|
|
468
468
|
# Provide a user friendly representation
|
469
469
|
def to_s
|
470
470
|
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
471
|
-
"<Twilio.
|
471
|
+
"<Twilio.Notify.V1.ServiceInstance #{values}>"
|
472
472
|
end
|
473
473
|
end
|
474
474
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Twilio
|
8
8
|
module REST
|
9
|
-
class
|
9
|
+
class Notify < Domain
|
10
10
|
class V1 < Version
|
11
11
|
class ServiceContext < InstanceContext
|
12
12
|
class BindingList < ListResource
|
@@ -199,7 +199,7 @@ module Twilio
|
|
199
199
|
##
|
200
200
|
# Provide a user friendly representation
|
201
201
|
def to_s
|
202
|
-
'#<Twilio.
|
202
|
+
'#<Twilio.Notify.V1.BindingList>'
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
@@ -233,7 +233,7 @@ module Twilio
|
|
233
233
|
##
|
234
234
|
# Provide a user friendly representation
|
235
235
|
def to_s
|
236
|
-
'<Twilio.
|
236
|
+
'<Twilio.Notify.V1.BindingPage>'
|
237
237
|
end
|
238
238
|
end
|
239
239
|
|
@@ -286,7 +286,7 @@ module Twilio
|
|
286
286
|
# Provide a user friendly representation
|
287
287
|
def to_s
|
288
288
|
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
289
|
-
"#<Twilio.
|
289
|
+
"#<Twilio.Notify.V1.BindingContext #{context}>"
|
290
290
|
end
|
291
291
|
end
|
292
292
|
|
@@ -407,7 +407,7 @@ module Twilio
|
|
407
407
|
# Provide a user friendly representation
|
408
408
|
def to_s
|
409
409
|
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
410
|
-
"<Twilio.
|
410
|
+
"<Twilio.Notify.V1.BindingInstance #{values}>"
|
411
411
|
end
|
412
412
|
end
|
413
413
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Twilio
|
8
8
|
module REST
|
9
|
-
class
|
9
|
+
class Notify < Domain
|
10
10
|
class V1 < Version
|
11
11
|
class ServiceContext < InstanceContext
|
12
12
|
class NotificationList < ListResource
|
@@ -75,7 +75,7 @@ module Twilio
|
|
75
75
|
##
|
76
76
|
# Provide a user friendly representation
|
77
77
|
def to_s
|
78
|
-
'#<Twilio.
|
78
|
+
'#<Twilio.Notify.V1.NotificationList>'
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -109,7 +109,7 @@ module Twilio
|
|
109
109
|
##
|
110
110
|
# Provide a user friendly representation
|
111
111
|
def to_s
|
112
|
-
'<Twilio.
|
112
|
+
'<Twilio.Notify.V1.NotificationPage>'
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
@@ -216,7 +216,7 @@ module Twilio
|
|
216
216
|
##
|
217
217
|
# Provide a user friendly representation
|
218
218
|
def to_s
|
219
|
-
"<Twilio.
|
219
|
+
"<Twilio.Notify.V1.NotificationInstance>"
|
220
220
|
end
|
221
221
|
end
|
222
222
|
end
|
@@ -18,6 +18,7 @@ module Twilio
|
|
18
18
|
|
19
19
|
# Versions
|
20
20
|
@wireless = nil
|
21
|
+
@sync = nil
|
21
22
|
end
|
22
23
|
|
23
24
|
##
|
@@ -26,6 +27,12 @@ module Twilio
|
|
26
27
|
@wireless ||= Wireless.new self
|
27
28
|
end
|
28
29
|
|
30
|
+
##
|
31
|
+
# Version sync of preview
|
32
|
+
def sync
|
33
|
+
@sync ||= Sync.new self
|
34
|
+
end
|
35
|
+
|
29
36
|
def commands
|
30
37
|
self.wireless.commands
|
31
38
|
end
|
@@ -38,6 +45,10 @@ module Twilio
|
|
38
45
|
self.wireless.rate_plans
|
39
46
|
end
|
40
47
|
|
48
|
+
def services
|
49
|
+
self.sync.services
|
50
|
+
end
|
51
|
+
|
41
52
|
##
|
42
53
|
# Provide a user friendly representation
|
43
54
|
def to_s
|
@@ -0,0 +1,35 @@
|
|
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 Sync < Version
|
11
|
+
##
|
12
|
+
# Initialize the Sync version of Preview
|
13
|
+
def initialize(domain)
|
14
|
+
super
|
15
|
+
@version = 'Sync'
|
16
|
+
@services = nil
|
17
|
+
end
|
18
|
+
|
19
|
+
def services(sid=:unset)
|
20
|
+
if sid == :unset
|
21
|
+
@services ||= ServiceList.new self
|
22
|
+
else
|
23
|
+
ServiceContext.new(self, sid)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Provide a user friendly representation
|
29
|
+
def to_s
|
30
|
+
'<Twilio::REST::Preview::Sync>'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,458 @@
|
|
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 Sync < Version
|
11
|
+
class ServiceList < ListResource
|
12
|
+
##
|
13
|
+
# Initialize the ServiceList
|
14
|
+
# @param [Version] version Version that contains the resource
|
15
|
+
# @return [ServiceList] ServiceList
|
16
|
+
def initialize(version)
|
17
|
+
super(version)
|
18
|
+
|
19
|
+
# Path Solution
|
20
|
+
@solution = {}
|
21
|
+
@uri = "/Services"
|
22
|
+
end
|
23
|
+
|
24
|
+
##
|
25
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
26
|
+
# Request is executed immediately.
|
27
|
+
# @param [String] friendly_name The friendly_name
|
28
|
+
# @param [String] webhook_url The webhook_url
|
29
|
+
# @param [Boolean] reachability_webhooks_enabled The reachability_webhooks_enabled
|
30
|
+
# @return [ServiceInstance] Newly created ServiceInstance
|
31
|
+
def create(friendly_name: nil, webhook_url: nil, reachability_webhooks_enabled: nil)
|
32
|
+
data = {
|
33
|
+
'FriendlyName' => friendly_name,
|
34
|
+
'WebhookUrl' => webhook_url,
|
35
|
+
'ReachabilityWebhooksEnabled' => reachability_webhooks_enabled,
|
36
|
+
}
|
37
|
+
|
38
|
+
payload = @version.create(
|
39
|
+
'POST',
|
40
|
+
@uri,
|
41
|
+
data: data
|
42
|
+
)
|
43
|
+
|
44
|
+
return ServiceInstance.new(
|
45
|
+
@version,
|
46
|
+
payload,
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# Lists ServiceInstance records from the API as a list.
|
52
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
53
|
+
# memory before returning.
|
54
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
55
|
+
# guarantees to never return more than limit. Default is no limit
|
56
|
+
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
57
|
+
# the default value of 50 records. If no page_size is defined
|
58
|
+
# but a limit is defined, stream() will attempt to read the
|
59
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
60
|
+
# @return [Array] Array of up to limit results
|
61
|
+
def list(limit: nil, page_size: nil)
|
62
|
+
self.stream(
|
63
|
+
limit: limit,
|
64
|
+
page_size: page_size
|
65
|
+
).entries
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
# Streams ServiceInstance records from the API as an Enumerable.
|
70
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
71
|
+
# is reached.
|
72
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
73
|
+
# guarantees to never return more than limit. Default is no limit
|
74
|
+
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
75
|
+
# the default value of 50 records. If no page_size is defined
|
76
|
+
# but a limit is defined, stream() will attempt to read the
|
77
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
78
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
79
|
+
def stream(limit: nil, page_size: nil)
|
80
|
+
limits = @version.read_limits(limit, page_size)
|
81
|
+
|
82
|
+
page = self.page(
|
83
|
+
page_size: limits[:page_size],
|
84
|
+
)
|
85
|
+
|
86
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
87
|
+
end
|
88
|
+
|
89
|
+
##
|
90
|
+
# When passed a block, yields ServiceInstance records from the API.
|
91
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
92
|
+
# is reached.
|
93
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
94
|
+
# guarantees to never return more than limit. Default is no limit
|
95
|
+
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
96
|
+
# the default value of 50 records. If no page_size is defined
|
97
|
+
# but a limit is defined, stream() will attempt to read the
|
98
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
99
|
+
def each
|
100
|
+
limits = @version.read_limits
|
101
|
+
|
102
|
+
page = self.page(
|
103
|
+
page_size: limits[:page_size],
|
104
|
+
)
|
105
|
+
|
106
|
+
@version.stream(page,
|
107
|
+
limit: limits[:limit],
|
108
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
109
|
+
end
|
110
|
+
|
111
|
+
##
|
112
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
113
|
+
# Request is executed immediately.
|
114
|
+
# @param [String] page_token PageToken provided by the API
|
115
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
116
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
117
|
+
# @return [Page] Page of ServiceInstance
|
118
|
+
def page(page_token: nil, page_number: nil, page_size: nil)
|
119
|
+
params = {
|
120
|
+
'PageToken' => page_token,
|
121
|
+
'Page' => page_number,
|
122
|
+
'PageSize' => page_size,
|
123
|
+
}
|
124
|
+
response = @version.page(
|
125
|
+
'GET',
|
126
|
+
@uri,
|
127
|
+
params
|
128
|
+
)
|
129
|
+
return ServicePage.new(@version, response, @solution)
|
130
|
+
end
|
131
|
+
|
132
|
+
##
|
133
|
+
# Provide a user friendly representation
|
134
|
+
def to_s
|
135
|
+
'#<Twilio.Preview.Sync.ServiceList>'
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
class ServicePage < Page
|
140
|
+
##
|
141
|
+
# Initialize the ServicePage
|
142
|
+
# @param [Version] version Version that contains the resource
|
143
|
+
# @param [Response] response Response from the API
|
144
|
+
# @param [Hash] solution Path solution for the resource
|
145
|
+
# @return [ServicePage] ServicePage
|
146
|
+
def initialize(version, response, solution)
|
147
|
+
super(version, response)
|
148
|
+
|
149
|
+
# Path Solution
|
150
|
+
@solution = solution
|
151
|
+
end
|
152
|
+
|
153
|
+
##
|
154
|
+
# Build an instance of ServiceInstance
|
155
|
+
# @param [Hash] payload Payload response from the API
|
156
|
+
# @return [ServiceInstance] ServiceInstance
|
157
|
+
def get_instance(payload)
|
158
|
+
return ServiceInstance.new(
|
159
|
+
@version,
|
160
|
+
payload,
|
161
|
+
)
|
162
|
+
end
|
163
|
+
|
164
|
+
##
|
165
|
+
# Provide a user friendly representation
|
166
|
+
def to_s
|
167
|
+
'<Twilio.Preview.Sync.ServicePage>'
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
class ServiceContext < InstanceContext
|
172
|
+
##
|
173
|
+
# Initialize the ServiceContext
|
174
|
+
# @param [Version] version Version that contains the resource
|
175
|
+
# @param [String] sid The sid
|
176
|
+
# @return [ServiceContext] ServiceContext
|
177
|
+
def initialize(version, sid)
|
178
|
+
super(version)
|
179
|
+
|
180
|
+
# Path Solution
|
181
|
+
@solution = {
|
182
|
+
sid: sid,
|
183
|
+
}
|
184
|
+
@uri = "/Services/#{@solution[:sid]}"
|
185
|
+
|
186
|
+
# Dependents
|
187
|
+
@documents = nil
|
188
|
+
@sync_lists = nil
|
189
|
+
@sync_maps = nil
|
190
|
+
end
|
191
|
+
|
192
|
+
##
|
193
|
+
# Fetch a ServiceInstance
|
194
|
+
# @return [ServiceInstance] Fetched ServiceInstance
|
195
|
+
def fetch
|
196
|
+
params = {}
|
197
|
+
|
198
|
+
payload = @version.fetch(
|
199
|
+
'GET',
|
200
|
+
@uri,
|
201
|
+
params,
|
202
|
+
)
|
203
|
+
|
204
|
+
return ServiceInstance.new(
|
205
|
+
@version,
|
206
|
+
payload,
|
207
|
+
sid: @solution[:sid],
|
208
|
+
)
|
209
|
+
end
|
210
|
+
|
211
|
+
##
|
212
|
+
# Deletes the ServiceInstance
|
213
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
214
|
+
def delete
|
215
|
+
return @version.delete('delete', @uri)
|
216
|
+
end
|
217
|
+
|
218
|
+
##
|
219
|
+
# Update the ServiceInstance
|
220
|
+
# @param [String] webhook_url The webhook_url
|
221
|
+
# @param [String] friendly_name The friendly_name
|
222
|
+
# @param [Boolean] reachability_webhooks_enabled The reachability_webhooks_enabled
|
223
|
+
# @return [ServiceInstance] Updated ServiceInstance
|
224
|
+
def update(webhook_url: nil, friendly_name: nil, reachability_webhooks_enabled: nil)
|
225
|
+
data = {
|
226
|
+
'WebhookUrl' => webhook_url,
|
227
|
+
'FriendlyName' => friendly_name,
|
228
|
+
'ReachabilityWebhooksEnabled' => reachability_webhooks_enabled,
|
229
|
+
}
|
230
|
+
|
231
|
+
payload = @version.update(
|
232
|
+
'POST',
|
233
|
+
@uri,
|
234
|
+
data: data,
|
235
|
+
)
|
236
|
+
|
237
|
+
return ServiceInstance.new(
|
238
|
+
@version,
|
239
|
+
payload,
|
240
|
+
sid: @solution[:sid],
|
241
|
+
)
|
242
|
+
end
|
243
|
+
|
244
|
+
##
|
245
|
+
# Access the documents
|
246
|
+
# @return [DocumentList] DocumentList
|
247
|
+
def documents(sid=:unset)
|
248
|
+
if sid != :unset
|
249
|
+
return DocumentContext.new(
|
250
|
+
@version,
|
251
|
+
@solution[:sid],
|
252
|
+
sid,
|
253
|
+
)
|
254
|
+
end
|
255
|
+
|
256
|
+
unless @documents
|
257
|
+
@documents = DocumentList.new(
|
258
|
+
@version,
|
259
|
+
service_sid: @solution[:sid],
|
260
|
+
)
|
261
|
+
end
|
262
|
+
|
263
|
+
@documents
|
264
|
+
end
|
265
|
+
|
266
|
+
##
|
267
|
+
# Access the sync_lists
|
268
|
+
# @return [SyncListList] SyncListList
|
269
|
+
def sync_lists(sid=:unset)
|
270
|
+
if sid != :unset
|
271
|
+
return SyncListContext.new(
|
272
|
+
@version,
|
273
|
+
@solution[:sid],
|
274
|
+
sid,
|
275
|
+
)
|
276
|
+
end
|
277
|
+
|
278
|
+
unless @sync_lists
|
279
|
+
@sync_lists = SyncListList.new(
|
280
|
+
@version,
|
281
|
+
service_sid: @solution[:sid],
|
282
|
+
)
|
283
|
+
end
|
284
|
+
|
285
|
+
@sync_lists
|
286
|
+
end
|
287
|
+
|
288
|
+
##
|
289
|
+
# Access the sync_maps
|
290
|
+
# @return [SyncMapList] SyncMapList
|
291
|
+
def sync_maps(sid=:unset)
|
292
|
+
if sid != :unset
|
293
|
+
return SyncMapContext.new(
|
294
|
+
@version,
|
295
|
+
@solution[:sid],
|
296
|
+
sid,
|
297
|
+
)
|
298
|
+
end
|
299
|
+
|
300
|
+
unless @sync_maps
|
301
|
+
@sync_maps = SyncMapList.new(
|
302
|
+
@version,
|
303
|
+
service_sid: @solution[:sid],
|
304
|
+
)
|
305
|
+
end
|
306
|
+
|
307
|
+
@sync_maps
|
308
|
+
end
|
309
|
+
|
310
|
+
##
|
311
|
+
# Provide a user friendly representation
|
312
|
+
def to_s
|
313
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
314
|
+
"#<Twilio.Preview.Sync.ServiceContext #{context}>"
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
class ServiceInstance < InstanceResource
|
319
|
+
##
|
320
|
+
# Initialize the ServiceInstance
|
321
|
+
# @param [Version] version Version that contains the resource
|
322
|
+
# @param [Hash] payload payload that contains response from Twilio
|
323
|
+
# @param [String] sid The sid
|
324
|
+
# @return [ServiceInstance] ServiceInstance
|
325
|
+
def initialize(version, payload, sid: nil)
|
326
|
+
super(version)
|
327
|
+
|
328
|
+
# Marshaled Properties
|
329
|
+
@properties = {
|
330
|
+
'sid' => payload['sid'],
|
331
|
+
'account_sid' => payload['account_sid'],
|
332
|
+
'friendly_name' => payload['friendly_name'],
|
333
|
+
'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
|
334
|
+
'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
|
335
|
+
'url' => payload['url'],
|
336
|
+
'webhook_url' => payload['webhook_url'],
|
337
|
+
'reachability_webhooks_enabled' => payload['reachability_webhooks_enabled'],
|
338
|
+
'links' => payload['links'],
|
339
|
+
}
|
340
|
+
|
341
|
+
# Context
|
342
|
+
@instance_context = nil
|
343
|
+
@params = {
|
344
|
+
'sid' => sid || @properties['sid'],
|
345
|
+
}
|
346
|
+
end
|
347
|
+
|
348
|
+
##
|
349
|
+
# Generate an instance context for the instance, the context is capable of
|
350
|
+
# performing various actions. All instance actions are proxied to the context
|
351
|
+
# @param [Version] version Version that contains the resource
|
352
|
+
# @return [ServiceContext] ServiceContext for this ServiceInstance
|
353
|
+
def context
|
354
|
+
unless @instance_context
|
355
|
+
@instance_context = ServiceContext.new(
|
356
|
+
@version,
|
357
|
+
@params['sid'],
|
358
|
+
)
|
359
|
+
end
|
360
|
+
@instance_context
|
361
|
+
end
|
362
|
+
|
363
|
+
def sid
|
364
|
+
@properties['sid']
|
365
|
+
end
|
366
|
+
|
367
|
+
def account_sid
|
368
|
+
@properties['account_sid']
|
369
|
+
end
|
370
|
+
|
371
|
+
def friendly_name
|
372
|
+
@properties['friendly_name']
|
373
|
+
end
|
374
|
+
|
375
|
+
def date_created
|
376
|
+
@properties['date_created']
|
377
|
+
end
|
378
|
+
|
379
|
+
def date_updated
|
380
|
+
@properties['date_updated']
|
381
|
+
end
|
382
|
+
|
383
|
+
def url
|
384
|
+
@properties['url']
|
385
|
+
end
|
386
|
+
|
387
|
+
def webhook_url
|
388
|
+
@properties['webhook_url']
|
389
|
+
end
|
390
|
+
|
391
|
+
def reachability_webhooks_enabled
|
392
|
+
@properties['reachability_webhooks_enabled']
|
393
|
+
end
|
394
|
+
|
395
|
+
def links
|
396
|
+
@properties['links']
|
397
|
+
end
|
398
|
+
|
399
|
+
##
|
400
|
+
# Fetch a ServiceInstance
|
401
|
+
# @return [ServiceInstance] Fetched ServiceInstance
|
402
|
+
def fetch
|
403
|
+
context.fetch
|
404
|
+
end
|
405
|
+
|
406
|
+
##
|
407
|
+
# Deletes the ServiceInstance
|
408
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
409
|
+
def delete
|
410
|
+
context.delete
|
411
|
+
end
|
412
|
+
|
413
|
+
##
|
414
|
+
# Update the ServiceInstance
|
415
|
+
# @param [String] webhook_url The webhook_url
|
416
|
+
# @param [String] friendly_name The friendly_name
|
417
|
+
# @param [Boolean] reachability_webhooks_enabled The reachability_webhooks_enabled
|
418
|
+
# @return [ServiceInstance] Updated ServiceInstance
|
419
|
+
def update(webhook_url: nil, friendly_name: nil, reachability_webhooks_enabled: nil)
|
420
|
+
context.update(
|
421
|
+
webhook_url: webhook_url,
|
422
|
+
friendly_name: friendly_name,
|
423
|
+
reachability_webhooks_enabled: reachability_webhooks_enabled,
|
424
|
+
)
|
425
|
+
end
|
426
|
+
|
427
|
+
##
|
428
|
+
# Access the documents
|
429
|
+
# @return [documents] documents
|
430
|
+
def documents
|
431
|
+
context.documents
|
432
|
+
end
|
433
|
+
|
434
|
+
##
|
435
|
+
# Access the sync_lists
|
436
|
+
# @return [sync_lists] sync_lists
|
437
|
+
def sync_lists
|
438
|
+
context.sync_lists
|
439
|
+
end
|
440
|
+
|
441
|
+
##
|
442
|
+
# Access the sync_maps
|
443
|
+
# @return [sync_maps] sync_maps
|
444
|
+
def sync_maps
|
445
|
+
context.sync_maps
|
446
|
+
end
|
447
|
+
|
448
|
+
##
|
449
|
+
# Provide a user friendly representation
|
450
|
+
def to_s
|
451
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
452
|
+
"<Twilio.Preview.Sync.ServiceInstance #{values}>"
|
453
|
+
end
|
454
|
+
end
|
455
|
+
end
|
456
|
+
end
|
457
|
+
end
|
458
|
+
end
|