twilio-ruby 5.31.5 → 5.31.6
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/.rubocop.yml +1 -0
- data/CHANGES.md +31 -0
- data/Gemfile +0 -9
- data/Makefile +5 -14
- data/README.md +2 -2
- data/Rakefile +0 -54
- data/githooks/pre-commit +0 -0
- data/lib/twilio-ruby/rest/authy/v1/service.rb +12 -2
- data/lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb +0 -7
- data/lib/twilio-ruby/rest/authy/v1/service/entity/factor/challenge.rb +0 -7
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/messaging/v1/service/alpha_sender.rb +1 -1
- data/lib/twilio-ruby/rest/preview.rb +0 -6
- data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +8 -2
- data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +113 -8
- data/lib/twilio-ruby/rest/preview/trusted_comms.rb +0 -7
- data/lib/twilio-ruby/rest/serverless/v1/service.rb +23 -4
- data/lib/twilio-ruby/rest/supersim.rb +70 -0
- data/lib/twilio-ruby/rest/supersim/v1.rb +80 -0
- data/lib/twilio-ruby/rest/supersim/v1/command.rb +381 -0
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +390 -0
- data/lib/twilio-ruby/rest/supersim/v1/sim.rb +380 -0
- data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +274 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +4 -3
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/call/payment_spec.rb +3 -3
- data/spec/integration/api/v2010/account/message_spec.rb +1 -1
- data/spec/integration/authy/v1/service/entity/factor/challenge_spec.rb +0 -5
- data/spec/integration/authy/v1/service/entity/factor_spec.rb +0 -4
- data/spec/integration/authy/v1/service_spec.rb +4 -0
- data/spec/integration/messaging/v1/service/alpha_sender_spec.rb +9 -3
- data/spec/integration/preview/bulk_exports/export/day_spec.rb +67 -8
- data/spec/integration/serverless/v1/service_spec.rb +3 -0
- data/spec/integration/supersim/v1/command_spec.rb +186 -0
- data/spec/integration/supersim/v1/fleet_spec.rb +208 -0
- data/spec/integration/supersim/v1/sim_spec.rb +231 -0
- data/spec/integration/supersim/v1/usage_record_spec.rb +203 -0
- data/spec/integration/verify/v2/service/verification_spec.rb +42 -30
- data/spec/integration/video/v1/room/room_participant/room_participant_subscribe_rule_spec.rb +1 -1
- data/spec/integration/voice/v1/dialing_permissions/settings_spec.rb +1 -1
- data/twilio-ruby.gemspec +5 -0
- metadata +86 -5
- data/lib/twilio-ruby/rest/preview/trusted_comms/device.rb +0 -146
- data/spec/integration/preview/trusted_comms/device_spec.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b10dfe68ba7cf1dbd1aaa43ca5710c553be4dc466323a91763f975ccf617785
|
4
|
+
data.tar.gz: 778ec7e17ddd7926d65140bcdf6916b002feec6df502b0939762bc3e00034855
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae1943f38ef340c1006d64c5bce6b5d70de809f6529d53436c95528d4b988c37dbd224fea438c9fb8ae487df7257d65f10d1ce43c319c4bc8caa93e7c537b119
|
7
|
+
data.tar.gz: 483ad9fc52526bed959e06be06cc88aeb3fd6763c3756c3b7d86458f1cbe64f78f4a80fbd53bf70dcd7d52f50d2b9eb869bdd66e7f7a7b104a700993ebede97a
|
data/.rubocop.yml
CHANGED
data/CHANGES.md
CHANGED
@@ -1,6 +1,37 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
[2020-03-04] Version 5.31.6
|
5
|
+
---------------------------
|
6
|
+
**Library - Chore**
|
7
|
+
- [PR #497](https://github.com/twilio/twilio-ruby/pull/497): clean up and upgrade dev dependencies. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
|
8
|
+
|
9
|
+
**Authy**
|
10
|
+
- Added the `configuration` property to services to return the service level configurations
|
11
|
+
- Added optional parameter `Push` when creating a service to send the service level push factor configuration
|
12
|
+
- Remove FactorStrength support for Factors and Challenges **(breaking change)**
|
13
|
+
|
14
|
+
**Messaging**
|
15
|
+
- Correct the alpha sender capabilities property type **(breaking change)**
|
16
|
+
|
17
|
+
**Preview**
|
18
|
+
- Removed `/Devices` register Branded Calls endpoint, as per iOS sample app deprecation **(breaking change)**
|
19
|
+
- Removed `Twilio-Sandbox-Mode` request header from the Branded Calls endpoints, as not officially supported **(breaking change)**
|
20
|
+
- Removed `Verify` version from `preview` subdomain in favor to `verify` subdomain. **(breaking change)**
|
21
|
+
|
22
|
+
**Serverless**
|
23
|
+
- Add UI-Editable field to Services
|
24
|
+
|
25
|
+
**Supersim**
|
26
|
+
- Add `inactive` status for Super SIM which is an alias for `deactivated`
|
27
|
+
|
28
|
+
**Taskrouter**
|
29
|
+
- Adding value range to `priority` in task endpoint
|
30
|
+
|
31
|
+
**Verify**
|
32
|
+
- Fix `SendCodeAttempts` type. It's an array of objects instead of a unique object. **(breaking change)**
|
33
|
+
|
34
|
+
|
4
35
|
[2020-02-19] Version 5.31.5
|
5
36
|
---------------------------
|
6
37
|
**Library - Chore**
|
data/Gemfile
CHANGED
data/Makefile
CHANGED
@@ -1,33 +1,24 @@
|
|
1
|
-
.PHONY: githooks test lint-
|
1
|
+
.PHONY: githooks install test lint docs docker-build docker-push
|
2
2
|
|
3
|
-
|
3
|
+
githooks:
|
4
|
+
ln -sf ../../githooks/pre-commit .git/hooks/pre-commit
|
4
5
|
|
5
6
|
install: githooks
|
6
7
|
bundle install; bundle exec rake install
|
7
8
|
|
8
|
-
test-install:
|
9
|
-
bundle install
|
10
|
-
|
11
9
|
test: lint
|
12
10
|
bundle exec rake spec
|
13
11
|
|
14
|
-
docs:
|
15
|
-
yard doc --output-dir ./doc
|
16
|
-
|
17
12
|
lint:
|
18
13
|
rubocop --cache true --parallel
|
19
14
|
|
20
|
-
|
21
|
-
|
22
|
-
chmod +x .git/hooks/pre-commit
|
15
|
+
docs:
|
16
|
+
yard doc --output-dir ./doc
|
23
17
|
|
24
18
|
authors:
|
25
19
|
echo "Authors\n=======\n\nA huge thanks to all of our contributors:\n\n" > AUTHORS.md
|
26
20
|
git log --raw | grep "^Author: " | cut -d ' ' -f2- | cut -d '<' -f1 | sed 's/^/- /' | sort | uniq >> AUTHORS.md
|
27
21
|
|
28
|
-
gem:
|
29
|
-
bundle exec rake build | sed -e 's/.*pkg/pkg/g' | sed -e "s/\.$$//g" | xargs gem push
|
30
|
-
|
31
22
|
API_DEFINITIONS_SHA=$(shell git log --oneline | grep Regenerated | head -n1 | cut -d ' ' -f 5)
|
32
23
|
docker-build:
|
33
24
|
docker build -t twilio/twilio-ruby .
|
data/README.md
CHANGED
@@ -32,13 +32,13 @@ This library supports the following Ruby implementations:
|
|
32
32
|
To install using [Bundler][bundler] grab the latest stable version:
|
33
33
|
|
34
34
|
```ruby
|
35
|
-
gem 'twilio-ruby', '~> 5.31.
|
35
|
+
gem 'twilio-ruby', '~> 5.31.6'
|
36
36
|
```
|
37
37
|
|
38
38
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
39
39
|
|
40
40
|
```bash
|
41
|
-
gem install twilio-ruby -v 5.31.
|
41
|
+
gem install twilio-ruby -v 5.31.6
|
42
42
|
```
|
43
43
|
|
44
44
|
To build and install the development branch yourself from the latest source:
|
data/Rakefile
CHANGED
@@ -8,57 +8,3 @@ RSpec::Core::RakeTask.new(:spec)
|
|
8
8
|
|
9
9
|
task default: :spec
|
10
10
|
task test: :spec
|
11
|
-
|
12
|
-
task :authors do
|
13
|
-
`make authors`
|
14
|
-
end
|
15
|
-
|
16
|
-
task :deploy, [:version] => [:spec, :authors] do |t, args|
|
17
|
-
current_version = Twilio::VERSION
|
18
|
-
|
19
|
-
if args.version.nil?
|
20
|
-
version = Twilio::VERSION
|
21
|
-
version_parts = version.split('.')
|
22
|
-
increment = version_parts.pop
|
23
|
-
increment_prefix = increment.split(/\d/)[0]
|
24
|
-
|
25
|
-
increment = increment[increment_prefix.length..-1] if increment_prefix
|
26
|
-
|
27
|
-
increment = increment.to_i + 1
|
28
|
-
increment = "#{increment_prefix}#{increment}" if increment_prefix
|
29
|
-
|
30
|
-
version = [*version_parts, increment].join('.')
|
31
|
-
else
|
32
|
-
version = args.version
|
33
|
-
end
|
34
|
-
|
35
|
-
puts("Deploying #{version}")
|
36
|
-
|
37
|
-
# Update version.rb
|
38
|
-
version_file = <<SRC
|
39
|
-
module Twilio
|
40
|
-
VERSION = '#{version}'
|
41
|
-
end
|
42
|
-
SRC
|
43
|
-
File.write('lib/twilio-ruby/version.rb', version_file)
|
44
|
-
|
45
|
-
# Update README.md
|
46
|
-
current_readme = File.read('README.md')
|
47
|
-
new_readme = current_readme.gsub(Regexp.new(current_version.gsub('.', '\.')), version)
|
48
|
-
File.write('README.md', new_readme)
|
49
|
-
|
50
|
-
# Make a git commit
|
51
|
-
`git commit -am "Bumping to version #{version}"`
|
52
|
-
|
53
|
-
# Do the gem deployment
|
54
|
-
`make gem`
|
55
|
-
|
56
|
-
# Push the branch back up
|
57
|
-
`git push`
|
58
|
-
|
59
|
-
# Tag the branch
|
60
|
-
`git tag #{version}`
|
61
|
-
|
62
|
-
# Push the tags
|
63
|
-
`git push --tags`
|
64
|
-
end
|
data/githooks/pre-commit
CHANGED
File without changes
|
@@ -30,9 +30,12 @@ module Twilio
|
|
30
30
|
# Request is executed immediately.
|
31
31
|
# @param [String] friendly_name A human readable description of this resource, up
|
32
32
|
# to 64 characters.
|
33
|
+
# @param [String] push The optional service level push factors configuration. If
|
34
|
+
# present it must be a json string with the following format:
|
35
|
+
# {"notify_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}
|
33
36
|
# @return [ServiceInstance] Newly created ServiceInstance
|
34
|
-
def create(friendly_name: nil)
|
35
|
-
data = Twilio::Values.of({'FriendlyName' => friendly_name, })
|
37
|
+
def create(friendly_name: nil, push: :unset)
|
38
|
+
data = Twilio::Values.of({'FriendlyName' => friendly_name, 'Push' => push, })
|
36
39
|
|
37
40
|
payload = @version.create(
|
38
41
|
'POST',
|
@@ -275,6 +278,7 @@ module Twilio
|
|
275
278
|
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
276
279
|
'url' => payload['url'],
|
277
280
|
'links' => payload['links'],
|
281
|
+
'configuration' => payload['configuration'],
|
278
282
|
}
|
279
283
|
|
280
284
|
# Context
|
@@ -335,6 +339,12 @@ module Twilio
|
|
335
339
|
@properties['links']
|
336
340
|
end
|
337
341
|
|
342
|
+
##
|
343
|
+
# @return [Hash] The service level configuration of all the factor types.
|
344
|
+
def configuration
|
345
|
+
@properties['configuration']
|
346
|
+
end
|
347
|
+
|
338
348
|
##
|
339
349
|
# Deletes the ServiceInstance
|
340
350
|
# @return [Boolean] true if delete succeeds, false otherwise
|
@@ -331,7 +331,6 @@ module Twilio
|
|
331
331
|
'friendly_name' => payload['friendly_name'],
|
332
332
|
'status' => payload['status'],
|
333
333
|
'factor_type' => payload['factor_type'],
|
334
|
-
'factor_strength' => payload['factor_strength'],
|
335
334
|
'url' => payload['url'],
|
336
335
|
'links' => payload['links'],
|
337
336
|
}
|
@@ -417,12 +416,6 @@ module Twilio
|
|
417
416
|
@properties['factor_type']
|
418
417
|
end
|
419
418
|
|
420
|
-
##
|
421
|
-
# @return [factor.FactorStrengths] The Strength of this Factor
|
422
|
-
def factor_strength
|
423
|
-
@properties['factor_strength']
|
424
|
-
end
|
425
|
-
|
426
419
|
##
|
427
420
|
# @return [String] The URL of this resource.
|
428
421
|
def url
|
@@ -233,7 +233,6 @@ module Twilio
|
|
233
233
|
'details' => payload['details'],
|
234
234
|
'hidden_details' => payload['hidden_details'],
|
235
235
|
'factor_type' => payload['factor_type'],
|
236
|
-
'factor_strength' => payload['factor_strength'],
|
237
236
|
'url' => payload['url'],
|
238
237
|
}
|
239
238
|
|
@@ -354,12 +353,6 @@ module Twilio
|
|
354
353
|
@properties['factor_type']
|
355
354
|
end
|
356
355
|
|
357
|
-
##
|
358
|
-
# @return [challenge.FactorStrengths] The Factor Strength of this Challenge
|
359
|
-
def factor_strength
|
360
|
-
@properties['factor_strength']
|
361
|
-
end
|
362
|
-
|
363
356
|
##
|
364
357
|
# @return [String] The URL of this resource.
|
365
358
|
def url
|
@@ -52,6 +52,7 @@ module Twilio
|
|
52
52
|
@video = nil
|
53
53
|
@voice = nil
|
54
54
|
@wireless = nil
|
55
|
+
@supersim = nil
|
55
56
|
end
|
56
57
|
|
57
58
|
##
|
@@ -264,6 +265,12 @@ module Twilio
|
|
264
265
|
@wireless ||= Wireless.new self
|
265
266
|
end
|
266
267
|
|
268
|
+
##
|
269
|
+
# Access the Supersim Twilio Domain
|
270
|
+
def supersim
|
271
|
+
@supersim ||= Supersim.new self
|
272
|
+
end
|
273
|
+
|
267
274
|
##
|
268
275
|
# @param [String] sid The unique string that that we created to identify the
|
269
276
|
# Address resource.
|
@@ -309,7 +309,7 @@ module Twilio
|
|
309
309
|
end
|
310
310
|
|
311
311
|
##
|
312
|
-
# @return [
|
312
|
+
# @return [String] An array of values that describe whether the number can receive calls or messages
|
313
313
|
def capabilities
|
314
314
|
@properties['capabilities']
|
315
315
|
end
|
@@ -207,12 +207,6 @@ module Twilio
|
|
207
207
|
self.trusted_comms.current_calls()
|
208
208
|
end
|
209
209
|
|
210
|
-
##
|
211
|
-
# @return [Twilio::REST::Preview::TrustedComms::DeviceInstance]
|
212
|
-
def devices
|
213
|
-
self.trusted_comms.devices()
|
214
|
-
end
|
215
|
-
|
216
210
|
##
|
217
211
|
# @return [Twilio::REST::Preview::TrustedComms::PhoneCallInstance]
|
218
212
|
def phone_calls
|
@@ -118,8 +118,14 @@ module Twilio
|
|
118
118
|
##
|
119
119
|
# Access the days
|
120
120
|
# @return [DayList]
|
121
|
-
# @return [DayContext]
|
122
|
-
def days
|
121
|
+
# @return [DayContext] if day was passed.
|
122
|
+
def days(day=:unset)
|
123
|
+
raise ArgumentError, 'day cannot be nil' if day.nil?
|
124
|
+
|
125
|
+
if day != :unset
|
126
|
+
return DayContext.new(@version, @solution[:resource_type], day, )
|
127
|
+
end
|
128
|
+
|
123
129
|
unless @days
|
124
130
|
@days = DayList.new(@version, resource_type: @solution[:resource_type], )
|
125
131
|
end
|
@@ -31,6 +31,8 @@ module Twilio
|
|
31
31
|
# Lists DayInstance records from the API as a list.
|
32
32
|
# Unlike stream(), this operation is eager and will load `limit` records into
|
33
33
|
# memory before returning.
|
34
|
+
# @param [String] next_token The next_token
|
35
|
+
# @param [String] previous_token The previous_token
|
34
36
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
35
37
|
# guarantees to never return more than limit. Default is no limit
|
36
38
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -38,14 +40,21 @@ module Twilio
|
|
38
40
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
39
41
|
# efficient page size, i.e. min(limit, 1000)
|
40
42
|
# @return [Array] Array of up to limit results
|
41
|
-
def list(limit: nil, page_size: nil)
|
42
|
-
self.stream(
|
43
|
+
def list(next_token: :unset, previous_token: :unset, limit: nil, page_size: nil)
|
44
|
+
self.stream(
|
45
|
+
next_token: next_token,
|
46
|
+
previous_token: previous_token,
|
47
|
+
limit: limit,
|
48
|
+
page_size: page_size
|
49
|
+
).entries
|
43
50
|
end
|
44
51
|
|
45
52
|
##
|
46
53
|
# Streams DayInstance records from the API as an Enumerable.
|
47
54
|
# This operation lazily loads records as efficiently as possible until the limit
|
48
55
|
# is reached.
|
56
|
+
# @param [String] next_token The next_token
|
57
|
+
# @param [String] previous_token The previous_token
|
49
58
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
50
59
|
# guarantees to never return more than limit. Default is no limit.
|
51
60
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -53,10 +62,14 @@ module Twilio
|
|
53
62
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
54
63
|
# efficient page size, i.e. min(limit, 1000)
|
55
64
|
# @return [Enumerable] Enumerable that will yield up to limit results
|
56
|
-
def stream(limit: nil, page_size: nil)
|
65
|
+
def stream(next_token: :unset, previous_token: :unset, limit: nil, page_size: nil)
|
57
66
|
limits = @version.read_limits(limit, page_size)
|
58
67
|
|
59
|
-
page = self.page(
|
68
|
+
page = self.page(
|
69
|
+
next_token: next_token,
|
70
|
+
previous_token: previous_token,
|
71
|
+
page_size: limits[:page_size],
|
72
|
+
)
|
60
73
|
|
61
74
|
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
62
75
|
end
|
@@ -78,12 +91,16 @@ module Twilio
|
|
78
91
|
##
|
79
92
|
# Retrieve a single page of DayInstance records from the API.
|
80
93
|
# Request is executed immediately.
|
94
|
+
# @param [String] next_token The next_token
|
95
|
+
# @param [String] previous_token The previous_token
|
81
96
|
# @param [String] page_token PageToken provided by the API
|
82
97
|
# @param [Integer] page_number Page Number, this value is simply for client state
|
83
98
|
# @param [Integer] page_size Number of records to return, defaults to 50
|
84
99
|
# @return [Page] Page of DayInstance
|
85
|
-
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
100
|
+
def page(next_token: :unset, previous_token: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
86
101
|
params = Twilio::Values.of({
|
102
|
+
'NextToken' => next_token,
|
103
|
+
'PreviousToken' => previous_token,
|
87
104
|
'PageToken' => page_token,
|
88
105
|
'Page' => page_number,
|
89
106
|
'PageSize' => page_size,
|
@@ -147,6 +164,54 @@ module Twilio
|
|
147
164
|
end
|
148
165
|
end
|
149
166
|
|
167
|
+
##
|
168
|
+
# 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.
|
169
|
+
class DayContext < InstanceContext
|
170
|
+
##
|
171
|
+
# Initialize the DayContext
|
172
|
+
# @param [Version] version Version that contains the resource
|
173
|
+
# @param [String] resource_type The type of communication – Messages, Calls
|
174
|
+
# @param [String] day The ISO 8601 format date of the resources in the file, for a
|
175
|
+
# UTC day
|
176
|
+
# @return [DayContext] DayContext
|
177
|
+
def initialize(version, resource_type, day)
|
178
|
+
super(version)
|
179
|
+
|
180
|
+
# Path Solution
|
181
|
+
@solution = {resource_type: resource_type, day: day, }
|
182
|
+
@uri = "/Exports/#{@solution[:resource_type]}/Days/#{@solution[:day]}"
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# Fetch a DayInstance
|
187
|
+
# @return [DayInstance] Fetched DayInstance
|
188
|
+
def fetch
|
189
|
+
params = Twilio::Values.of({})
|
190
|
+
|
191
|
+
payload = @version.fetch(
|
192
|
+
'GET',
|
193
|
+
@uri,
|
194
|
+
params,
|
195
|
+
)
|
196
|
+
|
197
|
+
DayInstance.new(@version, payload, resource_type: @solution[:resource_type], day: @solution[:day], )
|
198
|
+
end
|
199
|
+
|
200
|
+
##
|
201
|
+
# Provide a user friendly representation
|
202
|
+
def to_s
|
203
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
204
|
+
"#<Twilio.Preview.BulkExports.DayContext #{context}>"
|
205
|
+
end
|
206
|
+
|
207
|
+
##
|
208
|
+
# Provide a detailed, user friendly representation
|
209
|
+
def inspect
|
210
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
211
|
+
"#<Twilio.Preview.BulkExports.DayContext #{context}>"
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
150
215
|
##
|
151
216
|
# 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.
|
152
217
|
class DayInstance < InstanceResource
|
@@ -155,8 +220,10 @@ module Twilio
|
|
155
220
|
# @param [Version] version Version that contains the resource
|
156
221
|
# @param [Hash] payload payload that contains response from Twilio
|
157
222
|
# @param [String] resource_type The type of communication – Messages, Calls
|
223
|
+
# @param [String] day The ISO 8601 format date of the resources in the file, for a
|
224
|
+
# UTC day
|
158
225
|
# @return [DayInstance] DayInstance
|
159
|
-
def initialize(version, payload, resource_type: nil)
|
226
|
+
def initialize(version, payload, resource_type: nil, day: nil)
|
160
227
|
super(version)
|
161
228
|
|
162
229
|
# Marshaled Properties
|
@@ -164,8 +231,25 @@ module Twilio
|
|
164
231
|
'redirect_to' => payload['redirect_to'],
|
165
232
|
'day' => payload['day'],
|
166
233
|
'size' => payload['size'].to_i,
|
234
|
+
'create_date' => payload['create_date'],
|
235
|
+
'friendly_name' => payload['friendly_name'],
|
167
236
|
'resource_type' => payload['resource_type'],
|
168
237
|
}
|
238
|
+
|
239
|
+
# Context
|
240
|
+
@instance_context = nil
|
241
|
+
@params = {'resource_type' => resource_type, 'day' => day || @properties['day'], }
|
242
|
+
end
|
243
|
+
|
244
|
+
##
|
245
|
+
# Generate an instance context for the instance, the context is capable of
|
246
|
+
# performing various actions. All instance actions are proxied to the context
|
247
|
+
# @return [DayContext] DayContext for this DayInstance
|
248
|
+
def context
|
249
|
+
unless @instance_context
|
250
|
+
@instance_context = DayContext.new(@version, @params['resource_type'], @params['day'], )
|
251
|
+
end
|
252
|
+
@instance_context
|
169
253
|
end
|
170
254
|
|
171
255
|
##
|
@@ -186,22 +270,43 @@ module Twilio
|
|
186
270
|
@properties['size']
|
187
271
|
end
|
188
272
|
|
273
|
+
##
|
274
|
+
# @return [String] The date when resource is created
|
275
|
+
def create_date
|
276
|
+
@properties['create_date']
|
277
|
+
end
|
278
|
+
|
279
|
+
##
|
280
|
+
# @return [String] The friendly name specified when creating the job
|
281
|
+
def friendly_name
|
282
|
+
@properties['friendly_name']
|
283
|
+
end
|
284
|
+
|
189
285
|
##
|
190
286
|
# @return [String] The type of communication – Messages, Calls
|
191
287
|
def resource_type
|
192
288
|
@properties['resource_type']
|
193
289
|
end
|
194
290
|
|
291
|
+
##
|
292
|
+
# Fetch a DayInstance
|
293
|
+
# @return [DayInstance] Fetched DayInstance
|
294
|
+
def fetch
|
295
|
+
context.fetch
|
296
|
+
end
|
297
|
+
|
195
298
|
##
|
196
299
|
# Provide a user friendly representation
|
197
300
|
def to_s
|
198
|
-
"
|
301
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
302
|
+
"<Twilio.Preview.BulkExports.DayInstance #{values}>"
|
199
303
|
end
|
200
304
|
|
201
305
|
##
|
202
306
|
# Provide a detailed, user friendly representation
|
203
307
|
def inspect
|
204
|
-
"
|
308
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
309
|
+
"<Twilio.Preview.BulkExports.DayInstance #{values}>"
|
205
310
|
end
|
206
311
|
end
|
207
312
|
end
|