twilio-ruby 5.28.0 → 5.29.0

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.
Files changed (63) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +11 -6
  3. data/CHANGES.md +33 -0
  4. data/README.md +3 -2
  5. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +18 -20
  6. data/lib/twilio-ruby/rest/api/v2010/account/call/notification.rb +7 -6
  7. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +7 -6
  8. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +6 -4
  9. data/lib/twilio-ruby/rest/api/v2010/account/notification.rb +0 -14
  10. data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +1 -1
  11. data/lib/twilio-ruby/rest/api/v2010/account/queue/member.rb +6 -4
  12. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +9 -6
  13. data/lib/twilio-ruby/rest/authy.rb +8 -8
  14. data/lib/twilio-ruby/rest/authy/v1.rb +15 -15
  15. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +6 -3
  16. data/lib/twilio-ruby/rest/flex_api.rb +15 -15
  17. data/lib/twilio-ruby/rest/flex_api/v1.rb +20 -20
  18. data/lib/twilio-ruby/rest/messaging.rb +9 -9
  19. data/lib/twilio-ruby/rest/messaging/v1.rb +13 -13
  20. data/lib/twilio-ruby/rest/preview.rb +20 -20
  21. data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +38 -0
  22. data/lib/twilio-ruby/rest/preview/bulk_exports/export/export_custom_job.rb +298 -0
  23. data/lib/twilio-ruby/rest/preview/bulk_exports/export/job.rb +232 -0
  24. data/lib/twilio-ruby/rest/preview/marketplace.rb +13 -13
  25. data/lib/twilio-ruby/rest/preview/trusted_comms.rb +14 -14
  26. data/lib/twilio-ruby/rest/preview/trusted_comms/branded_call.rb +40 -5
  27. data/lib/twilio-ruby/rest/preview/trusted_comms/cps.rb +7 -7
  28. data/lib/twilio-ruby/rest/preview/trusted_comms/current_call.rb +51 -51
  29. data/lib/twilio-ruby/rest/preview/trusted_comms/device.rb +10 -10
  30. data/lib/twilio-ruby/rest/preview/trusted_comms/phone_call.rb +96 -19
  31. data/lib/twilio-ruby/rest/sync/v1/service.rb +3 -3
  32. data/lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb +8 -2
  33. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb +10 -6
  34. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb +10 -6
  35. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +271 -176
  36. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +282 -137
  37. data/lib/twilio-ruby/rest/video.rb +9 -9
  38. data/lib/twilio-ruby/rest/video/v1.rb +15 -15
  39. data/lib/twilio-ruby/rest/voice/v1/dialing_permissions.rb +2 -1
  40. data/lib/twilio-ruby/rest/voice/v1/dialing_permissions/country.rb +9 -7
  41. data/lib/twilio-ruby/rest/voice/v1/dialing_permissions/settings.rb +3 -3
  42. data/lib/twilio-ruby/rest/wireless.rb +6 -6
  43. data/lib/twilio-ruby/rest/wireless/v1.rb +8 -8
  44. data/lib/twilio-ruby/rest/wireless/v1/command.rb +5 -4
  45. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +4 -5
  46. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +114 -98
  47. data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +4 -4
  48. data/lib/twilio-ruby/rest/wireless/v1/sim/usage_record.rb +16 -10
  49. data/lib/twilio-ruby/security/request_validator.rb +61 -8
  50. data/lib/twilio-ruby/version.rb +1 -1
  51. data/spec/integration/api/v2010/account/message_spec.rb +4 -4
  52. data/spec/integration/api/v2010/account/notification_spec.rb +0 -28
  53. data/spec/integration/conversations/v1/conversation/participant_spec.rb +27 -0
  54. data/spec/integration/preview/bulk_exports/export/export_custom_job_spec.rb +129 -0
  55. data/spec/integration/preview/bulk_exports/export/job_spec.rb +77 -0
  56. data/spec/integration/preview/trusted_comms/branded_call_spec.rb +6 -1
  57. data/spec/integration/preview/trusted_comms/cps_spec.rb +1 -1
  58. data/spec/integration/preview/trusted_comms/current_call_spec.rb +10 -10
  59. data/spec/integration/preview/trusted_comms/device_spec.rb +1 -1
  60. data/spec/integration/preview/trusted_comms/phone_call_spec.rb +15 -4
  61. data/spec/integration/wireless/v1/sim_spec.rb +84 -0
  62. data/spec/security/request_validator_spec.rb +41 -0
  63. metadata +9 -4
@@ -39,20 +39,22 @@ module Twilio
39
39
  # device, e.g. a phone number or Messenger ID. Together with the Proxy address,
40
40
  # this determines a participant uniquely. This field (with proxy_address) is only
41
41
  # null when the participant is interacting from a Chat endpoint (see the
42
- # 'identity' field). Limited to 256 characters.
42
+ # 'identity' field).
43
43
  # @param [String] messaging_binding_proxy_address The address of the Twilio phone
44
44
  # number (or WhatsApp number, or Messenger Page ID) that the participant is in
45
45
  # contact with. This field, together with participant address, is only null when
46
46
  # the participant is interacting from a Chat endpoint (see the 'identity' field).
47
- # Limited to 256 characters.
48
47
  # @param [Time] date_created The date that this resource was created.
49
48
  # @param [Time] date_updated The date that this resource was last updated.
50
49
  # @param [String] attributes An optional string metadata field you can use to
51
50
  # store any data you wish. The string value must contain structurally valid JSON
52
51
  # if specified. **Note** that if the attributes are not set "{}" will be
53
52
  # returned.
53
+ # @param [String] messaging_binding_projected_address The address of the Twilio
54
+ # phone number that is used in Group MMS. Communication mask for the Chat
55
+ # participant with Identity.
54
56
  # @return [ParticipantInstance] Newly created ParticipantInstance
55
- def create(identity: :unset, messaging_binding_address: :unset, messaging_binding_proxy_address: :unset, date_created: :unset, date_updated: :unset, attributes: :unset)
57
+ def create(identity: :unset, messaging_binding_address: :unset, messaging_binding_proxy_address: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_binding_projected_address: :unset)
56
58
  data = Twilio::Values.of({
57
59
  'Identity' => identity,
58
60
  'MessagingBinding.Address' => messaging_binding_address,
@@ -60,6 +62,7 @@ module Twilio
60
62
  'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
61
63
  'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
62
64
  'Attributes' => attributes,
65
+ 'MessagingBinding.ProjectedAddress' => messaging_binding_projected_address,
63
66
  })
64
67
 
65
68
  payload = @version.create(
@@ -28,15 +28,6 @@ module Twilio
28
28
  @v1 ||= V1.new self
29
29
  end
30
30
 
31
- ##
32
- # @param [String] sid The unique string that we created to identify the FlexFlow
33
- # resource.
34
- # @return [Twilio::REST::Flex_api::V1::FlexFlowInstance] if sid was passed.
35
- # @return [Twilio::REST::Flex_api::V1::FlexFlowList]
36
- def flex_flow(sid=:unset)
37
- self.v1.flex_flow(sid)
38
- end
39
-
40
31
  ##
41
32
  # @param [String] sid The unique string that we created to identify the Channel
42
33
  # resource.
@@ -46,6 +37,21 @@ module Twilio
46
37
  self.v1.channel(sid)
47
38
  end
48
39
 
40
+ ##
41
+ # @return [Twilio::REST::Flex_api::V1::ConfigurationInstance]
42
+ def configuration
43
+ self.v1.configuration()
44
+ end
45
+
46
+ ##
47
+ # @param [String] sid The unique string that we created to identify the FlexFlow
48
+ # resource.
49
+ # @return [Twilio::REST::Flex_api::V1::FlexFlowInstance] if sid was passed.
50
+ # @return [Twilio::REST::Flex_api::V1::FlexFlowList]
51
+ def flex_flow(sid=:unset)
52
+ self.v1.flex_flow(sid)
53
+ end
54
+
49
55
  ##
50
56
  # @param [String] sid The unique string that we created to identify the WebChannel
51
57
  # resource.
@@ -55,12 +61,6 @@ module Twilio
55
61
  self.v1.web_channel(sid)
56
62
  end
57
63
 
58
- ##
59
- # @return [Twilio::REST::Flex_api::V1::ConfigurationInstance]
60
- def configuration
61
- self.v1.configuration()
62
- end
63
-
64
64
  ##
65
65
  # Provide a user friendly representation
66
66
  def to_s
@@ -15,37 +15,43 @@ module Twilio
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'v1'
18
- @flex_flow = nil
19
18
  @channel = nil
20
- @web_channel = nil
21
19
  @configuration = nil
20
+ @flex_flow = nil
21
+ @web_channel = nil
22
22
  end
23
23
 
24
24
  ##
25
- # @param [String] sid The SID of the FlexFlow resource to fetch.
26
- # @return [Twilio::REST::Flex_api::V1::FlexFlowContext] if sid was passed.
27
- # @return [Twilio::REST::Flex_api::V1::FlexFlowList]
28
- def flex_flow(sid=:unset)
25
+ # @param [String] sid The SID of the Flex chat channel resource to fetch.
26
+ # @return [Twilio::REST::Flex_api::V1::ChannelContext] if sid was passed.
27
+ # @return [Twilio::REST::Flex_api::V1::ChannelList]
28
+ def channel(sid=:unset)
29
29
  if sid.nil?
30
30
  raise ArgumentError, 'sid cannot be nil'
31
31
  elsif sid == :unset
32
- @flex_flow ||= FlexFlowList.new self
32
+ @channel ||= ChannelList.new self
33
33
  else
34
- FlexFlowContext.new(self, sid)
34
+ ChannelContext.new(self, sid)
35
35
  end
36
36
  end
37
37
 
38
38
  ##
39
- # @param [String] sid The SID of the Flex chat channel resource to fetch.
40
- # @return [Twilio::REST::Flex_api::V1::ChannelContext] if sid was passed.
41
- # @return [Twilio::REST::Flex_api::V1::ChannelList]
42
- def channel(sid=:unset)
39
+ # @return [Twilio::REST::Flex_api::V1::ConfigurationContext]
40
+ def configuration
41
+ @configuration ||= ConfigurationContext.new self
42
+ end
43
+
44
+ ##
45
+ # @param [String] sid The SID of the FlexFlow resource to fetch.
46
+ # @return [Twilio::REST::Flex_api::V1::FlexFlowContext] if sid was passed.
47
+ # @return [Twilio::REST::Flex_api::V1::FlexFlowList]
48
+ def flex_flow(sid=:unset)
43
49
  if sid.nil?
44
50
  raise ArgumentError, 'sid cannot be nil'
45
51
  elsif sid == :unset
46
- @channel ||= ChannelList.new self
52
+ @flex_flow ||= FlexFlowList.new self
47
53
  else
48
- ChannelContext.new(self, sid)
54
+ FlexFlowContext.new(self, sid)
49
55
  end
50
56
  end
51
57
 
@@ -63,12 +69,6 @@ module Twilio
63
69
  end
64
70
  end
65
71
 
66
- ##
67
- # @return [Twilio::REST::Flex_api::V1::ConfigurationContext]
68
- def configuration
69
- @configuration ||= ConfigurationContext.new self
70
- end
71
-
72
72
  ##
73
73
  # Provide a user friendly representation
74
74
  def to_s
@@ -28,15 +28,6 @@ module Twilio
28
28
  @v1 ||= V1.new self
29
29
  end
30
30
 
31
- ##
32
- # @param [String] sid The unique string that we created to identify the Session
33
- # resource.
34
- # @return [Twilio::REST::Messaging::V1::SessionInstance] if sid was passed.
35
- # @return [Twilio::REST::Messaging::V1::SessionList]
36
- def sessions(sid=:unset)
37
- self.v1.sessions(sid)
38
- end
39
-
40
31
  ##
41
32
  # @param [String] sid The unique string that we created to identify the Service
42
33
  # resource.
@@ -46,6 +37,15 @@ module Twilio
46
37
  self.v1.services(sid)
47
38
  end
48
39
 
40
+ ##
41
+ # @param [String] sid The unique string that we created to identify the Session
42
+ # resource.
43
+ # @return [Twilio::REST::Messaging::V1::SessionInstance] if sid was passed.
44
+ # @return [Twilio::REST::Messaging::V1::SessionList]
45
+ def sessions(sid=:unset)
46
+ self.v1.sessions(sid)
47
+ end
48
+
49
49
  ##
50
50
  # @return [Twilio::REST::Messaging::V1::WebhookInstance]
51
51
  def webhooks
@@ -15,36 +15,36 @@ module Twilio
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'v1'
18
- @sessions = nil
19
18
  @services = nil
19
+ @sessions = nil
20
20
  @webhooks = nil
21
21
  end
22
22
 
23
23
  ##
24
- # @param [String] sid The SID of the Session resource to fetch.
25
- # @return [Twilio::REST::Messaging::V1::SessionContext] if sid was passed.
26
- # @return [Twilio::REST::Messaging::V1::SessionList]
27
- def sessions(sid=:unset)
24
+ # @param [String] sid The SID of the Service resource to fetch.
25
+ # @return [Twilio::REST::Messaging::V1::ServiceContext] if sid was passed.
26
+ # @return [Twilio::REST::Messaging::V1::ServiceList]
27
+ def services(sid=:unset)
28
28
  if sid.nil?
29
29
  raise ArgumentError, 'sid cannot be nil'
30
30
  elsif sid == :unset
31
- @sessions ||= SessionList.new self
31
+ @services ||= ServiceList.new self
32
32
  else
33
- SessionContext.new(self, sid)
33
+ ServiceContext.new(self, sid)
34
34
  end
35
35
  end
36
36
 
37
37
  ##
38
- # @param [String] sid The SID of the Service resource to fetch.
39
- # @return [Twilio::REST::Messaging::V1::ServiceContext] if sid was passed.
40
- # @return [Twilio::REST::Messaging::V1::ServiceList]
41
- def services(sid=:unset)
38
+ # @param [String] sid The SID of the Session resource to fetch.
39
+ # @return [Twilio::REST::Messaging::V1::SessionContext] if sid was passed.
40
+ # @return [Twilio::REST::Messaging::V1::SessionList]
41
+ def sessions(sid=:unset)
42
42
  if sid.nil?
43
43
  raise ArgumentError, 'sid cannot be nil'
44
44
  elsif sid == :unset
45
- @services ||= ServiceList.new self
45
+ @sessions ||= SessionList.new self
46
46
  else
47
- ServiceContext.new(self, sid)
47
+ SessionContext.new(self, sid)
48
48
  end
49
49
  end
50
50
 
@@ -127,6 +127,14 @@ module Twilio
127
127
  self.hosted_numbers.hosted_number_orders(sid)
128
128
  end
129
129
 
130
+ ##
131
+ # @param [String] sid A 34 character string that uniquely identifies this Add-on.
132
+ # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnInstance] if sid was passed.
133
+ # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
134
+ def available_add_ons(sid=:unset)
135
+ self.marketplace.available_add_ons(sid)
136
+ end
137
+
130
138
  ##
131
139
  # @param [String] sid 34 character string that uniquely identifies the Add-on.
132
140
  # This Sid can also be found in the Console on that specific Add-ons page as the
@@ -137,14 +145,6 @@ module Twilio
137
145
  self.marketplace.installed_add_ons(sid)
138
146
  end
139
147
 
140
- ##
141
- # @param [String] sid A 34 character string that uniquely identifies this Add-on.
142
- # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnInstance] if sid was passed.
143
- # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
144
- def available_add_ons(sid=:unset)
145
- self.marketplace.available_add_ons(sid)
146
- end
147
-
148
148
  ##
149
149
  # @param [String] sid The sid
150
150
  # @return [Twilio::REST::Preview::Sync::ServiceInstance] if sid was passed.
@@ -193,15 +193,9 @@ module Twilio
193
193
  end
194
194
 
195
195
  ##
196
- # @return [Twilio::REST::Preview::TrustedComms::DeviceInstance]
197
- def devices
198
- self.trusted_comms.devices()
199
- end
200
-
201
- ##
202
- # @return [Twilio::REST::Preview::TrustedComms::PhoneCallInstance]
203
- def phone_calls
204
- self.trusted_comms.phone_calls()
196
+ # @return [Twilio::REST::Preview::TrustedComms::CpsInstance]
197
+ def cps
198
+ self.trusted_comms.cps()
205
199
  end
206
200
 
207
201
  ##
@@ -211,9 +205,15 @@ module Twilio
211
205
  end
212
206
 
213
207
  ##
214
- # @return [Twilio::REST::Preview::TrustedComms::CpsInstance]
215
- def cps
216
- self.trusted_comms.cps()
208
+ # @return [Twilio::REST::Preview::TrustedComms::DeviceInstance]
209
+ def devices
210
+ self.trusted_comms.devices()
211
+ end
212
+
213
+ ##
214
+ # @return [Twilio::REST::Preview::TrustedComms::PhoneCallInstance]
215
+ def phone_calls
216
+ self.trusted_comms.phone_calls()
217
217
  end
218
218
 
219
219
  ##
@@ -22,6 +22,24 @@ module Twilio
22
22
 
23
23
  # Path Solution
24
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, )
25
43
  end
26
44
 
27
45
  ##
@@ -79,6 +97,7 @@ module Twilio
79
97
 
80
98
  # Dependents
81
99
  @days = nil
100
+ @export_custom_jobs = nil
82
101
  end
83
102
 
84
103
  ##
@@ -108,6 +127,18 @@ module Twilio
108
127
  @days
109
128
  end
110
129
 
130
+ ##
131
+ # Access the export_custom_jobs
132
+ # @return [ExportCustomJobList]
133
+ # @return [ExportCustomJobContext]
134
+ def export_custom_jobs
135
+ unless @export_custom_jobs
136
+ @export_custom_jobs = ExportCustomJobList.new(@version, resource_type: @solution[:resource_type], )
137
+ end
138
+
139
+ @export_custom_jobs
140
+ end
141
+
111
142
  ##
112
143
  # Provide a user friendly representation
113
144
  def to_s
@@ -190,6 +221,13 @@ module Twilio
190
221
  context.days
191
222
  end
192
223
 
224
+ ##
225
+ # Access the export_custom_jobs
226
+ # @return [export_custom_jobs] export_custom_jobs
227
+ def export_custom_jobs
228
+ context.export_custom_jobs
229
+ end
230
+
193
231
  ##
194
232
  # Provide a user friendly representation
195
233
  def to_s
@@ -0,0 +1,298 @@
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 Preview < Domain
12
+ class BulkExports < Version
13
+ class ExportContext < InstanceContext
14
+ ##
15
+ # 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.
16
+ class ExportCustomJobList < ListResource
17
+ ##
18
+ # Initialize the ExportCustomJobList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] resource_type The type of communication – Messages, Calls
21
+ # @return [ExportCustomJobList] ExportCustomJobList
22
+ def initialize(version, resource_type: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {resource_type: resource_type}
27
+ @uri = "/Exports/#{@solution[:resource_type]}/Jobs"
28
+ end
29
+
30
+ ##
31
+ # Lists ExportCustomJobInstance records from the API as a list.
32
+ # Unlike stream(), this operation is eager and will load `limit` records into
33
+ # memory before returning.
34
+ # @param [String] next_token The token for the next page of job results, and may
35
+ # be null if there are no more pages
36
+ # @param [String] previous_token The token for the previous page of results, and
37
+ # may be null if this is the first page
38
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
39
+ # guarantees to never return more than limit. Default is no limit
40
+ # @param [Integer] page_size Number of records to fetch per request, when
41
+ # not set will use the default value of 50 records. If no page_size is defined
42
+ # but a limit is defined, stream() will attempt to read the limit with the most
43
+ # efficient page size, i.e. min(limit, 1000)
44
+ # @return [Array] Array of up to limit results
45
+ def list(next_token: :unset, previous_token: :unset, limit: nil, page_size: nil)
46
+ self.stream(
47
+ next_token: next_token,
48
+ previous_token: previous_token,
49
+ limit: limit,
50
+ page_size: page_size
51
+ ).entries
52
+ end
53
+
54
+ ##
55
+ # Streams ExportCustomJobInstance records from the API as an Enumerable.
56
+ # This operation lazily loads records as efficiently as possible until the limit
57
+ # is reached.
58
+ # @param [String] next_token The token for the next page of job results, and may
59
+ # be null if there are no more pages
60
+ # @param [String] previous_token The token for the previous page of results, and
61
+ # may be null if this is the first page
62
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
63
+ # guarantees to never return more than limit. Default is no limit.
64
+ # @param [Integer] page_size Number of records to fetch per request, when
65
+ # not set will use the default value of 50 records. If no page_size is defined
66
+ # but a limit is defined, stream() will attempt to read the limit with the most
67
+ # efficient page size, i.e. min(limit, 1000)
68
+ # @return [Enumerable] Enumerable that will yield up to limit results
69
+ def stream(next_token: :unset, previous_token: :unset, limit: nil, page_size: nil)
70
+ limits = @version.read_limits(limit, page_size)
71
+
72
+ page = self.page(
73
+ next_token: next_token,
74
+ previous_token: previous_token,
75
+ page_size: limits[:page_size],
76
+ )
77
+
78
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
79
+ end
80
+
81
+ ##
82
+ # When passed a block, yields ExportCustomJobInstance records from the API.
83
+ # This operation lazily loads records as efficiently as possible until the limit
84
+ # is reached.
85
+ def each
86
+ limits = @version.read_limits
87
+
88
+ page = self.page(page_size: limits[:page_size], )
89
+
90
+ @version.stream(page,
91
+ limit: limits[:limit],
92
+ page_limit: limits[:page_limit]).each {|x| yield x}
93
+ end
94
+
95
+ ##
96
+ # Retrieve a single page of ExportCustomJobInstance records from the API.
97
+ # Request is executed immediately.
98
+ # @param [String] next_token The token for the next page of job results, and may
99
+ # be null if there are no more pages
100
+ # @param [String] previous_token The token for the previous page of results, and
101
+ # may be null if this is the first page
102
+ # @param [String] page_token PageToken provided by the API
103
+ # @param [Integer] page_number Page Number, this value is simply for client state
104
+ # @param [Integer] page_size Number of records to return, defaults to 50
105
+ # @return [Page] Page of ExportCustomJobInstance
106
+ def page(next_token: :unset, previous_token: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
107
+ params = Twilio::Values.of({
108
+ 'NextToken' => next_token,
109
+ 'PreviousToken' => previous_token,
110
+ 'PageToken' => page_token,
111
+ 'Page' => page_number,
112
+ 'PageSize' => page_size,
113
+ })
114
+ response = @version.page(
115
+ 'GET',
116
+ @uri,
117
+ params
118
+ )
119
+ ExportCustomJobPage.new(@version, response, @solution)
120
+ end
121
+
122
+ ##
123
+ # Retrieve a single page of ExportCustomJobInstance records from the API.
124
+ # Request is executed immediately.
125
+ # @param [String] target_url API-generated URL for the requested results page
126
+ # @return [Page] Page of ExportCustomJobInstance
127
+ def get_page(target_url)
128
+ response = @version.domain.request(
129
+ 'GET',
130
+ target_url
131
+ )
132
+ ExportCustomJobPage.new(@version, response, @solution)
133
+ end
134
+
135
+ ##
136
+ # Retrieve a single page of ExportCustomJobInstance records from the API.
137
+ # Request is executed immediately.
138
+ # @param [String] friendly_name The friendly_name
139
+ # @param [String] start_day The start_day
140
+ # @param [String] end_day The end_day
141
+ # @param [String] webhook_url The webhook_url
142
+ # @param [String] webhook_method The webhook_method
143
+ # @param [String] email The email
144
+ # @return [ExportCustomJobInstance] Newly created ExportCustomJobInstance
145
+ def create(friendly_name: :unset, start_day: :unset, end_day: :unset, webhook_url: :unset, webhook_method: :unset, email: :unset)
146
+ data = Twilio::Values.of({
147
+ 'FriendlyName' => friendly_name,
148
+ 'StartDay' => start_day,
149
+ 'EndDay' => end_day,
150
+ 'WebhookUrl' => webhook_url,
151
+ 'WebhookMethod' => webhook_method,
152
+ 'Email' => email,
153
+ })
154
+
155
+ payload = @version.create(
156
+ 'POST',
157
+ @uri,
158
+ data: data
159
+ )
160
+
161
+ ExportCustomJobInstance.new(@version, payload, resource_type: @solution[:resource_type], )
162
+ end
163
+
164
+ ##
165
+ # Provide a user friendly representation
166
+ def to_s
167
+ '#<Twilio.Preview.BulkExports.ExportCustomJobList>'
168
+ end
169
+ end
170
+
171
+ ##
172
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
173
+ class ExportCustomJobPage < Page
174
+ ##
175
+ # Initialize the ExportCustomJobPage
176
+ # @param [Version] version Version that contains the resource
177
+ # @param [Response] response Response from the API
178
+ # @param [Hash] solution Path solution for the resource
179
+ # @return [ExportCustomJobPage] ExportCustomJobPage
180
+ def initialize(version, response, solution)
181
+ super(version, response)
182
+
183
+ # Path Solution
184
+ @solution = solution
185
+ end
186
+
187
+ ##
188
+ # Build an instance of ExportCustomJobInstance
189
+ # @param [Hash] payload Payload response from the API
190
+ # @return [ExportCustomJobInstance] ExportCustomJobInstance
191
+ def get_instance(payload)
192
+ ExportCustomJobInstance.new(@version, payload, resource_type: @solution[:resource_type], )
193
+ end
194
+
195
+ ##
196
+ # Provide a user friendly representation
197
+ def to_s
198
+ '<Twilio.Preview.BulkExports.ExportCustomJobPage>'
199
+ end
200
+ end
201
+
202
+ ##
203
+ # 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.
204
+ class ExportCustomJobInstance < InstanceResource
205
+ ##
206
+ # Initialize the ExportCustomJobInstance
207
+ # @param [Version] version Version that contains the resource
208
+ # @param [Hash] payload payload that contains response from Twilio
209
+ # @param [String] resource_type The type of communication – Messages, Calls
210
+ # @return [ExportCustomJobInstance] ExportCustomJobInstance
211
+ def initialize(version, payload, resource_type: nil)
212
+ super(version)
213
+
214
+ # Marshaled Properties
215
+ @properties = {
216
+ 'friendly_name' => payload['friendly_name'],
217
+ 'resource_type' => payload['resource_type'],
218
+ 'start_day' => payload['start_day'],
219
+ 'end_day' => payload['end_day'],
220
+ 'webhook_url' => payload['webhook_url'],
221
+ 'webhook_method' => payload['webhook_method'],
222
+ 'email' => payload['email'],
223
+ 'job_sid' => payload['job_sid'],
224
+ 'details' => payload['details'],
225
+ }
226
+ end
227
+
228
+ ##
229
+ # @return [String] The friendly name specified when creating the job
230
+ def friendly_name
231
+ @properties['friendly_name']
232
+ end
233
+
234
+ ##
235
+ # @return [String] The type of communication – Messages, Calls
236
+ def resource_type
237
+ @properties['resource_type']
238
+ end
239
+
240
+ ##
241
+ # @return [String] The start time for the export specified when creating the job
242
+ def start_day
243
+ @properties['start_day']
244
+ end
245
+
246
+ ##
247
+ # @return [String] The end time for the export specified when creating the job
248
+ def end_day
249
+ @properties['end_day']
250
+ end
251
+
252
+ ##
253
+ # @return [String] The optional webhook url called on completion
254
+ def webhook_url
255
+ @properties['webhook_url']
256
+ end
257
+
258
+ ##
259
+ # @return [String] This is the method used to call the webhook
260
+ def webhook_method
261
+ @properties['webhook_method']
262
+ end
263
+
264
+ ##
265
+ # @return [String] The optional email to send the completion notification to
266
+ def email
267
+ @properties['email']
268
+ end
269
+
270
+ ##
271
+ # @return [String] The job_sid returned when the export was created
272
+ def job_sid
273
+ @properties['job_sid']
274
+ end
275
+
276
+ ##
277
+ # @return [Hash] The details
278
+ def details
279
+ @properties['details']
280
+ end
281
+
282
+ ##
283
+ # Provide a user friendly representation
284
+ def to_s
285
+ "<Twilio.Preview.BulkExports.ExportCustomJobInstance>"
286
+ end
287
+
288
+ ##
289
+ # Provide a detailed, user friendly representation
290
+ def inspect
291
+ "<Twilio.Preview.BulkExports.ExportCustomJobInstance>"
292
+ end
293
+ end
294
+ end
295
+ end
296
+ end
297
+ end
298
+ end