twilio-ruby 5.40.4 → 5.45.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +104 -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/accounts.rb +12 -0
  9. data/lib/twilio-ruby/rest/accounts/v1.rb +14 -0
  10. data/lib/twilio-ruby/rest/accounts/v1/auth_token_promotion.rb +186 -0
  11. data/lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb +200 -0
  12. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +26 -1
  13. data/lib/twilio-ruby/rest/api/v2010/account/call/event.rb +201 -0
  14. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +13 -1
  15. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +6 -1
  16. data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +5 -22
  17. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +25 -40
  18. data/lib/twilio-ruby/rest/client.rb +29 -3
  19. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +10 -2
  20. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +13 -3
  21. data/lib/twilio-ruby/rest/events/v1/subscription.rb +12 -5
  22. data/lib/twilio-ruby/rest/insights.rb +8 -0
  23. data/lib/twilio-ruby/rest/insights/v1.rb +15 -0
  24. data/lib/twilio-ruby/rest/insights/v1/call/summary.rb +7 -0
  25. data/lib/twilio-ruby/rest/insights/v1/room.rb +487 -0
  26. data/lib/twilio-ruby/rest/insights/v1/room/participant.rb +378 -0
  27. data/lib/twilio-ruby/rest/ip_messaging.rb +8 -10
  28. data/lib/twilio-ruby/rest/ip_messaging/v1.rb +6 -8
  29. data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +29 -68
  30. data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +198 -313
  31. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +32 -59
  32. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +23 -55
  33. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +28 -71
  34. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +31 -59
  35. data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +19 -39
  36. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +29 -51
  37. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user/user_channel.rb +12 -18
  38. data/lib/twilio-ruby/rest/ip_messaging/v2.rb +6 -6
  39. data/lib/twilio-ruby/rest/ip_messaging/v2/credential.rb +29 -66
  40. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +116 -205
  41. data/lib/twilio-ruby/rest/ip_messaging/v2/service/binding.rb +23 -50
  42. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +41 -91
  43. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +23 -50
  44. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +42 -118
  45. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +46 -100
  46. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb +36 -89
  47. data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +19 -41
  48. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +29 -53
  49. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb +23 -53
  50. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb +27 -56
  51. data/lib/twilio-ruby/rest/preview.rb +5 -18
  52. data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +5 -22
  53. data/lib/twilio-ruby/rest/preview/bulk_exports/export/export_custom_job.rb +21 -39
  54. data/lib/twilio-ruby/rest/preview/trusted_comms.rb +12 -27
  55. data/lib/twilio-ruby/rest/preview/trusted_comms/{business.rb → branded_channel.rb} +63 -77
  56. data/lib/twilio-ruby/rest/preview/trusted_comms/branded_channel/channel.rb +165 -0
  57. data/lib/twilio-ruby/rest/serverless/v1/service.rb +5 -5
  58. data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +4 -4
  59. data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +4 -4
  60. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +4 -4
  61. data/lib/twilio-ruby/rest/serverless/v1/service/build/build_status.rb +4 -4
  62. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +4 -4
  63. data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +4 -4
  64. data/lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb +4 -4
  65. data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +4 -4
  66. data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +4 -4
  67. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +4 -4
  68. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb +4 -4
  69. data/lib/twilio-ruby/rest/sync/v1/service/document.rb +15 -5
  70. data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +15 -5
  71. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb +28 -5
  72. data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +15 -5
  73. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +28 -5
  74. data/lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb +15 -5
  75. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +12 -9
  76. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +16 -16
  77. data/lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb +21 -24
  78. data/lib/twilio-ruby/rest/verify/v2/form.rb +4 -4
  79. data/lib/twilio-ruby/rest/verify/v2/service.rb +54 -33
  80. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +3 -3
  81. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +23 -35
  82. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +36 -61
  83. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +59 -57
  84. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +4 -4
  85. data/lib/twilio-ruby/rest/video/v1/composition_settings.rb +6 -6
  86. data/lib/twilio-ruby/rest/video/v1/recording_settings.rb +6 -6
  87. data/lib/twilio-ruby/rest/video/v1/room.rb +20 -0
  88. data/lib/twilio-ruby/rest/video/v1/room/room_recording_rule.rb +150 -0
  89. data/lib/twilio-ruby/twiml/voice_response.rb +7 -4
  90. data/lib/twilio-ruby/util/configuration.rb +5 -1
  91. data/lib/twilio-ruby/version.rb +1 -1
  92. data/spec/integration/accounts/v1/auth_token_promotion_spec.rb +44 -0
  93. data/spec/integration/accounts/v1/secondary_auth_token_spec.rb +69 -0
  94. data/spec/integration/api/v2010/account/call/event_spec.rb +102 -0
  95. data/spec/integration/api/v2010/account/call/recording_spec.rb +4 -0
  96. data/spec/integration/api/v2010/account/call_spec.rb +20 -10
  97. data/spec/integration/api/v2010/account/conference/participant_spec.rb +30 -0
  98. data/spec/integration/bulkexports/v1/export/export_custom_job_spec.rb +4 -2
  99. data/spec/integration/conversations/v1/conversation_spec.rb +1 -1
  100. data/spec/integration/conversations/v1/service/conversation_spec.rb +1 -1
  101. data/spec/integration/events/v1/sink/sink_test_spec.rb +1 -1
  102. data/spec/integration/events/v1/subscription_spec.rb +49 -0
  103. data/spec/integration/insights/v1/call/summary_spec.rb +1 -0
  104. data/spec/integration/insights/v1/room/participant_spec.rb +147 -0
  105. data/spec/integration/insights/v1/room_spec.rb +164 -0
  106. data/spec/integration/ip_messaging/v1/credential_spec.rb +13 -13
  107. data/spec/integration/ip_messaging/v1/service/channel/invite_spec.rb +11 -11
  108. data/spec/integration/ip_messaging/v1/service/channel/member_spec.rb +14 -14
  109. data/spec/integration/ip_messaging/v1/service/channel/message_spec.rb +14 -14
  110. data/spec/integration/ip_messaging/v1/service/channel_spec.rb +25 -25
  111. data/spec/integration/ip_messaging/v1/service/role_spec.rb +13 -13
  112. data/spec/integration/ip_messaging/v1/service/user/user_channel_spec.rb +7 -7
  113. data/spec/integration/ip_messaging/v1/service/user_spec.rb +17 -17
  114. data/spec/integration/ip_messaging/v1/service_spec.rb +9 -9
  115. data/spec/integration/ip_messaging/v2/credential_spec.rb +13 -13
  116. data/spec/integration/ip_messaging/v2/service/binding_spec.rb +11 -11
  117. data/spec/integration/ip_messaging/v2/service/channel/invite_spec.rb +11 -11
  118. data/spec/integration/ip_messaging/v2/service/channel/member_spec.rb +13 -13
  119. data/spec/integration/ip_messaging/v2/service/channel/message_spec.rb +17 -17
  120. data/spec/integration/ip_messaging/v2/service/channel/webhook_spec.rb +15 -15
  121. data/spec/integration/ip_messaging/v2/service/channel_spec.rb +29 -29
  122. data/spec/integration/ip_messaging/v2/service/role_spec.rb +13 -13
  123. data/spec/integration/ip_messaging/v2/service/user/user_binding_spec.rb +9 -9
  124. data/spec/integration/ip_messaging/v2/service/user/user_channel_spec.rb +20 -20
  125. data/spec/integration/ip_messaging/v2/service/user_spec.rb +21 -21
  126. data/spec/integration/ip_messaging/v2/service_spec.rb +29 -29
  127. data/spec/integration/lookups/v1/phone_number_spec.rb +7 -7
  128. data/spec/integration/preview/bulk_exports/export/export_custom_job_spec.rb +4 -2
  129. data/spec/integration/preview/trusted_comms/{business/brand/branded_channel → branded_channel}/channel_spec.rb +4 -8
  130. data/spec/integration/preview/trusted_comms/{business/brand/branded_channel_spec.rb → branded_channel_spec.rb} +5 -9
  131. data/spec/integration/taskrouter/v1/workspace/worker/worker_channel_spec.rb +1 -1
  132. data/spec/integration/trunking/v1/trunk/recording_spec.rb +2 -6
  133. data/spec/integration/verify/v2/service/entity/challenge_spec.rb +56 -20
  134. data/spec/integration/verify/v2/service/entity/factor_spec.rb +11 -26
  135. data/spec/integration/verify/v2/service/entity_spec.rb +4 -12
  136. data/spec/integration/verify/v2/service_spec.rb +8 -4
  137. data/spec/integration/video/v1/room/room_recording_rule_spec.rb +89 -0
  138. data/spec/integration/video/v1/room_spec.rb +10 -5
  139. data/spec/jwt/access_token_spec.rb +9 -1
  140. data/spec/rest/client_spec.rb +24 -2
  141. data/twilio-ruby.gemspec +2 -1
  142. metadata +42 -28
  143. data/lib/twilio-ruby/rest/preview/trusted_comms/branded_call.rb +0 -243
  144. data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand.rb +0 -233
  145. data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand/branded_channel.rb +0 -260
  146. data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand/branded_channel/channel.rb +0 -189
  147. data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights.rb +0 -108
  148. data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights/impressions_rate.rb +0 -260
  149. data/lib/twilio-ruby/rest/preview/trusted_comms/phone_call.rb +0 -342
  150. data/spec/integration/preview/trusted_comms/branded_call_spec.rb +0 -59
  151. data/spec/integration/preview/trusted_comms/business/brand_spec.rb +0 -48
  152. data/spec/integration/preview/trusted_comms/business/insights/impressions_rate_spec.rb +0 -56
  153. data/spec/integration/preview/trusted_comms/business/insights_spec.rb +0 -12
  154. data/spec/integration/preview/trusted_comms/business_spec.rb +0 -46
  155. data/spec/integration/preview/trusted_comms/phone_call_spec.rb +0 -59
@@ -0,0 +1,200 @@
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 Accounts < Domain
12
+ class V1 < Version
13
+ class SecondaryAuthTokenList < ListResource
14
+ ##
15
+ # Initialize the SecondaryAuthTokenList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [SecondaryAuthTokenList] SecondaryAuthTokenList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ end
24
+
25
+ ##
26
+ # Provide a user friendly representation
27
+ def to_s
28
+ '#<Twilio.Accounts.V1.SecondaryAuthTokenList>'
29
+ end
30
+ end
31
+
32
+ class SecondaryAuthTokenPage < Page
33
+ ##
34
+ # Initialize the SecondaryAuthTokenPage
35
+ # @param [Version] version Version that contains the resource
36
+ # @param [Response] response Response from the API
37
+ # @param [Hash] solution Path solution for the resource
38
+ # @return [SecondaryAuthTokenPage] SecondaryAuthTokenPage
39
+ def initialize(version, response, solution)
40
+ super(version, response)
41
+
42
+ # Path Solution
43
+ @solution = solution
44
+ end
45
+
46
+ ##
47
+ # Build an instance of SecondaryAuthTokenInstance
48
+ # @param [Hash] payload Payload response from the API
49
+ # @return [SecondaryAuthTokenInstance] SecondaryAuthTokenInstance
50
+ def get_instance(payload)
51
+ SecondaryAuthTokenInstance.new(@version, payload, )
52
+ end
53
+
54
+ ##
55
+ # Provide a user friendly representation
56
+ def to_s
57
+ '<Twilio.Accounts.V1.SecondaryAuthTokenPage>'
58
+ end
59
+ end
60
+
61
+ class SecondaryAuthTokenContext < InstanceContext
62
+ ##
63
+ # Initialize the SecondaryAuthTokenContext
64
+ # @param [Version] version Version that contains the resource
65
+ # @return [SecondaryAuthTokenContext] SecondaryAuthTokenContext
66
+ def initialize(version)
67
+ super(version)
68
+
69
+ # Path Solution
70
+ @solution = {}
71
+ @uri = "/AuthTokens/Secondary"
72
+ end
73
+
74
+ ##
75
+ # Create the SecondaryAuthTokenInstance
76
+ # @return [SecondaryAuthTokenInstance] Created SecondaryAuthTokenInstance
77
+ def create
78
+ payload = @version.create('POST', @uri)
79
+
80
+ SecondaryAuthTokenInstance.new(@version, payload, )
81
+ end
82
+
83
+ ##
84
+ # Delete the SecondaryAuthTokenInstance
85
+ # @return [Boolean] true if delete succeeds, false otherwise
86
+ def delete
87
+ @version.delete('DELETE', @uri)
88
+ end
89
+
90
+ ##
91
+ # Provide a user friendly representation
92
+ def to_s
93
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
94
+ "#<Twilio.Accounts.V1.SecondaryAuthTokenContext #{context}>"
95
+ end
96
+
97
+ ##
98
+ # Provide a detailed, user friendly representation
99
+ def inspect
100
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
101
+ "#<Twilio.Accounts.V1.SecondaryAuthTokenContext #{context}>"
102
+ end
103
+ end
104
+
105
+ class SecondaryAuthTokenInstance < InstanceResource
106
+ ##
107
+ # Initialize the SecondaryAuthTokenInstance
108
+ # @param [Version] version Version that contains the resource
109
+ # @param [Hash] payload payload that contains response from Twilio
110
+ # @return [SecondaryAuthTokenInstance] SecondaryAuthTokenInstance
111
+ def initialize(version, payload)
112
+ super(version)
113
+
114
+ # Marshaled Properties
115
+ @properties = {
116
+ 'account_sid' => payload['account_sid'],
117
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
118
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
119
+ 'secondary_auth_token' => payload['secondary_auth_token'],
120
+ 'url' => payload['url'],
121
+ }
122
+
123
+ # Context
124
+ @instance_context = nil
125
+ @params = {}
126
+ end
127
+
128
+ ##
129
+ # Generate an instance context for the instance, the context is capable of
130
+ # performing various actions. All instance actions are proxied to the context
131
+ # @return [SecondaryAuthTokenContext] SecondaryAuthTokenContext for this SecondaryAuthTokenInstance
132
+ def context
133
+ unless @instance_context
134
+ @instance_context = SecondaryAuthTokenContext.new(@version, )
135
+ end
136
+ @instance_context
137
+ end
138
+
139
+ ##
140
+ # @return [String] The SID of the Account that the secondary Auth Token was created for
141
+ def account_sid
142
+ @properties['account_sid']
143
+ end
144
+
145
+ ##
146
+ # @return [Time] The ISO 8601 formatted date and time in UTC when the resource was created
147
+ def date_created
148
+ @properties['date_created']
149
+ end
150
+
151
+ ##
152
+ # @return [Time] The ISO 8601 formatted date and time in UTC when the resource was last updated
153
+ def date_updated
154
+ @properties['date_updated']
155
+ end
156
+
157
+ ##
158
+ # @return [String] The generated secondary Auth Token
159
+ def secondary_auth_token
160
+ @properties['secondary_auth_token']
161
+ end
162
+
163
+ ##
164
+ # @return [String] The URI for this resource, relative to `https://accounts.twilio.com`
165
+ def url
166
+ @properties['url']
167
+ end
168
+
169
+ ##
170
+ # Create the SecondaryAuthTokenInstance
171
+ # @return [SecondaryAuthTokenInstance] Created SecondaryAuthTokenInstance
172
+ def create
173
+ context.create
174
+ end
175
+
176
+ ##
177
+ # Delete the SecondaryAuthTokenInstance
178
+ # @return [Boolean] true if delete succeeds, false otherwise
179
+ def delete
180
+ context.delete
181
+ end
182
+
183
+ ##
184
+ # Provide a user friendly representation
185
+ def to_s
186
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
187
+ "<Twilio.Accounts.V1.SecondaryAuthTokenInstance #{values}>"
188
+ end
189
+
190
+ ##
191
+ # Provide a detailed, user friendly representation
192
+ def inspect
193
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
194
+ "<Twilio.Accounts.V1.SecondaryAuthTokenInstance #{values}>"
195
+ end
196
+ end
197
+ end
198
+ end
199
+ end
200
+ end
@@ -142,6 +142,10 @@ module Twilio
142
142
  # @param [String] call_reason The Reason for the outgoing call. Use it to specify
143
143
  # the purpose of the call that is presented on the called party's phone. (Branded
144
144
  # Calls Beta)
145
+ # @param [String] recording_track The tracks to record. Can be: `inbound`,
146
+ # `outbound`, or `both`. The default is `both`. `inbound` only records the audio
147
+ # received by Twilio, `outbound` only records audio generated by Twilio, and
148
+ # `both` mixes the inbound and outbound audio.
145
149
  # @param [String] url The absolute URL that returns the TwiML instructions for the
146
150
  # call. We will call this URL using the `method` when the call connects. For more
147
151
  # information, see the {Url
@@ -153,7 +157,7 @@ module Twilio
153
157
  # @param [String] application_sid The SID of the Application resource that will
154
158
  # handle the call, if the call will be handled by an application.
155
159
  # @return [CallInstance] Created CallInstance
156
- def create(to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, async_amd: :unset, async_amd_status_callback: :unset, async_amd_status_callback_method: :unset, byoc: :unset, call_reason: :unset, url: :unset, twiml: :unset, application_sid: :unset)
160
+ def create(to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, async_amd: :unset, async_amd_status_callback: :unset, async_amd_status_callback_method: :unset, byoc: :unset, call_reason: :unset, recording_track: :unset, url: :unset, twiml: :unset, application_sid: :unset)
157
161
  data = Twilio::Values.of({
158
162
  'To' => to,
159
163
  'From' => from,
@@ -187,6 +191,7 @@ module Twilio
187
191
  'AsyncAmdStatusCallbackMethod' => async_amd_status_callback_method,
188
192
  'Byoc' => byoc,
189
193
  'CallReason' => call_reason,
194
+ 'RecordingTrack' => recording_track,
190
195
  })
191
196
 
192
197
  payload = @version.create('POST', @uri, data: data)
@@ -426,6 +431,7 @@ module Twilio
426
431
  @recordings = nil
427
432
  @notifications = nil
428
433
  @feedback = nil
434
+ @events = nil
429
435
  @payments = nil
430
436
  end
431
437
 
@@ -546,6 +552,18 @@ module Twilio
546
552
  FeedbackContext.new(@version, @solution[:account_sid], @solution[:sid], )
547
553
  end
548
554
 
555
+ ##
556
+ # Access the events
557
+ # @return [EventList]
558
+ # @return [EventContext]
559
+ def events
560
+ unless @events
561
+ @events = EventList.new(@version, account_sid: @solution[:account_sid], call_sid: @solution[:sid], )
562
+ end
563
+
564
+ @events
565
+ end
566
+
549
567
  ##
550
568
  # Access the payments
551
569
  # @return [PaymentList]
@@ -885,6 +903,13 @@ module Twilio
885
903
  context.feedback
886
904
  end
887
905
 
906
+ ##
907
+ # Access the events
908
+ # @return [events] events
909
+ def events
910
+ context.events
911
+ end
912
+
888
913
  ##
889
914
  # Access the payments
890
915
  # @return [payments] payments
@@ -0,0 +1,201 @@
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 Api < Domain
12
+ class V2010 < Version
13
+ class AccountContext < InstanceContext
14
+ class CallContext < InstanceContext
15
+ class EventList < ListResource
16
+ ##
17
+ # Initialize the EventList
18
+ # @param [Version] version Version that contains the resource
19
+ # @param [String] account_sid The SID of the
20
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this Call
21
+ # resource.
22
+ # @param [String] call_sid The unique string that that we created to identify this
23
+ # Call resource.
24
+ # @return [EventList] EventList
25
+ def initialize(version, account_sid: nil, call_sid: nil)
26
+ super(version)
27
+
28
+ # Path Solution
29
+ @solution = {account_sid: account_sid, call_sid: call_sid}
30
+ @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/Events.json"
31
+ end
32
+
33
+ ##
34
+ # Lists EventInstance records from the API as a list.
35
+ # Unlike stream(), this operation is eager and will load `limit` records into
36
+ # memory before returning.
37
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
38
+ # guarantees to never return more than limit. Default is no limit
39
+ # @param [Integer] page_size Number of records to fetch per request, when
40
+ # not set will use the default value of 50 records. If no page_size is defined
41
+ # but a limit is defined, stream() will attempt to read the limit with the most
42
+ # efficient page size, i.e. min(limit, 1000)
43
+ # @return [Array] Array of up to limit results
44
+ def list(limit: nil, page_size: nil)
45
+ self.stream(limit: limit, page_size: page_size).entries
46
+ end
47
+
48
+ ##
49
+ # Streams EventInstance records from the API as an Enumerable.
50
+ # This operation lazily loads records as efficiently as possible until the limit
51
+ # is reached.
52
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
53
+ # guarantees to never return more than limit. Default is no limit.
54
+ # @param [Integer] page_size Number of records to fetch per request, when
55
+ # not set will use the default value of 50 records. If no page_size is defined
56
+ # but a limit is defined, stream() will attempt to read the limit with the most
57
+ # efficient page size, i.e. min(limit, 1000)
58
+ # @return [Enumerable] Enumerable that will yield up to limit results
59
+ def stream(limit: nil, page_size: nil)
60
+ limits = @version.read_limits(limit, page_size)
61
+
62
+ page = self.page(page_size: limits[:page_size], )
63
+
64
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
65
+ end
66
+
67
+ ##
68
+ # When passed a block, yields EventInstance records from the API.
69
+ # This operation lazily loads records as efficiently as possible until the limit
70
+ # is reached.
71
+ def each
72
+ limits = @version.read_limits
73
+
74
+ page = self.page(page_size: limits[:page_size], )
75
+
76
+ @version.stream(page,
77
+ limit: limits[:limit],
78
+ page_limit: limits[:page_limit]).each {|x| yield x}
79
+ end
80
+
81
+ ##
82
+ # Retrieve a single page of EventInstance records from the API.
83
+ # Request is executed immediately.
84
+ # @param [String] page_token PageToken provided by the API
85
+ # @param [Integer] page_number Page Number, this value is simply for client state
86
+ # @param [Integer] page_size Number of records to return, defaults to 50
87
+ # @return [Page] Page of EventInstance
88
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
89
+ params = Twilio::Values.of({
90
+ 'PageToken' => page_token,
91
+ 'Page' => page_number,
92
+ 'PageSize' => page_size,
93
+ })
94
+
95
+ response = @version.page('GET', @uri, params: params)
96
+
97
+ EventPage.new(@version, response, @solution)
98
+ end
99
+
100
+ ##
101
+ # Retrieve a single page of EventInstance records from the API.
102
+ # Request is executed immediately.
103
+ # @param [String] target_url API-generated URL for the requested results page
104
+ # @return [Page] Page of EventInstance
105
+ def get_page(target_url)
106
+ response = @version.domain.request(
107
+ 'GET',
108
+ target_url
109
+ )
110
+ EventPage.new(@version, response, @solution)
111
+ end
112
+
113
+ ##
114
+ # Provide a user friendly representation
115
+ def to_s
116
+ '#<Twilio.Api.V2010.EventList>'
117
+ end
118
+ end
119
+
120
+ class EventPage < Page
121
+ ##
122
+ # Initialize the EventPage
123
+ # @param [Version] version Version that contains the resource
124
+ # @param [Response] response Response from the API
125
+ # @param [Hash] solution Path solution for the resource
126
+ # @return [EventPage] EventPage
127
+ def initialize(version, response, solution)
128
+ super(version, response)
129
+
130
+ # Path Solution
131
+ @solution = solution
132
+ end
133
+
134
+ ##
135
+ # Build an instance of EventInstance
136
+ # @param [Hash] payload Payload response from the API
137
+ # @return [EventInstance] EventInstance
138
+ def get_instance(payload)
139
+ EventInstance.new(
140
+ @version,
141
+ payload,
142
+ account_sid: @solution[:account_sid],
143
+ call_sid: @solution[:call_sid],
144
+ )
145
+ end
146
+
147
+ ##
148
+ # Provide a user friendly representation
149
+ def to_s
150
+ '<Twilio.Api.V2010.EventPage>'
151
+ end
152
+ end
153
+
154
+ class EventInstance < InstanceResource
155
+ ##
156
+ # Initialize the EventInstance
157
+ # @param [Version] version Version that contains the resource
158
+ # @param [Hash] payload payload that contains response from Twilio
159
+ # @param [String] account_sid The SID of the
160
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this Call
161
+ # resource.
162
+ # @param [String] call_sid The unique string that that we created to identify this
163
+ # Call resource.
164
+ # @return [EventInstance] EventInstance
165
+ def initialize(version, payload, account_sid: nil, call_sid: nil)
166
+ super(version)
167
+
168
+ # Marshaled Properties
169
+ @properties = {'request' => payload['request'], 'response' => payload['response'], }
170
+ end
171
+
172
+ ##
173
+ # @return [Hash] Call Request.
174
+ def request
175
+ @properties['request']
176
+ end
177
+
178
+ ##
179
+ # @return [Hash] Call Response with Events.
180
+ def response
181
+ @properties['response']
182
+ end
183
+
184
+ ##
185
+ # Provide a user friendly representation
186
+ def to_s
187
+ "<Twilio.Api.V2010.EventInstance>"
188
+ end
189
+
190
+ ##
191
+ # Provide a detailed, user friendly representation
192
+ def inspect
193
+ "<Twilio.Api.V2010.EventInstance>"
194
+ end
195
+ end
196
+ end
197
+ end
198
+ end
199
+ end
200
+ end
201
+ end