twilio-ruby 5.32.0 → 5.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +26 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/jwt/task_router.rb +2 -2
  5. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +22 -3
  6. data/lib/twilio-ruby/rest/authy/v1/service.rb +14 -5
  7. data/lib/twilio-ruby/rest/authy/v1/service/entity/factor/challenge.rb +89 -0
  8. data/lib/twilio-ruby/rest/bulkexports.rb +54 -0
  9. data/lib/twilio-ruby/rest/bulkexports/v1.rb +58 -0
  10. data/lib/twilio-ruby/rest/bulkexports/v1/export.rb +254 -0
  11. data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +316 -0
  12. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +298 -0
  13. data/lib/twilio-ruby/rest/bulkexports/v1/export/job.rb +253 -0
  14. data/lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb +242 -0
  15. data/lib/twilio-ruby/rest/chat/v2/service/user.rb +1 -1
  16. data/lib/twilio-ruby/rest/client.rb +7 -0
  17. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +14 -0
  18. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +1 -1
  19. data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +1 -1
  20. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +30 -0
  21. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb +247 -0
  22. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +5 -5
  23. data/lib/twilio-ruby/version.rb +1 -1
  24. data/spec/integration/api/v2010/account/sip/domain_spec.rb +8 -4
  25. data/spec/integration/authy/v1/service/entity/factor/challenge_spec.rb +91 -0
  26. data/spec/integration/bulkexports/v1/export/day_spec.rb +117 -0
  27. data/spec/integration/bulkexports/v1/export/export_custom_job_spec.rb +129 -0
  28. data/spec/integration/bulkexports/v1/export/job_spec.rb +80 -0
  29. data/spec/integration/bulkexports/v1/export_configuration_spec.rb +79 -0
  30. data/spec/integration/bulkexports/v1/export_spec.rb +45 -0
  31. data/spec/integration/flex_api/v1/configuration_spec.rb +150 -0
  32. data/spec/integration/serverless/v1/service/environment/deployment_spec.rb +3 -4
  33. data/spec/integration/serverless/v1/service/function/function_version/function_version_content_spec.rb +52 -0
  34. data/spec/integration/serverless/v1/service/function/function_version_spec.rb +4 -1
  35. metadata +22 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28cc3a56f591c7829313367af99d2da9b0d91ae0d163b99d10d84db8d40e9119
4
- data.tar.gz: f759fccd00bb6ba6262177bdb24021531b2ce2b32d7fae50affdb075cc9618ea
3
+ metadata.gz: 19a14979c8e969be4023b30f2b4188e364adde650a68730592639ca6d7d8f473
4
+ data.tar.gz: d4f4d2299734e8e1e7ea75c60b480dbad6783f0467991faa42cc84fb53bcd354
5
5
  SHA512:
6
- metadata.gz: 28663d53e91c0784b2cd0b91154cea116be05a80f6a56138e59442cd40f56c618693ac25026b5eec6f0fc75738ff10ff6716dd21ad2770ab67892a7cf7480022
7
- data.tar.gz: b9df6ad98bf62443ce0d588e8ebcc020e40f59678f46cb908c242208ca3fb093fbee01949638bce65e8509d855e0bea541afcdaca387cba192cdfbfb8840e290
6
+ metadata.gz: d9eb5a26adf7209ac7b6b83e15cc1284ea77713737845b61e121b25ce27f8b1c1d835ebd3fc04e31fe9e3815232762a021cdefe6d08831d3108deae5cde22b57
7
+ data.tar.gz: 1bdb3e73fc6236b9642ce27ee0b2067edf36b9121f1302a0c2e2a9ead22013390d2c2417658385cc5a43fbf7563adcf5785d710fb5e08cb5361730df339014c6
data/CHANGES.md CHANGED
@@ -1,6 +1,32 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2020-04-01] Version 5.33.0
5
+ ---------------------------
6
+ **Library - Chore**
7
+ - [PR #502](https://github.com/twilio/twilio-ruby/pull/502): Fix a typo in JWT::TaskRouterUtils. Thanks to [@rywall](https://github.com/rywall)!
8
+
9
+ **Api**
10
+ - Add optional 'secure' parameter to SIP Domain
11
+
12
+ **Authy**
13
+ - Added an endpoint to list the challenges of a factor
14
+ - Added optional parameter `Push` when updating a service to send the service level push factor configuration
15
+
16
+ **Bulkexports**
17
+ - exposing bulk exports (vault/slapchop) API as public beta API
18
+
19
+ **Flex**
20
+ - Adding `queue_stats_configuration` and `wfm_integrations` to Flex Configuration
21
+
22
+ **Serverless**
23
+ - Add Function Version Content endpoint
24
+ - Allow build_sid to be optional for deployment requests
25
+
26
+ **Supersim**
27
+ - Remove `deactivated` status for Super SIM which is replaced by `inactive` **(breaking change)**
28
+
29
+
4
30
  [2020-03-18] Version 5.32.0
5
31
  ---------------------------
6
32
  **Api**
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.32.0'
35
+ gem 'twilio-ruby', '~> 5.33.0'
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.32.0
41
+ gem install twilio-ruby -v 5.33.0
42
42
  ```
43
43
 
44
44
  To build and install the development branch yourself from the latest source:
@@ -84,8 +84,8 @@ module Twilio
84
84
  [TASK_ROUTER_BASE_URL, TASK_ROUTER_VERSION, 'Workspaces'].join('/')
85
85
  end
86
86
 
87
- def self.workspace(worskspace_sid)
88
- [TASK_ROUTER_BASE_URL, TASK_ROUTER_VERSION, 'Workspaces', worskspace_sid].join('/')
87
+ def self.workspace(workspace_sid)
88
+ [TASK_ROUTER_BASE_URL, TASK_ROUTER_VERSION, 'Workspaces', workspace_sid].join('/')
89
89
  end
90
90
 
91
91
  def self.all_workspaces
@@ -133,8 +133,11 @@ module Twilio
133
133
  # @param [Boolean] emergency_calling_enabled Whether emergency calling is enabled
134
134
  # for the domain. If enabled, allows emergency calls on the domain from phone
135
135
  # numbers with validated addresses.
136
+ # @param [Boolean] secure Whether secure SIP is enabled for the domain. If
137
+ # enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls
138
+ # to this sip domain.
136
139
  # @return [DomainInstance] Newly created DomainInstance
137
- def create(domain_name: nil, friendly_name: :unset, voice_url: :unset, voice_method: :unset, voice_fallback_url: :unset, voice_fallback_method: :unset, voice_status_callback_url: :unset, voice_status_callback_method: :unset, sip_registration: :unset, emergency_calling_enabled: :unset)
140
+ def create(domain_name: nil, friendly_name: :unset, voice_url: :unset, voice_method: :unset, voice_fallback_url: :unset, voice_fallback_method: :unset, voice_status_callback_url: :unset, voice_status_callback_method: :unset, sip_registration: :unset, emergency_calling_enabled: :unset, secure: :unset)
138
141
  data = Twilio::Values.of({
139
142
  'DomainName' => domain_name,
140
143
  'FriendlyName' => friendly_name,
@@ -146,6 +149,7 @@ module Twilio
146
149
  'VoiceStatusCallbackMethod' => voice_status_callback_method,
147
150
  'SipRegistration' => sip_registration,
148
151
  'EmergencyCallingEnabled' => emergency_calling_enabled,
152
+ 'Secure' => secure,
149
153
  })
150
154
 
151
155
  payload = @version.create(
@@ -254,8 +258,11 @@ module Twilio
254
258
  # @param [Boolean] emergency_calling_enabled Whether emergency calling is enabled
255
259
  # for the domain. If enabled, allows emergency calls on the domain from phone
256
260
  # numbers with validated addresses.
261
+ # @param [Boolean] secure Whether secure SIP is enabled for the domain. If
262
+ # enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls
263
+ # to this sip domain.
257
264
  # @return [DomainInstance] Updated DomainInstance
258
- def update(friendly_name: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_status_callback_method: :unset, voice_status_callback_url: :unset, voice_url: :unset, sip_registration: :unset, domain_name: :unset, emergency_calling_enabled: :unset)
265
+ def update(friendly_name: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_status_callback_method: :unset, voice_status_callback_url: :unset, voice_url: :unset, sip_registration: :unset, domain_name: :unset, emergency_calling_enabled: :unset, secure: :unset)
259
266
  data = Twilio::Values.of({
260
267
  'FriendlyName' => friendly_name,
261
268
  'VoiceFallbackMethod' => voice_fallback_method,
@@ -267,6 +274,7 @@ module Twilio
267
274
  'SipRegistration' => sip_registration,
268
275
  'DomainName' => domain_name,
269
276
  'EmergencyCallingEnabled' => emergency_calling_enabled,
277
+ 'Secure' => secure,
270
278
  })
271
279
 
272
280
  payload = @version.update(
@@ -398,6 +406,7 @@ module Twilio
398
406
  'subresource_uris' => payload['subresource_uris'],
399
407
  'sip_registration' => payload['sip_registration'],
400
408
  'emergency_calling_enabled' => payload['emergency_calling_enabled'],
409
+ 'secure' => payload['secure'],
401
410
  }
402
411
 
403
412
  # Context
@@ -524,6 +533,12 @@ module Twilio
524
533
  @properties['emergency_calling_enabled']
525
534
  end
526
535
 
536
+ ##
537
+ # @return [Boolean] Whether secure SIP is enabled for the domain
538
+ def secure
539
+ @properties['secure']
540
+ end
541
+
527
542
  ##
528
543
  # Fetch a DomainInstance
529
544
  # @return [DomainInstance] Fetched DomainInstance
@@ -554,8 +569,11 @@ module Twilio
554
569
  # @param [Boolean] emergency_calling_enabled Whether emergency calling is enabled
555
570
  # for the domain. If enabled, allows emergency calls on the domain from phone
556
571
  # numbers with validated addresses.
572
+ # @param [Boolean] secure Whether secure SIP is enabled for the domain. If
573
+ # enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls
574
+ # to this sip domain.
557
575
  # @return [DomainInstance] Updated DomainInstance
558
- def update(friendly_name: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_status_callback_method: :unset, voice_status_callback_url: :unset, voice_url: :unset, sip_registration: :unset, domain_name: :unset, emergency_calling_enabled: :unset)
576
+ def update(friendly_name: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_status_callback_method: :unset, voice_status_callback_url: :unset, voice_url: :unset, sip_registration: :unset, domain_name: :unset, emergency_calling_enabled: :unset, secure: :unset)
559
577
  context.update(
560
578
  friendly_name: friendly_name,
561
579
  voice_fallback_method: voice_fallback_method,
@@ -567,6 +585,7 @@ module Twilio
567
585
  sip_registration: sip_registration,
568
586
  domain_name: domain_name,
569
587
  emergency_calling_enabled: emergency_calling_enabled,
588
+ secure: secure,
570
589
  )
571
590
  end
572
591
 
@@ -32,7 +32,8 @@ module Twilio
32
32
  # to 64 characters.
33
33
  # @param [String] push The optional service level push factors configuration. If
34
34
  # present it must be a json string with the following format:
35
- # {"notify_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}
35
+ # {"notify_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "include_date":
36
+ # true}
36
37
  # @return [ServiceInstance] Newly created ServiceInstance
37
38
  def create(friendly_name: nil, push: :unset)
38
39
  data = Twilio::Values.of({'FriendlyName' => friendly_name, 'Push' => push, })
@@ -211,9 +212,13 @@ module Twilio
211
212
  # Update the ServiceInstance
212
213
  # @param [String] friendly_name A human readable description of this resource, up
213
214
  # to 64 characters.
215
+ # @param [String] push The optional service level push factors configuration. If
216
+ # present it must be a json string with the following format:
217
+ # {"notify_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "include_date":
218
+ # true}
214
219
  # @return [ServiceInstance] Updated ServiceInstance
215
- def update(friendly_name: :unset)
216
- data = Twilio::Values.of({'FriendlyName' => friendly_name, })
220
+ def update(friendly_name: :unset, push: :unset)
221
+ data = Twilio::Values.of({'FriendlyName' => friendly_name, 'Push' => push, })
217
222
 
218
223
  payload = @version.update(
219
224
  'POST',
@@ -363,9 +368,13 @@ module Twilio
363
368
  # Update the ServiceInstance
364
369
  # @param [String] friendly_name A human readable description of this resource, up
365
370
  # to 64 characters.
371
+ # @param [String] push The optional service level push factors configuration. If
372
+ # present it must be a json string with the following format:
373
+ # {"notify_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "include_date":
374
+ # true}
366
375
  # @return [ServiceInstance] Updated ServiceInstance
367
- def update(friendly_name: :unset)
368
- context.update(friendly_name: friendly_name, )
376
+ def update(friendly_name: :unset, push: :unset)
377
+ context.update(friendly_name: friendly_name, push: push, )
369
378
  end
370
379
 
371
380
  ##
@@ -64,6 +64,95 @@ module Twilio
64
64
  )
65
65
  end
66
66
 
67
+ ##
68
+ # Lists ChallengeInstance records from the API as a list.
69
+ # Unlike stream(), this operation is eager and will load `limit` records into
70
+ # memory before returning.
71
+ # @param [challenge.ChallengeStatuses] status The Status of the Challenges to
72
+ # fetch. One of `pending`, `expired`, `approved` or `denied`.
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 [Array] Array of up to limit results
80
+ def list(status: :unset, limit: nil, page_size: nil)
81
+ self.stream(status: status, limit: limit, page_size: page_size).entries
82
+ end
83
+
84
+ ##
85
+ # Streams ChallengeInstance records from the API as an Enumerable.
86
+ # This operation lazily loads records as efficiently as possible until the limit
87
+ # is reached.
88
+ # @param [challenge.ChallengeStatuses] status The Status of the Challenges to
89
+ # fetch. One of `pending`, `expired`, `approved` or `denied`.
90
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
91
+ # guarantees to never return more than limit. Default is no limit.
92
+ # @param [Integer] page_size Number of records to fetch per request, when
93
+ # not set will use the default value of 50 records. If no page_size is defined
94
+ # but a limit is defined, stream() will attempt to read the limit with the most
95
+ # efficient page size, i.e. min(limit, 1000)
96
+ # @return [Enumerable] Enumerable that will yield up to limit results
97
+ def stream(status: :unset, limit: nil, page_size: nil)
98
+ limits = @version.read_limits(limit, page_size)
99
+
100
+ page = self.page(status: status, page_size: limits[:page_size], )
101
+
102
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
103
+ end
104
+
105
+ ##
106
+ # When passed a block, yields ChallengeInstance records from the API.
107
+ # This operation lazily loads records as efficiently as possible until the limit
108
+ # is reached.
109
+ def each
110
+ limits = @version.read_limits
111
+
112
+ page = self.page(page_size: limits[:page_size], )
113
+
114
+ @version.stream(page,
115
+ limit: limits[:limit],
116
+ page_limit: limits[:page_limit]).each {|x| yield x}
117
+ end
118
+
119
+ ##
120
+ # Retrieve a single page of ChallengeInstance records from the API.
121
+ # Request is executed immediately.
122
+ # @param [challenge.ChallengeStatuses] status The Status of the Challenges to
123
+ # fetch. One of `pending`, `expired`, `approved` or `denied`.
124
+ # @param [String] page_token PageToken provided by the API
125
+ # @param [Integer] page_number Page Number, this value is simply for client state
126
+ # @param [Integer] page_size Number of records to return, defaults to 50
127
+ # @return [Page] Page of ChallengeInstance
128
+ def page(status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
129
+ params = Twilio::Values.of({
130
+ 'Status' => status,
131
+ 'PageToken' => page_token,
132
+ 'Page' => page_number,
133
+ 'PageSize' => page_size,
134
+ })
135
+ response = @version.page(
136
+ 'GET',
137
+ @uri,
138
+ params
139
+ )
140
+ ChallengePage.new(@version, response, @solution)
141
+ end
142
+
143
+ ##
144
+ # Retrieve a single page of ChallengeInstance records from the API.
145
+ # Request is executed immediately.
146
+ # @param [String] target_url API-generated URL for the requested results page
147
+ # @return [Page] Page of ChallengeInstance
148
+ def get_page(target_url)
149
+ response = @version.domain.request(
150
+ 'GET',
151
+ target_url
152
+ )
153
+ ChallengePage.new(@version, response, @solution)
154
+ end
155
+
67
156
  ##
68
157
  # Provide a user friendly representation
69
158
  def to_s
@@ -0,0 +1,54 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Bulkexports < Domain
12
+ ##
13
+ # Initialize the Bulkexports Domain
14
+ def initialize(twilio)
15
+ super
16
+
17
+ @base_url = 'https://bulkexports.twilio.com'
18
+ @host = 'bulkexports.twilio.com'
19
+ @port = 443
20
+
21
+ # Versions
22
+ @v1 = nil
23
+ end
24
+
25
+ ##
26
+ # Version v1 of bulkexports
27
+ def v1
28
+ @v1 ||= V1.new self
29
+ end
30
+
31
+ ##
32
+ # @param [String] resource_type The type of communication – Messages, Calls
33
+ # @return [Twilio::REST::Bulkexports::V1::ExportInstance] if resource_type was passed.
34
+ # @return [Twilio::REST::Bulkexports::V1::ExportList]
35
+ def exports(resource_type=:unset)
36
+ self.v1.exports(resource_type)
37
+ end
38
+
39
+ ##
40
+ # @param [String] resource_type The type of communication – Messages, Calls
41
+ # @return [Twilio::REST::Bulkexports::V1::ExportConfigurationInstance] if resource_type was passed.
42
+ # @return [Twilio::REST::Bulkexports::V1::ExportConfigurationList]
43
+ def export_configuration(resource_type=:unset)
44
+ self.v1.export_configuration(resource_type)
45
+ end
46
+
47
+ ##
48
+ # Provide a user friendly representation
49
+ def to_s
50
+ '#<Twilio::REST::Bulkexports>'
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,58 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Bulkexports
12
+ class V1 < Version
13
+ ##
14
+ # Initialize the V1 version of Bulkexports
15
+ def initialize(domain)
16
+ super
17
+ @version = 'v1'
18
+ @exports = nil
19
+ @export_configuration = nil
20
+ end
21
+
22
+ ##
23
+ # @param [String] resource_type The type of communication – Messages, Calls
24
+ # @return [Twilio::REST::Bulkexports::V1::ExportContext] if resource_type was passed.
25
+ # @return [Twilio::REST::Bulkexports::V1::ExportList]
26
+ def exports(resource_type=:unset)
27
+ if resource_type.nil?
28
+ raise ArgumentError, 'resource_type cannot be nil'
29
+ elsif resource_type == :unset
30
+ @exports ||= ExportList.new self
31
+ else
32
+ ExportContext.new(self, resource_type)
33
+ end
34
+ end
35
+
36
+ ##
37
+ # @param [String] resource_type The type of communication – Messages, Calls
38
+ # @return [Twilio::REST::Bulkexports::V1::ExportConfigurationContext] if resource_type was passed.
39
+ # @return [Twilio::REST::Bulkexports::V1::ExportConfigurationList]
40
+ def export_configuration(resource_type=:unset)
41
+ if resource_type.nil?
42
+ raise ArgumentError, 'resource_type cannot be nil'
43
+ elsif resource_type == :unset
44
+ @export_configuration ||= ExportConfigurationList.new self
45
+ else
46
+ ExportConfigurationContext.new(self, resource_type)
47
+ end
48
+ end
49
+
50
+ ##
51
+ # Provide a user friendly representation
52
+ def to_s
53
+ '<Twilio::REST::Bulkexports::V1>'
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,254 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Bulkexports < Domain
12
+ class V1 < Version
13
+ ##
14
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
15
+ class ExportList < ListResource
16
+ ##
17
+ # Initialize the ExportList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [ExportList] ExportList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+
26
+ # Components
27
+ @jobs = nil
28
+ end
29
+
30
+ ##
31
+ # Access the jobs
32
+ # @param [String] job_sid The job_sid
33
+ # @return [JobList]
34
+ # @return [JobContext] if job_sid was passed.
35
+ def jobs(job_sid=:unset)
36
+ raise ArgumentError, 'job_sid cannot be nil' if job_sid.nil?
37
+
38
+ if job_sid != :unset
39
+ return JobContext.new(@version, job_sid, )
40
+ end
41
+
42
+ @jobs ||= JobList.new(@version, )
43
+ end
44
+
45
+ ##
46
+ # Provide a user friendly representation
47
+ def to_s
48
+ '#<Twilio.Bulkexports.V1.ExportList>'
49
+ end
50
+ end
51
+
52
+ ##
53
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
54
+ class ExportPage < Page
55
+ ##
56
+ # Initialize the ExportPage
57
+ # @param [Version] version Version that contains the resource
58
+ # @param [Response] response Response from the API
59
+ # @param [Hash] solution Path solution for the resource
60
+ # @return [ExportPage] ExportPage
61
+ def initialize(version, response, solution)
62
+ super(version, response)
63
+
64
+ # Path Solution
65
+ @solution = solution
66
+ end
67
+
68
+ ##
69
+ # Build an instance of ExportInstance
70
+ # @param [Hash] payload Payload response from the API
71
+ # @return [ExportInstance] ExportInstance
72
+ def get_instance(payload)
73
+ ExportInstance.new(@version, payload, )
74
+ end
75
+
76
+ ##
77
+ # Provide a user friendly representation
78
+ def to_s
79
+ '<Twilio.Bulkexports.V1.ExportPage>'
80
+ end
81
+ end
82
+
83
+ ##
84
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
85
+ class ExportContext < InstanceContext
86
+ ##
87
+ # Initialize the ExportContext
88
+ # @param [Version] version Version that contains the resource
89
+ # @param [String] resource_type The type of communication – Messages, Calls
90
+ # @return [ExportContext] ExportContext
91
+ def initialize(version, resource_type)
92
+ super(version)
93
+
94
+ # Path Solution
95
+ @solution = {resource_type: resource_type, }
96
+ @uri = "/Exports/#{@solution[:resource_type]}"
97
+
98
+ # Dependents
99
+ @days = nil
100
+ @export_custom_jobs = nil
101
+ end
102
+
103
+ ##
104
+ # Fetch a ExportInstance
105
+ # @return [ExportInstance] Fetched ExportInstance
106
+ def fetch
107
+ params = Twilio::Values.of({})
108
+
109
+ payload = @version.fetch(
110
+ 'GET',
111
+ @uri,
112
+ params,
113
+ )
114
+
115
+ ExportInstance.new(@version, payload, resource_type: @solution[:resource_type], )
116
+ end
117
+
118
+ ##
119
+ # Access the days
120
+ # @return [DayList]
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
+
129
+ unless @days
130
+ @days = DayList.new(@version, resource_type: @solution[:resource_type], )
131
+ end
132
+
133
+ @days
134
+ end
135
+
136
+ ##
137
+ # Access the export_custom_jobs
138
+ # @return [ExportCustomJobList]
139
+ # @return [ExportCustomJobContext]
140
+ def export_custom_jobs
141
+ unless @export_custom_jobs
142
+ @export_custom_jobs = ExportCustomJobList.new(@version, resource_type: @solution[:resource_type], )
143
+ end
144
+
145
+ @export_custom_jobs
146
+ end
147
+
148
+ ##
149
+ # Provide a user friendly representation
150
+ def to_s
151
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
152
+ "#<Twilio.Bulkexports.V1.ExportContext #{context}>"
153
+ end
154
+
155
+ ##
156
+ # Provide a detailed, user friendly representation
157
+ def inspect
158
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
159
+ "#<Twilio.Bulkexports.V1.ExportContext #{context}>"
160
+ end
161
+ end
162
+
163
+ ##
164
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
165
+ class ExportInstance < InstanceResource
166
+ ##
167
+ # Initialize the ExportInstance
168
+ # @param [Version] version Version that contains the resource
169
+ # @param [Hash] payload payload that contains response from Twilio
170
+ # @param [String] resource_type The type of communication – Messages, Calls
171
+ # @return [ExportInstance] ExportInstance
172
+ def initialize(version, payload, resource_type: nil)
173
+ super(version)
174
+
175
+ # Marshaled Properties
176
+ @properties = {
177
+ 'resource_type' => payload['resource_type'],
178
+ 'url' => payload['url'],
179
+ 'links' => payload['links'],
180
+ }
181
+
182
+ # Context
183
+ @instance_context = nil
184
+ @params = {'resource_type' => resource_type || @properties['resource_type'], }
185
+ end
186
+
187
+ ##
188
+ # Generate an instance context for the instance, the context is capable of
189
+ # performing various actions. All instance actions are proxied to the context
190
+ # @return [ExportContext] ExportContext for this ExportInstance
191
+ def context
192
+ unless @instance_context
193
+ @instance_context = ExportContext.new(@version, @params['resource_type'], )
194
+ end
195
+ @instance_context
196
+ end
197
+
198
+ ##
199
+ # @return [String] The type of communication – Messages, Calls
200
+ def resource_type
201
+ @properties['resource_type']
202
+ end
203
+
204
+ ##
205
+ # @return [String] The URL of this resource.
206
+ def url
207
+ @properties['url']
208
+ end
209
+
210
+ ##
211
+ # @return [String] Nested resource URLs.
212
+ def links
213
+ @properties['links']
214
+ end
215
+
216
+ ##
217
+ # Fetch a ExportInstance
218
+ # @return [ExportInstance] Fetched ExportInstance
219
+ def fetch
220
+ context.fetch
221
+ end
222
+
223
+ ##
224
+ # Access the days
225
+ # @return [days] days
226
+ def days
227
+ context.days
228
+ end
229
+
230
+ ##
231
+ # Access the export_custom_jobs
232
+ # @return [export_custom_jobs] export_custom_jobs
233
+ def export_custom_jobs
234
+ context.export_custom_jobs
235
+ end
236
+
237
+ ##
238
+ # Provide a user friendly representation
239
+ def to_s
240
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
241
+ "<Twilio.Bulkexports.V1.ExportInstance #{values}>"
242
+ end
243
+
244
+ ##
245
+ # Provide a detailed, user friendly representation
246
+ def inspect
247
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
248
+ "<Twilio.Bulkexports.V1.ExportInstance #{values}>"
249
+ end
250
+ end
251
+ end
252
+ end
253
+ end
254
+ end