twilio-ruby 5.41.0 → 5.45.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +99 -0
  3. data/{LICENSE.md → LICENSE} +0 -0
  4. data/PULL_REQUEST_TEMPLATE.md +3 -3
  5. data/README.md +18 -2
  6. data/lib/twilio-ruby.rb +1 -1
  7. data/lib/twilio-ruby/jwt/access_token.rb +7 -2
  8. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +26 -1
  9. data/lib/twilio-ruby/rest/api/v2010/account/call/event.rb +201 -0
  10. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +13 -1
  11. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +6 -1
  12. data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +5 -22
  13. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +25 -40
  14. data/lib/twilio-ruby/rest/client.rb +29 -3
  15. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +32 -2
  16. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +17 -2
  17. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb +32 -2
  18. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +8 -1
  19. data/lib/twilio-ruby/rest/conversations/v1/user.rb +8 -1
  20. data/lib/twilio-ruby/rest/events/v1/subscription.rb +12 -5
  21. data/lib/twilio-ruby/rest/flex_api.rb +1 -1
  22. data/lib/twilio-ruby/rest/flex_api/v1.rb +1 -1
  23. data/lib/twilio-ruby/rest/flex_api/v1/channel.rb +5 -5
  24. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +88 -76
  25. data/lib/twilio-ruby/rest/flex_api/v1/web_channel.rb +2 -2
  26. data/lib/twilio-ruby/rest/insights.rb +8 -0
  27. data/lib/twilio-ruby/rest/insights/v1.rb +15 -0
  28. data/lib/twilio-ruby/rest/insights/v1/room.rb +487 -0
  29. data/lib/twilio-ruby/rest/insights/v1/room/participant.rb +378 -0
  30. data/lib/twilio-ruby/rest/ip_messaging.rb +8 -10
  31. data/lib/twilio-ruby/rest/ip_messaging/v1.rb +6 -8
  32. data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +29 -68
  33. data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +198 -313
  34. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +32 -59
  35. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +23 -55
  36. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +28 -71
  37. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +31 -59
  38. data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +19 -39
  39. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +29 -51
  40. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user/user_channel.rb +12 -18
  41. data/lib/twilio-ruby/rest/ip_messaging/v2.rb +6 -6
  42. data/lib/twilio-ruby/rest/ip_messaging/v2/credential.rb +29 -66
  43. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +116 -205
  44. data/lib/twilio-ruby/rest/ip_messaging/v2/service/binding.rb +23 -50
  45. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +41 -91
  46. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +23 -50
  47. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +42 -118
  48. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +46 -100
  49. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb +36 -89
  50. data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +19 -41
  51. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +29 -53
  52. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb +23 -53
  53. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb +27 -56
  54. data/lib/twilio-ruby/rest/preview.rb +0 -21
  55. data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +5 -22
  56. data/lib/twilio-ruby/rest/preview/bulk_exports/export/export_custom_job.rb +21 -39
  57. data/lib/twilio-ruby/rest/preview/trusted_comms.rb +0 -30
  58. data/lib/twilio-ruby/rest/serverless/v1/service.rb +5 -5
  59. data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +4 -4
  60. data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +4 -4
  61. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +4 -4
  62. data/lib/twilio-ruby/rest/serverless/v1/service/build/build_status.rb +4 -4
  63. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +4 -4
  64. data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +4 -4
  65. data/lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb +4 -4
  66. data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +4 -4
  67. data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +4 -4
  68. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +4 -4
  69. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb +4 -4
  70. data/lib/twilio-ruby/rest/sync/v1/service/document.rb +15 -5
  71. data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +15 -5
  72. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb +28 -5
  73. data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +15 -5
  74. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +28 -5
  75. data/lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb +15 -5
  76. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +12 -9
  77. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +16 -16
  78. data/lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb +21 -24
  79. data/lib/twilio-ruby/rest/verify/v2/form.rb +4 -4
  80. data/lib/twilio-ruby/rest/verify/v2/service.rb +3 -3
  81. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +3 -3
  82. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +23 -35
  83. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +27 -49
  84. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +24 -42
  85. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +4 -4
  86. data/lib/twilio-ruby/rest/video/v1/composition_settings.rb +6 -6
  87. data/lib/twilio-ruby/rest/video/v1/recording_settings.rb +6 -6
  88. data/lib/twilio-ruby/rest/video/v1/room.rb +20 -0
  89. data/lib/twilio-ruby/rest/video/v1/room/room_recording_rule.rb +150 -0
  90. data/lib/twilio-ruby/twiml/voice_response.rb +8 -4
  91. data/lib/twilio-ruby/util/configuration.rb +5 -1
  92. data/lib/twilio-ruby/version.rb +1 -1
  93. data/spec/integration/api/v2010/account/call/event_spec.rb +102 -0
  94. data/spec/integration/api/v2010/account/call/recording_spec.rb +4 -0
  95. data/spec/integration/api/v2010/account/call_spec.rb +20 -10
  96. data/spec/integration/api/v2010/account/conference/participant_spec.rb +30 -0
  97. data/spec/integration/bulkexports/v1/export/export_custom_job_spec.rb +4 -2
  98. data/spec/integration/conversations/v1/conversation/participant_spec.rb +30 -10
  99. data/spec/integration/conversations/v1/service/configuration_spec.rb +2 -0
  100. data/spec/integration/conversations/v1/service/conversation/participant_spec.rb +30 -10
  101. data/spec/integration/conversations/v1/service/user_spec.rb +9 -4
  102. data/spec/integration/conversations/v1/user_spec.rb +9 -4
  103. data/spec/integration/events/v1/sink/sink_test_spec.rb +1 -1
  104. data/spec/integration/events/v1/subscription_spec.rb +49 -0
  105. data/spec/integration/insights/v1/room/participant_spec.rb +147 -0
  106. data/spec/integration/insights/v1/room_spec.rb +164 -0
  107. data/spec/integration/ip_messaging/v1/credential_spec.rb +13 -13
  108. data/spec/integration/ip_messaging/v1/service/channel/invite_spec.rb +11 -11
  109. data/spec/integration/ip_messaging/v1/service/channel/member_spec.rb +14 -14
  110. data/spec/integration/ip_messaging/v1/service/channel/message_spec.rb +14 -14
  111. data/spec/integration/ip_messaging/v1/service/channel_spec.rb +25 -25
  112. data/spec/integration/ip_messaging/v1/service/role_spec.rb +13 -13
  113. data/spec/integration/ip_messaging/v1/service/user/user_channel_spec.rb +7 -7
  114. data/spec/integration/ip_messaging/v1/service/user_spec.rb +17 -17
  115. data/spec/integration/ip_messaging/v1/service_spec.rb +9 -9
  116. data/spec/integration/ip_messaging/v2/credential_spec.rb +13 -13
  117. data/spec/integration/ip_messaging/v2/service/binding_spec.rb +11 -11
  118. data/spec/integration/ip_messaging/v2/service/channel/invite_spec.rb +11 -11
  119. data/spec/integration/ip_messaging/v2/service/channel/member_spec.rb +13 -13
  120. data/spec/integration/ip_messaging/v2/service/channel/message_spec.rb +17 -17
  121. data/spec/integration/ip_messaging/v2/service/channel/webhook_spec.rb +15 -15
  122. data/spec/integration/ip_messaging/v2/service/channel_spec.rb +29 -29
  123. data/spec/integration/ip_messaging/v2/service/role_spec.rb +13 -13
  124. data/spec/integration/ip_messaging/v2/service/user/user_binding_spec.rb +9 -9
  125. data/spec/integration/ip_messaging/v2/service/user/user_channel_spec.rb +20 -20
  126. data/spec/integration/ip_messaging/v2/service/user_spec.rb +21 -21
  127. data/spec/integration/ip_messaging/v2/service_spec.rb +29 -29
  128. data/spec/integration/lookups/v1/phone_number_spec.rb +7 -7
  129. data/spec/integration/preview/bulk_exports/export/export_custom_job_spec.rb +4 -2
  130. data/spec/integration/taskrouter/v1/workspace/worker/worker_channel_spec.rb +1 -1
  131. data/spec/integration/trunking/v1/trunk/recording_spec.rb +2 -6
  132. data/spec/integration/verify/v2/service/entity/challenge_spec.rb +4 -12
  133. data/spec/integration/verify/v2/service/entity/factor_spec.rb +5 -15
  134. data/spec/integration/verify/v2/service/entity_spec.rb +4 -12
  135. data/spec/integration/video/v1/room/room_recording_rule_spec.rb +89 -0
  136. data/spec/integration/video/v1/room_spec.rb +10 -5
  137. data/spec/jwt/access_token_spec.rb +9 -1
  138. data/spec/rest/client_spec.rb +24 -2
  139. data/twilio-ruby.gemspec +2 -1
  140. metadata +30 -19
  141. data/lib/twilio-ruby/rest/preview/trusted_comms/branded_call.rb +0 -243
  142. data/lib/twilio-ruby/rest/preview/trusted_comms/business.rb +0 -213
  143. data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights.rb +0 -108
  144. data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights/impressions_rate.rb +0 -260
  145. data/lib/twilio-ruby/rest/preview/trusted_comms/phone_call.rb +0 -342
  146. data/spec/integration/preview/trusted_comms/branded_call_spec.rb +0 -59
  147. data/spec/integration/preview/trusted_comms/business/insights/impressions_rate_spec.rb +0 -56
  148. data/spec/integration/preview/trusted_comms/business/insights_spec.rb +0 -12
  149. data/spec/integration/preview/trusted_comms/business_spec.rb +0 -45
  150. data/spec/integration/preview/trusted_comms/phone_call_spec.rb +0 -59
@@ -53,14 +53,19 @@ module Twilio
53
53
  # Can be: `mono` or `dual` and the default is `mono`. `mono` records all parties
54
54
  # of the call into one channel. `dual` records each party of a 2-party call into
55
55
  # separate channels.
56
+ # @param [String] recording_track The audio track to record for the call. Can be:
57
+ # `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the
58
+ # audio that is received by Twilio. `outbound` records the audio that is generated
59
+ # from Twilio. `both` records the audio that is received and generated by Twilio.
56
60
  # @return [RecordingInstance] Created RecordingInstance
57
- def create(recording_status_callback_event: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, trim: :unset, recording_channels: :unset)
61
+ def create(recording_status_callback_event: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, trim: :unset, recording_channels: :unset, recording_track: :unset)
58
62
  data = Twilio::Values.of({
59
63
  'RecordingStatusCallbackEvent' => Twilio.serialize_list(recording_status_callback_event) { |e| e },
60
64
  'RecordingStatusCallback' => recording_status_callback,
61
65
  'RecordingStatusCallbackMethod' => recording_status_callback_method,
62
66
  'Trim' => trim,
63
67
  'RecordingChannels' => recording_channels,
68
+ 'RecordingTrack' => recording_track,
64
69
  })
65
70
 
66
71
  payload = @version.create('POST', @uri, data: data)
@@ -335,6 +340,7 @@ module Twilio
335
340
  'channels' => payload['channels'].to_i,
336
341
  'source' => payload['source'],
337
342
  'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i,
343
+ 'track' => payload['track'],
338
344
  }
339
345
 
340
346
  # Context
@@ -460,6 +466,12 @@ module Twilio
460
466
  @properties['error_code']
461
467
  end
462
468
 
469
+ ##
470
+ # @return [String] The recorded track. Can be: `inbound`, `outbound`, or `both`.
471
+ def track
472
+ @properties['track']
473
+ end
474
+
463
475
  ##
464
476
  # Update the RecordingInstance
465
477
  # @param [recording.Status] status The new status of the recording. Can be:
@@ -162,8 +162,12 @@ module Twilio
162
162
  # @param [String] call_reason The Reason for the outgoing call. Use it to specify
163
163
  # the purpose of the call that is presented on the called party's phone. (Branded
164
164
  # Calls Beta)
165
+ # @param [String] recording_track The audio track to record for the call. Can be:
166
+ # `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the
167
+ # audio that is received by Twilio. `outbound` records the audio that is sent from
168
+ # Twilio. `both` records the audio that is received and sent by Twilio.
165
169
  # @return [ParticipantInstance] Created ParticipantInstance
166
- def create(from: nil, to: nil, status_callback: :unset, status_callback_method: :unset, status_callback_event: :unset, label: :unset, timeout: :unset, record: :unset, muted: :unset, beep: :unset, start_conference_on_enter: :unset, end_conference_on_exit: :unset, wait_url: :unset, wait_method: :unset, early_media: :unset, max_participants: :unset, conference_record: :unset, conference_trim: :unset, conference_status_callback: :unset, conference_status_callback_method: :unset, conference_status_callback_event: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, region: :unset, conference_recording_status_callback: :unset, conference_recording_status_callback_method: :unset, recording_status_callback_event: :unset, conference_recording_status_callback_event: :unset, coaching: :unset, call_sid_to_coach: :unset, jitter_buffer_size: :unset, byoc: :unset, caller_id: :unset, call_reason: :unset)
170
+ def create(from: nil, to: nil, status_callback: :unset, status_callback_method: :unset, status_callback_event: :unset, label: :unset, timeout: :unset, record: :unset, muted: :unset, beep: :unset, start_conference_on_enter: :unset, end_conference_on_exit: :unset, wait_url: :unset, wait_method: :unset, early_media: :unset, max_participants: :unset, conference_record: :unset, conference_trim: :unset, conference_status_callback: :unset, conference_status_callback_method: :unset, conference_status_callback_event: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, region: :unset, conference_recording_status_callback: :unset, conference_recording_status_callback_method: :unset, recording_status_callback_event: :unset, conference_recording_status_callback_event: :unset, coaching: :unset, call_sid_to_coach: :unset, jitter_buffer_size: :unset, byoc: :unset, caller_id: :unset, call_reason: :unset, recording_track: :unset)
167
171
  data = Twilio::Values.of({
168
172
  'From' => from,
169
173
  'To' => to,
@@ -202,6 +206,7 @@ module Twilio
202
206
  'Byoc' => byoc,
203
207
  'CallerId' => caller_id,
204
208
  'CallReason' => call_reason,
209
+ 'RecordingTrack' => recording_track,
205
210
  })
206
211
 
207
212
  payload = @version.create('POST', @uri, data: data)
@@ -31,8 +31,6 @@ 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
36
34
  # @param [Integer] limit Upper limit for the number of records to return. stream()
37
35
  # guarantees to never return more than limit. Default is no limit
38
36
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -40,21 +38,14 @@ module Twilio
40
38
  # but a limit is defined, stream() will attempt to read the limit with the most
41
39
  # efficient page size, i.e. min(limit, 1000)
42
40
  # @return [Array] Array of up to limit results
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
41
+ def list(limit: nil, page_size: nil)
42
+ self.stream(limit: limit, page_size: page_size).entries
50
43
  end
51
44
 
52
45
  ##
53
46
  # Streams DayInstance records from the API as an Enumerable.
54
47
  # This operation lazily loads records as efficiently as possible until the limit
55
48
  # is reached.
56
- # @param [String] next_token The next_token
57
- # @param [String] previous_token The previous_token
58
49
  # @param [Integer] limit Upper limit for the number of records to return. stream()
59
50
  # guarantees to never return more than limit. Default is no limit.
60
51
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -62,14 +53,10 @@ module Twilio
62
53
  # but a limit is defined, stream() will attempt to read the limit with the most
63
54
  # efficient page size, i.e. min(limit, 1000)
64
55
  # @return [Enumerable] Enumerable that will yield up to limit results
65
- def stream(next_token: :unset, previous_token: :unset, limit: nil, page_size: nil)
56
+ def stream(limit: nil, page_size: nil)
66
57
  limits = @version.read_limits(limit, page_size)
67
58
 
68
- page = self.page(
69
- next_token: next_token,
70
- previous_token: previous_token,
71
- page_size: limits[:page_size],
72
- )
59
+ page = self.page(page_size: limits[:page_size], )
73
60
 
74
61
  @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
75
62
  end
@@ -91,16 +78,12 @@ module Twilio
91
78
  ##
92
79
  # Retrieve a single page of DayInstance records from the API.
93
80
  # Request is executed immediately.
94
- # @param [String] next_token The next_token
95
- # @param [String] previous_token The previous_token
96
81
  # @param [String] page_token PageToken provided by the API
97
82
  # @param [Integer] page_number Page Number, this value is simply for client state
98
83
  # @param [Integer] page_size Number of records to return, defaults to 50
99
84
  # @return [Page] Page of DayInstance
100
- def page(next_token: :unset, previous_token: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
85
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
101
86
  params = Twilio::Values.of({
102
- 'NextToken' => next_token,
103
- 'PreviousToken' => previous_token,
104
87
  'PageToken' => page_token,
105
88
  'Page' => page_number,
106
89
  'PageSize' => page_size,
@@ -31,10 +31,6 @@ module Twilio
31
31
  # Lists ExportCustomJobInstance 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 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
34
  # @param [Integer] limit Upper limit for the number of records to return. stream()
39
35
  # guarantees to never return more than limit. Default is no limit
40
36
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -42,23 +38,14 @@ module Twilio
42
38
  # but a limit is defined, stream() will attempt to read the limit with the most
43
39
  # efficient page size, i.e. min(limit, 1000)
44
40
  # @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
41
+ def list(limit: nil, page_size: nil)
42
+ self.stream(limit: limit, page_size: page_size).entries
52
43
  end
53
44
 
54
45
  ##
55
46
  # Streams ExportCustomJobInstance records from the API as an Enumerable.
56
47
  # This operation lazily loads records as efficiently as possible until the limit
57
48
  # 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
49
  # @param [Integer] limit Upper limit for the number of records to return. stream()
63
50
  # guarantees to never return more than limit. Default is no limit.
64
51
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -66,14 +53,10 @@ module Twilio
66
53
  # but a limit is defined, stream() will attempt to read the limit with the most
67
54
  # efficient page size, i.e. min(limit, 1000)
68
55
  # @return [Enumerable] Enumerable that will yield up to limit results
69
- def stream(next_token: :unset, previous_token: :unset, limit: nil, page_size: nil)
56
+ def stream(limit: nil, page_size: nil)
70
57
  limits = @version.read_limits(limit, page_size)
71
58
 
72
- page = self.page(
73
- next_token: next_token,
74
- previous_token: previous_token,
75
- page_size: limits[:page_size],
76
- )
59
+ page = self.page(page_size: limits[:page_size], )
77
60
 
78
61
  @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
79
62
  end
@@ -95,18 +78,12 @@ module Twilio
95
78
  ##
96
79
  # Retrieve a single page of ExportCustomJobInstance records from the API.
97
80
  # 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
81
  # @param [String] page_token PageToken provided by the API
103
82
  # @param [Integer] page_number Page Number, this value is simply for client state
104
83
  # @param [Integer] page_size Number of records to return, defaults to 50
105
84
  # @return [Page] Page of ExportCustomJobInstance
106
- def page(next_token: :unset, previous_token: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
85
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
107
86
  params = Twilio::Values.of({
108
- 'NextToken' => next_token,
109
- 'PreviousToken' => previous_token,
110
87
  'PageToken' => page_token,
111
88
  'Page' => page_number,
112
89
  'PageSize' => page_size,
@@ -132,18 +109,26 @@ module Twilio
132
109
 
133
110
  ##
134
111
  # Create the ExportCustomJobInstance
135
- # @param [String] friendly_name The friendly_name
136
- # @param [String] start_day The start_day
137
- # @param [String] end_day The end_day
138
- # @param [String] webhook_url The webhook_url
139
- # @param [String] webhook_method The webhook_method
140
- # @param [String] email The email
112
+ # @param [String] start_day The start day for the custom export specified as a
113
+ # string in the format of yyyy-mm-dd
114
+ # @param [String] end_day The end day for the custom export specified as a string
115
+ # in the format of yyyy-mm-dd. End day is inclusive and must be 2 days earlier
116
+ # than the current UTC day.
117
+ # @param [String] friendly_name The friendly name specified when creating the job
118
+ # @param [String] webhook_url The optional webhook url called on completion of the
119
+ # job. If this is supplied, `WebhookMethod` must also be supplied. If you set
120
+ # neither webhook nor email, you will have to check your job's status manually.
121
+ # @param [String] webhook_method This is the method used to call the webhook on
122
+ # completion of the job. If this is supplied, `WebhookUrl` must also be supplied.
123
+ # @param [String] email The optional email to send the completion notification to.
124
+ # You can set both webhook, and email, or one or the other. If you set neither,
125
+ # the job will run but you will have to query to determine your job's status.
141
126
  # @return [ExportCustomJobInstance] Created ExportCustomJobInstance
142
- def create(friendly_name: :unset, start_day: :unset, end_day: :unset, webhook_url: :unset, webhook_method: :unset, email: :unset)
127
+ def create(start_day: nil, end_day: nil, friendly_name: nil, webhook_url: :unset, webhook_method: :unset, email: :unset)
143
128
  data = Twilio::Values.of({
144
- 'FriendlyName' => friendly_name,
145
129
  'StartDay' => start_day,
146
130
  'EndDay' => end_day,
131
+ 'FriendlyName' => friendly_name,
147
132
  'WebhookUrl' => webhook_url,
148
133
  'WebhookMethod' => webhook_method,
149
134
  'Email' => email,
@@ -231,13 +216,13 @@ module Twilio
231
216
  end
232
217
 
233
218
  ##
234
- # @return [String] The start time for the export specified when creating the job
219
+ # @return [String] The start day for the custom export specified as a string in the format of yyyy-MM-dd
235
220
  def start_day
236
221
  @properties['start_day']
237
222
  end
238
223
 
239
224
  ##
240
- # @return [String] The end time for the export specified when creating the job
225
+ # @return [String] The end day for the custom export specified as a string in the format of yyyy-MM-dd. This will be the last day exported. For instance, to export a single day, choose the same day for start and end day. To export the first 4 days of July, you would set the start date to 2020-07-01 and the end date to 2020-07-04. The end date must be the UTC day before yesterday.
241
226
  def end_day
242
227
  @properties['end_day']
243
228
  end
@@ -261,13 +246,13 @@ module Twilio
261
246
  end
262
247
 
263
248
  ##
264
- # @return [String] The job_sid returned when the export was created
249
+ # @return [String] The unique job_sid returned when the custom export was created. This can be used to look up the status of the job.
265
250
  def job_sid
266
251
  @properties['job_sid']
267
252
  end
268
253
 
269
254
  ##
270
- # @return [Hash] The details
255
+ # @return [Hash] The details of a job state which is an object that contains a status string, a day count integer, and list of days in the job
271
256
  def details
272
257
  @properties['details']
273
258
  end
@@ -13,11 +13,11 @@ module Twilio
13
13
  class Client
14
14
  @@default_region = 'us1'
15
15
 
16
- attr_accessor :http_client, :username, :password, :account_sid, :auth_token, :region, :edge
16
+ attr_accessor :http_client, :username, :password, :account_sid, :auth_token, :region, :edge, :logger
17
17
 
18
18
  ##
19
19
  # Initializes the Twilio Client
20
- def initialize(username=nil, password=nil, account_sid=nil, region=nil, http_client=nil)
20
+ def initialize(username=nil, password=nil, account_sid=nil, region=nil, http_client=nil, logger=nil)
21
21
  @username = username || Twilio.account_sid
22
22
  @password = password || Twilio.auth_token
23
23
  @region = region || Twilio.region
@@ -26,6 +26,7 @@ module Twilio
26
26
  @auth_token = @password
27
27
  @auth = [@username, @password]
28
28
  @http_client = http_client || Twilio.http_client || Twilio::HTTP::Client.new
29
+ @logger = logger || Twilio.logger
29
30
 
30
31
  # Domains
31
32
  @accounts = nil
@@ -80,7 +81,24 @@ module Twilio
80
81
 
81
82
  uri = build_uri(uri)
82
83
 
83
- @http_client.request(
84
+ if @logger
85
+ @logger.debug("--BEGIN Twilio API Request--")
86
+ @logger.debug("Request Method: <#{method}>")
87
+
88
+ headers.each do |key, value|
89
+ unless key.downcase == 'authorization'
90
+ @logger.debug("#{key}:#{value}")
91
+ end
92
+ end
93
+
94
+ url = URI(uri)
95
+ @logger.debug("Host:#{url.host}")
96
+ @logger.debug("Path:#{url.path}")
97
+ @logger.debug("Query:#{url.query}")
98
+ @logger.debug("Request Params:#{params}")
99
+ end
100
+
101
+ response = @http_client.request(
84
102
  host,
85
103
  port,
86
104
  method,
@@ -91,6 +109,14 @@ module Twilio
91
109
  auth,
92
110
  timeout
93
111
  )
112
+
113
+ if @logger
114
+ @logger.debug("Response Status Code:#{response.status_code}")
115
+ @logger.debug("Response Headers:#{response.headers}")
116
+ @logger.debug("--END TWILIO API REQUEST--")
117
+ end
118
+
119
+ response
94
120
  end
95
121
 
96
122
  ##
@@ -230,10 +230,16 @@ module Twilio
230
230
  # User}[https://www.twilio.com/docs/conversations/api/user-resource]. This
231
231
  # parameter is non-null if (and only if) the participant is using the
232
232
  # Conversations SDK to communicate. Limited to 256 characters.
233
+ # @param [String] last_read_message_index Index of last “read” message in the
234
+ # {Conversation}[https://www.twilio.com/docs/conversations/api/conversation-resource]
235
+ # for the Participant.
236
+ # @param [String] last_read_timestamp Timestamp of last “read” message in the
237
+ # {Conversation}[https://www.twilio.com/docs/conversations/api/conversation-resource]
238
+ # for the Participant.
233
239
  # @param [participant.WebhookEnabledType] x_twilio_webhook_enabled The
234
240
  # X-Twilio-Webhook-Enabled HTTP request header
235
241
  # @return [ParticipantInstance] Updated ParticipantInstance
236
- def update(date_created: :unset, date_updated: :unset, attributes: :unset, role_sid: :unset, messaging_binding_proxy_address: :unset, messaging_binding_projected_address: :unset, identity: :unset, x_twilio_webhook_enabled: :unset)
242
+ def update(date_created: :unset, date_updated: :unset, attributes: :unset, role_sid: :unset, messaging_binding_proxy_address: :unset, messaging_binding_projected_address: :unset, identity: :unset, last_read_message_index: :unset, last_read_timestamp: :unset, x_twilio_webhook_enabled: :unset)
237
243
  data = Twilio::Values.of({
238
244
  'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
239
245
  'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
@@ -242,6 +248,8 @@ module Twilio
242
248
  'MessagingBinding.ProxyAddress' => messaging_binding_proxy_address,
243
249
  'MessagingBinding.ProjectedAddress' => messaging_binding_projected_address,
244
250
  'Identity' => identity,
251
+ 'LastReadMessageIndex' => last_read_message_index,
252
+ 'LastReadTimestamp' => last_read_timestamp,
245
253
  })
246
254
  headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
247
255
 
@@ -321,6 +329,8 @@ module Twilio
321
329
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
322
330
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
323
331
  'url' => payload['url'],
332
+ 'last_read_message_index' => payload['last_read_message_index'] == nil ? payload['last_read_message_index'] : payload['last_read_message_index'].to_i,
333
+ 'last_read_timestamp' => payload['last_read_timestamp'],
324
334
  }
325
335
 
326
336
  # Context
@@ -399,6 +409,18 @@ module Twilio
399
409
  @properties['url']
400
410
  end
401
411
 
412
+ ##
413
+ # @return [String] Index of last “read” message in the Conversation for the Participant.
414
+ def last_read_message_index
415
+ @properties['last_read_message_index']
416
+ end
417
+
418
+ ##
419
+ # @return [String] Timestamp of last “read” message in the Conversation for the Participant.
420
+ def last_read_timestamp
421
+ @properties['last_read_timestamp']
422
+ end
423
+
402
424
  ##
403
425
  # Update the ParticipantInstance
404
426
  # @param [Time] date_created The date that this resource was created.
@@ -419,10 +441,16 @@ module Twilio
419
441
  # User}[https://www.twilio.com/docs/conversations/api/user-resource]. This
420
442
  # parameter is non-null if (and only if) the participant is using the
421
443
  # Conversations SDK to communicate. Limited to 256 characters.
444
+ # @param [String] last_read_message_index Index of last “read” message in the
445
+ # {Conversation}[https://www.twilio.com/docs/conversations/api/conversation-resource]
446
+ # for the Participant.
447
+ # @param [String] last_read_timestamp Timestamp of last “read” message in the
448
+ # {Conversation}[https://www.twilio.com/docs/conversations/api/conversation-resource]
449
+ # for the Participant.
422
450
  # @param [participant.WebhookEnabledType] x_twilio_webhook_enabled The
423
451
  # X-Twilio-Webhook-Enabled HTTP request header
424
452
  # @return [ParticipantInstance] Updated ParticipantInstance
425
- def update(date_created: :unset, date_updated: :unset, attributes: :unset, role_sid: :unset, messaging_binding_proxy_address: :unset, messaging_binding_projected_address: :unset, identity: :unset, x_twilio_webhook_enabled: :unset)
453
+ def update(date_created: :unset, date_updated: :unset, attributes: :unset, role_sid: :unset, messaging_binding_proxy_address: :unset, messaging_binding_projected_address: :unset, identity: :unset, last_read_message_index: :unset, last_read_timestamp: :unset, x_twilio_webhook_enabled: :unset)
426
454
  context.update(
427
455
  date_created: date_created,
428
456
  date_updated: date_updated,
@@ -431,6 +459,8 @@ module Twilio
431
459
  messaging_binding_proxy_address: messaging_binding_proxy_address,
432
460
  messaging_binding_projected_address: messaging_binding_projected_address,
433
461
  identity: identity,
462
+ last_read_message_index: last_read_message_index,
463
+ last_read_timestamp: last_read_timestamp,
434
464
  x_twilio_webhook_enabled: x_twilio_webhook_enabled,
435
465
  )
436
466
  end
@@ -103,12 +103,16 @@ module Twilio
103
103
  # users when they are added to the service. See the {Conversation
104
104
  # Role}[https://www.twilio.com/docs/conversations/api/role-resource] for more info
105
105
  # about roles.
106
+ # @param [Boolean] reachability_enabled Whether the {Reachability
107
+ # Indicator}[https://www.twilio.com/docs/chat/reachability-indicator] is enabled
108
+ # for this Conversations Service. The default is `false`.
106
109
  # @return [ConfigurationInstance] Updated ConfigurationInstance
107
- def update(default_conversation_creator_role_sid: :unset, default_conversation_role_sid: :unset, default_chat_service_role_sid: :unset)
110
+ def update(default_conversation_creator_role_sid: :unset, default_conversation_role_sid: :unset, default_chat_service_role_sid: :unset, reachability_enabled: :unset)
108
111
  data = Twilio::Values.of({
109
112
  'DefaultConversationCreatorRoleSid' => default_conversation_creator_role_sid,
110
113
  'DefaultConversationRoleSid' => default_conversation_role_sid,
111
114
  'DefaultChatServiceRoleSid' => default_chat_service_role_sid,
115
+ 'ReachabilityEnabled' => reachability_enabled,
112
116
  })
113
117
 
114
118
  payload = @version.update('POST', @uri, data: data)
@@ -157,6 +161,7 @@ module Twilio
157
161
  'default_chat_service_role_sid' => payload['default_chat_service_role_sid'],
158
162
  'url' => payload['url'],
159
163
  'links' => payload['links'],
164
+ 'reachability_enabled' => payload['reachability_enabled'],
160
165
  }
161
166
 
162
167
  # Context
@@ -211,6 +216,12 @@ module Twilio
211
216
  @properties['links']
212
217
  end
213
218
 
219
+ ##
220
+ # @return [Boolean] Whether the Reachability Indicator feature is enabled for this Conversations Service
221
+ def reachability_enabled
222
+ @properties['reachability_enabled']
223
+ end
224
+
214
225
  ##
215
226
  # Fetch the ConfigurationInstance
216
227
  # @return [ConfigurationInstance] Fetched ConfigurationInstance
@@ -233,12 +244,16 @@ module Twilio
233
244
  # users when they are added to the service. See the {Conversation
234
245
  # Role}[https://www.twilio.com/docs/conversations/api/role-resource] for more info
235
246
  # about roles.
247
+ # @param [Boolean] reachability_enabled Whether the {Reachability
248
+ # Indicator}[https://www.twilio.com/docs/chat/reachability-indicator] is enabled
249
+ # for this Conversations Service. The default is `false`.
236
250
  # @return [ConfigurationInstance] Updated ConfigurationInstance
237
- def update(default_conversation_creator_role_sid: :unset, default_conversation_role_sid: :unset, default_chat_service_role_sid: :unset)
251
+ def update(default_conversation_creator_role_sid: :unset, default_conversation_role_sid: :unset, default_chat_service_role_sid: :unset, reachability_enabled: :unset)
238
252
  context.update(
239
253
  default_conversation_creator_role_sid: default_conversation_creator_role_sid,
240
254
  default_conversation_role_sid: default_conversation_role_sid,
241
255
  default_chat_service_role_sid: default_chat_service_role_sid,
256
+ reachability_enabled: reachability_enabled,
242
257
  )
243
258
  end
244
259