twilio-ruby 5.3.0 → 5.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/CHANGES.md +9 -0
- data/README.md +2 -11
- data/lib/twilio-ruby.rb +17 -0
- data/lib/twilio-ruby/rest/client.rb +3 -3
- data/lib/twilio-ruby/rest/preview.rb +7 -0
- data/lib/twilio-ruby/rest/preview/acc_security.rb +41 -0
- data/lib/twilio-ruby/rest/preview/acc_security/service.rb +429 -0
- data/lib/twilio-ruby/rest/preview/acc_security/service/verification.rb +197 -0
- data/lib/twilio-ruby/rest/preview/acc_security/service/verification_check.rb +193 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +14 -14
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +35 -44
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.rb +1 -1
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +14 -14
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb +14 -14
- data/lib/twilio-ruby/util.rb +2 -0
- data/lib/twilio-ruby/util/configuration.rb +17 -0
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/preview/acc_security/service/verification_check_spec.rb +52 -0
- data/spec/integration/preview/acc_security/service/verification_spec.rb +53 -0
- data/spec/integration/preview/acc_security/service_spec.rb +185 -0
- data/spec/integration/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics_spec.rb +2 -2
- data/spec/integration/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics_spec.rb +2 -2
- data/spec/integration/taskrouter/v1/workspace/task_queue/task_queue_statistics_spec.rb +2 -2
- data/spec/integration/taskrouter/v1/workspace/task_queue/task_queues_statistics_spec.rb +6 -6
- data/spec/integration/taskrouter/v1/workspace/task_queue_spec.rb +12 -16
- data/spec/integration/taskrouter/v1/workspace/worker/workers_cumulative_statistics_spec.rb +2 -2
- data/spec/integration/taskrouter/v1/workspace/worker/workers_real_time_statistics_spec.rb +2 -2
- data/spec/integration/taskrouter/v1/workspace/worker_spec.rb +12 -8
- data/spec/integration/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics_spec.rb +2 -2
- data/spec/integration/taskrouter/v1/workspace/workflow/workflow_real_time_statistics_spec.rb +2 -2
- data/spec/integration/taskrouter/v1/workspace/workflow_spec.rb +8 -8
- data/spec/integration/taskrouter/v1/workspace/workspace_cumulative_statistics_spec.rb +2 -2
- data/spec/integration/taskrouter/v1/workspace/workspace_real_time_statistics_spec.rb +2 -2
- data/spec/integration/taskrouter/v1/workspace_spec.rb +8 -8
- data/spec/twilio_spec.rb +15 -0
- data/spec/util/configuration_spec.rb +15 -0
- metadata +16 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28600f3f5e0d481da956dbb2220933c52aa949dd
|
4
|
+
data.tar.gz: 83b9e42f778ae67c4d9d3c7a6690cbabba9de09d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88883d2d4ba13c23d42d602e8e244d1606b717197cb854a9803a8c6f0da6338c179e6ac55a7f24b9c3965eda91936ccd50e2611acc3653c594c7277134e16ca3
|
7
|
+
data.tar.gz: 95c16494c7f80f1ce8d22891a81e5fd1fc64e0bb0af5b38f0457a30d21b01be950030fe5b5e7709f80f6cd29d2477ca1e9346c6a440c2f19c0fea932d91c7a3b
|
data/.rubocop.yml
CHANGED
data/CHANGES.md
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
[2017-10-06] Version 5.3.1
|
5
|
+
---------------------------
|
6
|
+
**Preview**
|
7
|
+
- Add `acc_security` (authy-phone-verification) initial api-definitions
|
8
|
+
|
9
|
+
**Taskrouter**
|
10
|
+
- [bi] Less verbose naming of cumulative and real time statistics
|
11
|
+
|
12
|
+
|
4
13
|
[2017-09-29] Version 5.3.0
|
5
14
|
---------------------------
|
6
15
|
**Library**
|
data/README.md
CHANGED
@@ -27,13 +27,13 @@ in-line code documentation here in the library.
|
|
27
27
|
To install using [Bundler][bundler] grab the latest stable version:
|
28
28
|
|
29
29
|
```ruby
|
30
|
-
gem 'twilio-ruby', '~> 5.3.
|
30
|
+
gem 'twilio-ruby', '~> 5.3.1'
|
31
31
|
```
|
32
32
|
|
33
33
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
34
34
|
|
35
35
|
```bash
|
36
|
-
gem install twilio-ruby -v 5.3.
|
36
|
+
gem install twilio-ruby -v 5.3.1
|
37
37
|
```
|
38
38
|
|
39
39
|
To build and install the development branch yourself from the latest source:
|
@@ -66,15 +66,6 @@ auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
|
|
66
66
|
|
67
67
|
# set up a client to talk to the Twilio REST API
|
68
68
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
69
|
-
|
70
|
-
# alternatively, you can preconfigure the client like so
|
71
|
-
Twilio.configure do |config|
|
72
|
-
config.account_sid = account_sid
|
73
|
-
config.auth_token = auth_token
|
74
|
-
end
|
75
|
-
|
76
|
-
# and then you can create a new client without parameters
|
77
|
-
@client = Twilio::REST::Client.new
|
78
69
|
```
|
79
70
|
|
80
71
|
### Make a Call
|
data/lib/twilio-ruby.rb
CHANGED
@@ -17,6 +17,7 @@ require 'twilio-ruby/jwt/access_token'
|
|
17
17
|
require 'twilio-ruby/jwt/client_capability'
|
18
18
|
require 'twilio-ruby/jwt/task_router'
|
19
19
|
require 'twilio-ruby/security/request_validator'
|
20
|
+
require 'twilio-ruby/util/configuration'
|
20
21
|
|
21
22
|
require 'twilio-ruby/twiml/twiml'
|
22
23
|
require 'twilio-ruby/twiml/voice_response'
|
@@ -40,4 +41,20 @@ end
|
|
40
41
|
|
41
42
|
module Twilio
|
42
43
|
extend SingleForwardable
|
44
|
+
|
45
|
+
def_delegators :configuration, :account_sid, :auth_token
|
46
|
+
|
47
|
+
##
|
48
|
+
# Pre-configure with account SID and auth token so that you don't need to
|
49
|
+
# pass them to various initializers each time.
|
50
|
+
def self.configure(&block)
|
51
|
+
yield configuration
|
52
|
+
end
|
53
|
+
|
54
|
+
##
|
55
|
+
# Returns an existing or instantiates a new configuration object.
|
56
|
+
def self.configuration
|
57
|
+
@configuration ||= Util::Configuration.new
|
58
|
+
end
|
59
|
+
private_class_method :configuration
|
43
60
|
end
|
@@ -14,8 +14,8 @@ module Twilio
|
|
14
14
|
##
|
15
15
|
# Initializes the Twilio Client
|
16
16
|
def initialize(username=nil, password=nil, account_sid=nil, region=nil, http_client=Twilio::HTTP::Client.new)
|
17
|
-
@username = username
|
18
|
-
@password = password
|
17
|
+
@username = username || Twilio.account_sid
|
18
|
+
@password = password || Twilio.auth_token
|
19
19
|
@region = region
|
20
20
|
@account_sid = account_sid || @username
|
21
21
|
@auth_token = @password
|
@@ -394,4 +394,4 @@ module Twilio
|
|
394
394
|
# Dummy client which provides no functionality. Please use Twilio::REST::Client instead.
|
395
395
|
class TrunkingClient < ObsoleteClient; end
|
396
396
|
end
|
397
|
-
end
|
397
|
+
end
|
@@ -22,6 +22,7 @@ module Twilio
|
|
22
22
|
@hosted_numbers = nil
|
23
23
|
@marketplace = nil
|
24
24
|
@proxy = nil
|
25
|
+
@acc_security = nil
|
25
26
|
@sync = nil
|
26
27
|
@wireless = nil
|
27
28
|
end
|
@@ -56,6 +57,12 @@ module Twilio
|
|
56
57
|
@proxy ||= Proxy.new self
|
57
58
|
end
|
58
59
|
|
60
|
+
##
|
61
|
+
# Version acc_security of preview
|
62
|
+
def acc_security
|
63
|
+
@acc_security ||= AccSecurity.new self
|
64
|
+
end
|
65
|
+
|
59
66
|
##
|
60
67
|
# Version sync of preview
|
61
68
|
def sync
|
@@ -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 AccSecurity < Version
|
11
|
+
##
|
12
|
+
# Initialize the AccSecurity version of Preview
|
13
|
+
def initialize(domain)
|
14
|
+
super
|
15
|
+
@version = 'Verification'
|
16
|
+
@services = nil
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# @param [String] sid The unique SID identifier of Verification Service Instance.
|
21
|
+
# @return [Twilio::REST::Preview::AccSecurity::ServiceInstance] if sid was passed.
|
22
|
+
# @return [Twilio::REST::Preview::AccSecurity::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::AccSecurity>'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,429 @@
|
|
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 AccSecurity < 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
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
28
|
+
# Request is executed immediately.
|
29
|
+
# @param [String] name A 1-64 character string with friendly name of service
|
30
|
+
# @param [String] code_length The length of the verification code to be generated.
|
31
|
+
# Must be an integer value between 4-10
|
32
|
+
# @return [ServiceInstance] Newly created ServiceInstance
|
33
|
+
def create(name: nil, code_length: :unset)
|
34
|
+
data = Twilio::Values.of({
|
35
|
+
'Name' => name,
|
36
|
+
'CodeLength' => code_length,
|
37
|
+
})
|
38
|
+
|
39
|
+
payload = @version.create(
|
40
|
+
'POST',
|
41
|
+
@uri,
|
42
|
+
data: data
|
43
|
+
)
|
44
|
+
|
45
|
+
ServiceInstance.new(
|
46
|
+
@version,
|
47
|
+
payload,
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
##
|
52
|
+
# Lists ServiceInstance records from the API as a list.
|
53
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
54
|
+
# memory before returning.
|
55
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
56
|
+
# guarantees to never return more than limit. Default is no limit
|
57
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
58
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
59
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
60
|
+
# efficient page size, i.e. min(limit, 1000)
|
61
|
+
# @return [Array] Array of up to limit results
|
62
|
+
def list(limit: nil, page_size: nil)
|
63
|
+
self.stream(
|
64
|
+
limit: limit,
|
65
|
+
page_size: page_size
|
66
|
+
).entries
|
67
|
+
end
|
68
|
+
|
69
|
+
##
|
70
|
+
# Streams ServiceInstance records from the API as an Enumerable.
|
71
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
72
|
+
# is reached.
|
73
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
74
|
+
# guarantees to never return more than limit. Default is no limit.
|
75
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
76
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
77
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
78
|
+
# efficient page size, i.e. min(limit, 1000)
|
79
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
80
|
+
def stream(limit: nil, page_size: nil)
|
81
|
+
limits = @version.read_limits(limit, page_size)
|
82
|
+
|
83
|
+
page = self.page(
|
84
|
+
page_size: limits[:page_size],
|
85
|
+
)
|
86
|
+
|
87
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
88
|
+
end
|
89
|
+
|
90
|
+
##
|
91
|
+
# When passed a block, yields ServiceInstance records from the API.
|
92
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
93
|
+
# is reached.
|
94
|
+
def each
|
95
|
+
limits = @version.read_limits
|
96
|
+
|
97
|
+
page = self.page(
|
98
|
+
page_size: limits[:page_size],
|
99
|
+
)
|
100
|
+
|
101
|
+
@version.stream(page,
|
102
|
+
limit: limits[:limit],
|
103
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
104
|
+
end
|
105
|
+
|
106
|
+
##
|
107
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
108
|
+
# Request is executed immediately.
|
109
|
+
# @param [String] page_token PageToken provided by the API
|
110
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
111
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
112
|
+
# @return [Page] Page of ServiceInstance
|
113
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
114
|
+
params = Twilio::Values.of({
|
115
|
+
'PageToken' => page_token,
|
116
|
+
'Page' => page_number,
|
117
|
+
'PageSize' => page_size,
|
118
|
+
})
|
119
|
+
response = @version.page(
|
120
|
+
'GET',
|
121
|
+
@uri,
|
122
|
+
params
|
123
|
+
)
|
124
|
+
ServicePage.new(@version, response, @solution)
|
125
|
+
end
|
126
|
+
|
127
|
+
##
|
128
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
129
|
+
# Request is executed immediately.
|
130
|
+
# @param [String] target_url API-generated URL for the requested results page
|
131
|
+
# @return [Page] Page of ServiceInstance
|
132
|
+
def get_page(target_url)
|
133
|
+
response = @version.domain.request(
|
134
|
+
'GET',
|
135
|
+
target_url
|
136
|
+
)
|
137
|
+
ServicePage.new(@version, response, @solution)
|
138
|
+
end
|
139
|
+
|
140
|
+
##
|
141
|
+
# Provide a user friendly representation
|
142
|
+
def to_s
|
143
|
+
'#<Twilio.Preview.AccSecurity.ServiceList>'
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
##
|
148
|
+
# 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.
|
149
|
+
class ServicePage < Page
|
150
|
+
##
|
151
|
+
# Initialize the ServicePage
|
152
|
+
# @param [Version] version Version that contains the resource
|
153
|
+
# @param [Response] response Response from the API
|
154
|
+
# @param [Hash] solution Path solution for the resource
|
155
|
+
# @return [ServicePage] ServicePage
|
156
|
+
def initialize(version, response, solution)
|
157
|
+
super(version, response)
|
158
|
+
|
159
|
+
# Path Solution
|
160
|
+
@solution = solution
|
161
|
+
end
|
162
|
+
|
163
|
+
##
|
164
|
+
# Build an instance of ServiceInstance
|
165
|
+
# @param [Hash] payload Payload response from the API
|
166
|
+
# @return [ServiceInstance] ServiceInstance
|
167
|
+
def get_instance(payload)
|
168
|
+
ServiceInstance.new(
|
169
|
+
@version,
|
170
|
+
payload,
|
171
|
+
)
|
172
|
+
end
|
173
|
+
|
174
|
+
##
|
175
|
+
# Provide a user friendly representation
|
176
|
+
def to_s
|
177
|
+
'<Twilio.Preview.AccSecurity.ServicePage>'
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
##
|
182
|
+
# 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.
|
183
|
+
class ServiceContext < InstanceContext
|
184
|
+
##
|
185
|
+
# Initialize the ServiceContext
|
186
|
+
# @param [Version] version Version that contains the resource
|
187
|
+
# @param [String] sid The unique SID identifier of Verification Service Instance.
|
188
|
+
# @return [ServiceContext] ServiceContext
|
189
|
+
def initialize(version, sid)
|
190
|
+
super(version)
|
191
|
+
|
192
|
+
# Path Solution
|
193
|
+
@solution = {
|
194
|
+
sid: sid,
|
195
|
+
}
|
196
|
+
@uri = "/Services/#{@solution[:sid]}"
|
197
|
+
|
198
|
+
# Dependents
|
199
|
+
@verifications = nil
|
200
|
+
@verification_checks = nil
|
201
|
+
end
|
202
|
+
|
203
|
+
##
|
204
|
+
# Fetch a ServiceInstance
|
205
|
+
# @return [ServiceInstance] Fetched ServiceInstance
|
206
|
+
def fetch
|
207
|
+
params = Twilio::Values.of({})
|
208
|
+
|
209
|
+
payload = @version.fetch(
|
210
|
+
'GET',
|
211
|
+
@uri,
|
212
|
+
params,
|
213
|
+
)
|
214
|
+
|
215
|
+
ServiceInstance.new(
|
216
|
+
@version,
|
217
|
+
payload,
|
218
|
+
sid: @solution[:sid],
|
219
|
+
)
|
220
|
+
end
|
221
|
+
|
222
|
+
##
|
223
|
+
# Update the ServiceInstance
|
224
|
+
# @param [String] name A 1-64 character string with friendly name of service
|
225
|
+
# @param [String] code_length The length of the verification code to be generated.
|
226
|
+
# Must be an integer value between 4-10
|
227
|
+
# @return [ServiceInstance] Updated ServiceInstance
|
228
|
+
def update(name: :unset, code_length: :unset)
|
229
|
+
data = Twilio::Values.of({
|
230
|
+
'Name' => name,
|
231
|
+
'CodeLength' => code_length,
|
232
|
+
})
|
233
|
+
|
234
|
+
payload = @version.update(
|
235
|
+
'POST',
|
236
|
+
@uri,
|
237
|
+
data: data,
|
238
|
+
)
|
239
|
+
|
240
|
+
ServiceInstance.new(
|
241
|
+
@version,
|
242
|
+
payload,
|
243
|
+
sid: @solution[:sid],
|
244
|
+
)
|
245
|
+
end
|
246
|
+
|
247
|
+
##
|
248
|
+
# Access the verifications
|
249
|
+
# @return [VerificationList]
|
250
|
+
# @return [VerificationContext]
|
251
|
+
def verifications
|
252
|
+
unless @verifications
|
253
|
+
@verifications = VerificationList.new(
|
254
|
+
@version,
|
255
|
+
service_sid: @solution[:sid],
|
256
|
+
)
|
257
|
+
end
|
258
|
+
|
259
|
+
@verifications
|
260
|
+
end
|
261
|
+
|
262
|
+
##
|
263
|
+
# Access the verification_checks
|
264
|
+
# @return [VerificationCheckList]
|
265
|
+
# @return [VerificationCheckContext]
|
266
|
+
def verification_checks
|
267
|
+
unless @verification_checks
|
268
|
+
@verification_checks = VerificationCheckList.new(
|
269
|
+
@version,
|
270
|
+
service_sid: @solution[:sid],
|
271
|
+
)
|
272
|
+
end
|
273
|
+
|
274
|
+
@verification_checks
|
275
|
+
end
|
276
|
+
|
277
|
+
##
|
278
|
+
# Provide a user friendly representation
|
279
|
+
def to_s
|
280
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
281
|
+
"#<Twilio.Preview.AccSecurity.ServiceContext #{context}>"
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
##
|
286
|
+
# 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.
|
287
|
+
class ServiceInstance < InstanceResource
|
288
|
+
##
|
289
|
+
# Initialize the ServiceInstance
|
290
|
+
# @param [Version] version Version that contains the resource
|
291
|
+
# @param [Hash] payload payload that contains response from Twilio
|
292
|
+
# @param [String] sid The unique SID identifier of Verification Service Instance.
|
293
|
+
# @return [ServiceInstance] ServiceInstance
|
294
|
+
def initialize(version, payload, sid: nil)
|
295
|
+
super(version)
|
296
|
+
|
297
|
+
# Marshaled Properties
|
298
|
+
@properties = {
|
299
|
+
'sid' => payload['sid'],
|
300
|
+
'account_sid' => payload['account_sid'],
|
301
|
+
'name' => payload['name'],
|
302
|
+
'code_length' => payload['code_length'].to_i,
|
303
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
304
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
305
|
+
'url' => payload['url'],
|
306
|
+
'links' => payload['links'],
|
307
|
+
}
|
308
|
+
|
309
|
+
# Context
|
310
|
+
@instance_context = nil
|
311
|
+
@params = {
|
312
|
+
'sid' => sid || @properties['sid'],
|
313
|
+
}
|
314
|
+
end
|
315
|
+
|
316
|
+
##
|
317
|
+
# Generate an instance context for the instance, the context is capable of
|
318
|
+
# performing various actions. All instance actions are proxied to the context
|
319
|
+
# @return [ServiceContext] ServiceContext for this ServiceInstance
|
320
|
+
def context
|
321
|
+
unless @instance_context
|
322
|
+
@instance_context = ServiceContext.new(
|
323
|
+
@version,
|
324
|
+
@params['sid'],
|
325
|
+
)
|
326
|
+
end
|
327
|
+
@instance_context
|
328
|
+
end
|
329
|
+
|
330
|
+
##
|
331
|
+
# @return [String] A string that uniquely identifies this Service.
|
332
|
+
def sid
|
333
|
+
@properties['sid']
|
334
|
+
end
|
335
|
+
|
336
|
+
##
|
337
|
+
# @return [String] Account Sid.
|
338
|
+
def account_sid
|
339
|
+
@properties['account_sid']
|
340
|
+
end
|
341
|
+
|
342
|
+
##
|
343
|
+
# @return [String] Friendly name of the service
|
344
|
+
def name
|
345
|
+
@properties['name']
|
346
|
+
end
|
347
|
+
|
348
|
+
##
|
349
|
+
# @return [String] Length of verification code. Valid values are 4-10
|
350
|
+
def code_length
|
351
|
+
@properties['code_length']
|
352
|
+
end
|
353
|
+
|
354
|
+
##
|
355
|
+
# @return [Time] The date this Service was created
|
356
|
+
def date_created
|
357
|
+
@properties['date_created']
|
358
|
+
end
|
359
|
+
|
360
|
+
##
|
361
|
+
# @return [Time] The date this Service was updated
|
362
|
+
def date_updated
|
363
|
+
@properties['date_updated']
|
364
|
+
end
|
365
|
+
|
366
|
+
##
|
367
|
+
# @return [String] The url
|
368
|
+
def url
|
369
|
+
@properties['url']
|
370
|
+
end
|
371
|
+
|
372
|
+
##
|
373
|
+
# @return [String] The links
|
374
|
+
def links
|
375
|
+
@properties['links']
|
376
|
+
end
|
377
|
+
|
378
|
+
##
|
379
|
+
# Fetch a ServiceInstance
|
380
|
+
# @return [ServiceInstance] Fetched ServiceInstance
|
381
|
+
def fetch
|
382
|
+
context.fetch
|
383
|
+
end
|
384
|
+
|
385
|
+
##
|
386
|
+
# Update the ServiceInstance
|
387
|
+
# @param [String] name A 1-64 character string with friendly name of service
|
388
|
+
# @param [String] code_length The length of the verification code to be generated.
|
389
|
+
# Must be an integer value between 4-10
|
390
|
+
# @return [ServiceInstance] Updated ServiceInstance
|
391
|
+
def update(name: :unset, code_length: :unset)
|
392
|
+
context.update(
|
393
|
+
name: name,
|
394
|
+
code_length: code_length,
|
395
|
+
)
|
396
|
+
end
|
397
|
+
|
398
|
+
##
|
399
|
+
# Access the verifications
|
400
|
+
# @return [verifications] verifications
|
401
|
+
def verifications
|
402
|
+
context.verifications
|
403
|
+
end
|
404
|
+
|
405
|
+
##
|
406
|
+
# Access the verification_checks
|
407
|
+
# @return [verification_checks] verification_checks
|
408
|
+
def verification_checks
|
409
|
+
context.verification_checks
|
410
|
+
end
|
411
|
+
|
412
|
+
##
|
413
|
+
# Provide a user friendly representation
|
414
|
+
def to_s
|
415
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
416
|
+
"<Twilio.Preview.AccSecurity.ServiceInstance #{values}>"
|
417
|
+
end
|
418
|
+
|
419
|
+
##
|
420
|
+
# Provide a detailed, user friendly representation
|
421
|
+
def inspect
|
422
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
423
|
+
"<Twilio.Preview.AccSecurity.ServiceInstance #{values}>"
|
424
|
+
end
|
425
|
+
end
|
426
|
+
end
|
427
|
+
end
|
428
|
+
end
|
429
|
+
end
|