twilio-ruby 5.52.0 → 5.67.3

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 (163) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/pr-lint.yml +15 -0
  3. data/.github/workflows/test-and-deploy.yml +129 -0
  4. data/.gitignore +5 -1
  5. data/.rubocop.yml +1 -1
  6. data/.rubocop_todo.yml +91 -28
  7. data/CHANGES.md +563 -0
  8. data/Gemfile +1 -0
  9. data/Makefile +8 -11
  10. data/README.md +13 -6
  11. data/examples/examples.rb +1 -1
  12. data/lib/rack/twilio_webhook_authentication.rb +25 -1
  13. data/lib/twilio-ruby/http/http_client.rb +20 -4
  14. data/lib/twilio-ruby/http.rb +5 -0
  15. data/lib/twilio-ruby/jwt/access_token.rb +13 -0
  16. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +23 -23
  17. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +5 -5
  18. data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +8 -8
  19. data/lib/twilio-ruby/rest/api/v2010/account/call/siprec.rb +674 -0
  20. data/lib/twilio-ruby/rest/api/v2010/account/call/stream.rb +674 -0
  21. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +68 -14
  22. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +12 -8
  23. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +1 -1
  24. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +11 -4
  25. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +11 -4
  26. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +11 -4
  27. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +17 -10
  28. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +18 -5
  29. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +34 -7
  30. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +11 -11
  31. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +11 -11
  32. data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +0 -8
  33. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +0 -6
  34. data/lib/twilio-ruby/rest/bulkexports/v1/export/job.rb +0 -8
  35. data/lib/twilio-ruby/rest/bulkexports/v1/export.rb +0 -8
  36. data/lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb +0 -8
  37. data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +10 -4
  38. data/lib/twilio-ruby/rest/chat/v3/channel.rb +275 -0
  39. data/lib/twilio-ruby/rest/chat/v3.rb +48 -0
  40. data/lib/twilio-ruby/rest/chat.rb +16 -0
  41. data/lib/twilio-ruby/rest/client.rb +21 -12
  42. data/lib/twilio-ruby/rest/conversations/v1/address_configuration.rb +454 -0
  43. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +12 -5
  44. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +7 -0
  45. data/lib/twilio-ruby/rest/conversations/v1/participant_conversation.rb +312 -0
  46. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +18 -2
  47. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb +269 -0
  48. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +8 -0
  49. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +12 -5
  50. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +7 -0
  51. data/lib/twilio-ruby/rest/conversations/v1/service/participant_conversation.rb +324 -0
  52. data/lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb +466 -0
  53. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +44 -0
  54. data/lib/twilio-ruby/rest/conversations/v1/service.rb +23 -0
  55. data/lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb +442 -0
  56. data/lib/twilio-ruby/rest/conversations/v1/user.rb +35 -0
  57. data/lib/twilio-ruby/rest/conversations/v1.rb +24 -0
  58. data/lib/twilio-ruby/rest/conversations.rb +15 -0
  59. data/lib/twilio-ruby/rest/events/v1/event_type.rb +12 -5
  60. data/lib/twilio-ruby/rest/events/v1/sink.rb +41 -5
  61. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +28 -0
  62. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +55 -34
  63. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.rb +236 -0
  64. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.rb +330 -0
  65. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb +384 -0
  66. data/lib/twilio-ruby/rest/flex_api/v1/interaction.rb +233 -0
  67. data/lib/twilio-ruby/rest/flex_api/v1.rb +16 -0
  68. data/lib/twilio-ruby/rest/flex_api.rb +9 -0
  69. data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +258 -0
  70. data/lib/twilio-ruby/rest/{fax → frontline_api}/v1.rb +11 -11
  71. data/lib/twilio-ruby/rest/{fax.rb → frontline_api.rb} +11 -11
  72. data/lib/twilio-ruby/rest/insights/v1/annotation.rb +271 -0
  73. data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +434 -0
  74. data/lib/twilio-ruby/rest/insights/v1/conference/conference_participant.rb +474 -0
  75. data/lib/twilio-ruby/rest/insights/v1/conference.rb +512 -0
  76. data/lib/twilio-ruby/rest/insights/v1/setting.rb +215 -0
  77. data/lib/twilio-ruby/rest/insights/v1.rb +46 -0
  78. data/lib/twilio-ruby/rest/insights.rb +28 -0
  79. data/lib/twilio-ruby/rest/lookups/v2/phone_number.rb +268 -0
  80. data/lib/twilio-ruby/rest/lookups/v2.rb +45 -0
  81. data/lib/twilio-ruby/rest/lookups.rb +7 -0
  82. data/lib/twilio-ruby/rest/media/v1/media_processor.rb +397 -0
  83. data/lib/twilio-ruby/rest/media/v1/media_recording.rb +406 -0
  84. data/lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb +221 -0
  85. data/lib/twilio-ruby/rest/media/v1/player_streamer.rb +403 -0
  86. data/lib/twilio-ruby/rest/media/v1.rb +76 -0
  87. data/lib/twilio-ruby/rest/media.rb +65 -0
  88. data/lib/twilio-ruby/rest/{fax/v1/fax/fax_media.rb → messaging/v1/brand_registration/brand_vetting.rb} +134 -95
  89. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +127 -2
  90. data/lib/twilio-ruby/rest/messaging/v1/external_campaign.rb +7 -0
  91. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb +187 -20
  92. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person_usecase.rb +6 -2
  93. data/lib/twilio-ruby/rest/messaging/v1/service.rb +37 -5
  94. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb +268 -0
  95. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/replace_items.rb +188 -0
  96. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +128 -26
  97. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +7 -0
  98. data/lib/twilio-ruby/rest/pricing/v2/country.rb +280 -0
  99. data/lib/twilio-ruby/rest/pricing/v2/number.rb +225 -0
  100. data/lib/twilio-ruby/rest/pricing/v2.rb +37 -0
  101. data/lib/twilio-ruby/rest/pricing.rb +19 -0
  102. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +1 -1
  103. data/lib/twilio-ruby/rest/serverless/v1/service.rb +7 -0
  104. data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +1 -1
  105. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +1 -1
  106. data/lib/twilio-ruby/rest/supersim/v1/esim_profile.rb +372 -0
  107. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +44 -55
  108. data/lib/twilio-ruby/rest/supersim/v1/{command.rb → ip_command.rb} +132 -84
  109. data/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb +231 -0
  110. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +30 -1
  111. data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +1 -1
  112. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +23 -9
  113. data/lib/twilio-ruby/rest/supersim/v1.rb +23 -7
  114. data/lib/twilio-ruby/rest/supersim.rb +15 -6
  115. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +7 -0
  116. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +7 -3
  117. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb +6 -2
  118. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +7 -3
  119. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +23 -11
  120. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb +4 -2
  121. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb +4 -2
  122. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +38 -22
  123. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +19 -3
  124. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +155 -10
  125. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb +12 -9
  126. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +74 -22
  127. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +34 -15
  128. data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +66 -31
  129. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +7 -3
  130. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +25 -7
  131. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +24 -5
  132. data/lib/twilio-ruby/rest/verify/v2/service.rb +40 -11
  133. data/lib/twilio-ruby/rest/verify/v2/template.rb +206 -0
  134. data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +89 -21
  135. data/lib/twilio-ruby/rest/verify/v2/verification_attempts_summary.rb +234 -0
  136. data/lib/twilio-ruby/rest/verify/v2.rb +14 -0
  137. data/lib/twilio-ruby/rest/verify.rb +14 -2
  138. data/lib/twilio-ruby/rest/video/v1/composition.rb +21 -8
  139. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +0 -8
  140. data/lib/twilio-ruby/rest/video/v1/recording.rb +21 -0
  141. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +7 -0
  142. data/lib/twilio-ruby/rest/video/v1/room.rb +62 -5
  143. data/lib/twilio-ruby/rest/voice/v1/archived_call.rb +184 -0
  144. data/lib/twilio-ruby/rest/voice/v1.rb +21 -0
  145. data/lib/twilio-ruby/rest/voice.rb +8 -0
  146. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +3 -3
  147. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +16 -26
  148. data/lib/twilio-ruby/rest.rb +13 -0
  149. data/lib/twilio-ruby/twiml/voice_response.rb +727 -87
  150. data/lib/twilio-ruby/version.rb +1 -1
  151. data/lib/twilio-ruby.rb +6 -16
  152. data/sonar-project.properties +13 -0
  153. data/twilio-ruby.gemspec +1 -2
  154. metadata +59 -32
  155. data/.travis.yml +0 -45
  156. data/lib/twilio-ruby/rest/fax/v1/fax.rb +0 -536
  157. /data/lib/twilio-ruby/framework/{domain.rb → rest/domain.rb} +0 -0
  158. /data/lib/twilio-ruby/framework/{error.rb → rest/error.rb} +0 -0
  159. /data/lib/twilio-ruby/framework/{helper.rb → rest/helper.rb} +0 -0
  160. /data/lib/twilio-ruby/framework/{obsolete_client.rb → rest/obsolete_client.rb} +0 -0
  161. /data/lib/twilio-ruby/framework/{page.rb → rest/page.rb} +0 -0
  162. /data/lib/twilio-ruby/framework/{resource.rb → rest/resource.rb} +0 -0
  163. /data/lib/twilio-ruby/framework/{version.rb → rest/version.rb} +0 -0
@@ -0,0 +1,406 @@
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 Media < Domain
12
+ class V1 < Version
13
+ ##
14
+ # 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.
15
+ class MediaRecordingList < ListResource
16
+ ##
17
+ # Initialize the MediaRecordingList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [MediaRecordingList] MediaRecordingList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ @uri = "/MediaRecordings"
26
+ end
27
+
28
+ ##
29
+ # Lists MediaRecordingInstance records from the API as a list.
30
+ # Unlike stream(), this operation is eager and will load `limit` records into
31
+ # memory before returning.
32
+ # @param [media_recording.Order] order The sort order of the list by
33
+ # `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as
34
+ # the default.
35
+ # @param [media_recording.Status] status Status to filter by, with possible values
36
+ # `processing`, `completed`, `deleted`, or `failed`.
37
+ # @param [String] processor_sid SID of a MediaProcessor to filter by.
38
+ # @param [String] source_sid SID of a MediaRecording source to filter by.
39
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
40
+ # guarantees to never return more than limit. Default is no limit
41
+ # @param [Integer] page_size Number of records to fetch per request, when
42
+ # not set will use the default value of 50 records. If no page_size is defined
43
+ # but a limit is defined, stream() will attempt to read the limit with the most
44
+ # efficient page size, i.e. min(limit, 1000)
45
+ # @return [Array] Array of up to limit results
46
+ def list(order: :unset, status: :unset, processor_sid: :unset, source_sid: :unset, limit: nil, page_size: nil)
47
+ self.stream(
48
+ order: order,
49
+ status: status,
50
+ processor_sid: processor_sid,
51
+ source_sid: source_sid,
52
+ limit: limit,
53
+ page_size: page_size
54
+ ).entries
55
+ end
56
+
57
+ ##
58
+ # Streams MediaRecordingInstance records from the API as an Enumerable.
59
+ # This operation lazily loads records as efficiently as possible until the limit
60
+ # is reached.
61
+ # @param [media_recording.Order] order The sort order of the list by
62
+ # `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as
63
+ # the default.
64
+ # @param [media_recording.Status] status Status to filter by, with possible values
65
+ # `processing`, `completed`, `deleted`, or `failed`.
66
+ # @param [String] processor_sid SID of a MediaProcessor to filter by.
67
+ # @param [String] source_sid SID of a MediaRecording source to filter by.
68
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
69
+ # guarantees to never return more than limit. Default is no limit.
70
+ # @param [Integer] page_size Number of records to fetch per request, when
71
+ # not set will use the default value of 50 records. If no page_size is defined
72
+ # but a limit is defined, stream() will attempt to read the limit with the most
73
+ # efficient page size, i.e. min(limit, 1000)
74
+ # @return [Enumerable] Enumerable that will yield up to limit results
75
+ def stream(order: :unset, status: :unset, processor_sid: :unset, source_sid: :unset, limit: nil, page_size: nil)
76
+ limits = @version.read_limits(limit, page_size)
77
+
78
+ page = self.page(
79
+ order: order,
80
+ status: status,
81
+ processor_sid: processor_sid,
82
+ source_sid: source_sid,
83
+ page_size: limits[:page_size],
84
+ )
85
+
86
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
87
+ end
88
+
89
+ ##
90
+ # When passed a block, yields MediaRecordingInstance records from the API.
91
+ # This operation lazily loads records as efficiently as possible until the limit
92
+ # is reached.
93
+ def each
94
+ limits = @version.read_limits
95
+
96
+ page = self.page(page_size: limits[:page_size], )
97
+
98
+ @version.stream(page,
99
+ limit: limits[:limit],
100
+ page_limit: limits[:page_limit]).each {|x| yield x}
101
+ end
102
+
103
+ ##
104
+ # Retrieve a single page of MediaRecordingInstance records from the API.
105
+ # Request is executed immediately.
106
+ # @param [media_recording.Order] order The sort order of the list by
107
+ # `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as
108
+ # the default.
109
+ # @param [media_recording.Status] status Status to filter by, with possible values
110
+ # `processing`, `completed`, `deleted`, or `failed`.
111
+ # @param [String] processor_sid SID of a MediaProcessor to filter by.
112
+ # @param [String] source_sid SID of a MediaRecording source to filter by.
113
+ # @param [String] page_token PageToken provided by the API
114
+ # @param [Integer] page_number Page Number, this value is simply for client state
115
+ # @param [Integer] page_size Number of records to return, defaults to 50
116
+ # @return [Page] Page of MediaRecordingInstance
117
+ def page(order: :unset, status: :unset, processor_sid: :unset, source_sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
118
+ params = Twilio::Values.of({
119
+ 'Order' => order,
120
+ 'Status' => status,
121
+ 'ProcessorSid' => processor_sid,
122
+ 'SourceSid' => source_sid,
123
+ 'PageToken' => page_token,
124
+ 'Page' => page_number,
125
+ 'PageSize' => page_size,
126
+ })
127
+
128
+ response = @version.page('GET', @uri, params: params)
129
+
130
+ MediaRecordingPage.new(@version, response, @solution)
131
+ end
132
+
133
+ ##
134
+ # Retrieve a single page of MediaRecordingInstance records from the API.
135
+ # Request is executed immediately.
136
+ # @param [String] target_url API-generated URL for the requested results page
137
+ # @return [Page] Page of MediaRecordingInstance
138
+ def get_page(target_url)
139
+ response = @version.domain.request(
140
+ 'GET',
141
+ target_url
142
+ )
143
+ MediaRecordingPage.new(@version, response, @solution)
144
+ end
145
+
146
+ ##
147
+ # Provide a user friendly representation
148
+ def to_s
149
+ '#<Twilio.Media.V1.MediaRecordingList>'
150
+ end
151
+ end
152
+
153
+ ##
154
+ # 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.
155
+ class MediaRecordingPage < Page
156
+ ##
157
+ # Initialize the MediaRecordingPage
158
+ # @param [Version] version Version that contains the resource
159
+ # @param [Response] response Response from the API
160
+ # @param [Hash] solution Path solution for the resource
161
+ # @return [MediaRecordingPage] MediaRecordingPage
162
+ def initialize(version, response, solution)
163
+ super(version, response)
164
+
165
+ # Path Solution
166
+ @solution = solution
167
+ end
168
+
169
+ ##
170
+ # Build an instance of MediaRecordingInstance
171
+ # @param [Hash] payload Payload response from the API
172
+ # @return [MediaRecordingInstance] MediaRecordingInstance
173
+ def get_instance(payload)
174
+ MediaRecordingInstance.new(@version, payload, )
175
+ end
176
+
177
+ ##
178
+ # Provide a user friendly representation
179
+ def to_s
180
+ '<Twilio.Media.V1.MediaRecordingPage>'
181
+ end
182
+ end
183
+
184
+ ##
185
+ # 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.
186
+ class MediaRecordingContext < InstanceContext
187
+ ##
188
+ # Initialize the MediaRecordingContext
189
+ # @param [Version] version Version that contains the resource
190
+ # @param [String] sid The SID of the MediaRecording resource to fetch.
191
+ # @return [MediaRecordingContext] MediaRecordingContext
192
+ def initialize(version, sid)
193
+ super(version)
194
+
195
+ # Path Solution
196
+ @solution = {sid: sid, }
197
+ @uri = "/MediaRecordings/#{@solution[:sid]}"
198
+ end
199
+
200
+ ##
201
+ # Delete the MediaRecordingInstance
202
+ # @return [Boolean] true if delete succeeds, false otherwise
203
+ def delete
204
+ @version.delete('DELETE', @uri)
205
+ end
206
+
207
+ ##
208
+ # Fetch the MediaRecordingInstance
209
+ # @return [MediaRecordingInstance] Fetched MediaRecordingInstance
210
+ def fetch
211
+ payload = @version.fetch('GET', @uri)
212
+
213
+ MediaRecordingInstance.new(@version, payload, sid: @solution[:sid], )
214
+ end
215
+
216
+ ##
217
+ # Provide a user friendly representation
218
+ def to_s
219
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
220
+ "#<Twilio.Media.V1.MediaRecordingContext #{context}>"
221
+ end
222
+
223
+ ##
224
+ # Provide a detailed, user friendly representation
225
+ def inspect
226
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
227
+ "#<Twilio.Media.V1.MediaRecordingContext #{context}>"
228
+ end
229
+ end
230
+
231
+ ##
232
+ # 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.
233
+ class MediaRecordingInstance < InstanceResource
234
+ ##
235
+ # Initialize the MediaRecordingInstance
236
+ # @param [Version] version Version that contains the resource
237
+ # @param [Hash] payload payload that contains response from Twilio
238
+ # @param [String] sid The SID of the MediaRecording resource to fetch.
239
+ # @return [MediaRecordingInstance] MediaRecordingInstance
240
+ def initialize(version, payload, sid: nil)
241
+ super(version)
242
+
243
+ # Marshaled Properties
244
+ @properties = {
245
+ 'account_sid' => payload['account_sid'],
246
+ 'bitrate' => payload['bitrate'].to_i,
247
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
248
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
249
+ 'duration' => payload['duration'].to_i,
250
+ 'format' => payload['format'],
251
+ 'links' => payload['links'],
252
+ 'processor_sid' => payload['processor_sid'],
253
+ 'resolution' => payload['resolution'],
254
+ 'source_sid' => payload['source_sid'],
255
+ 'sid' => payload['sid'],
256
+ 'media_size' => payload['media_size'].to_i,
257
+ 'status' => payload['status'],
258
+ 'status_callback' => payload['status_callback'],
259
+ 'status_callback_method' => payload['status_callback_method'],
260
+ 'url' => payload['url'],
261
+ }
262
+
263
+ # Context
264
+ @instance_context = nil
265
+ @params = {'sid' => sid || @properties['sid'], }
266
+ end
267
+
268
+ ##
269
+ # Generate an instance context for the instance, the context is capable of
270
+ # performing various actions. All instance actions are proxied to the context
271
+ # @return [MediaRecordingContext] MediaRecordingContext for this MediaRecordingInstance
272
+ def context
273
+ unless @instance_context
274
+ @instance_context = MediaRecordingContext.new(@version, @params['sid'], )
275
+ end
276
+ @instance_context
277
+ end
278
+
279
+ ##
280
+ # @return [String] The SID of the Account that created the resource
281
+ def account_sid
282
+ @properties['account_sid']
283
+ end
284
+
285
+ ##
286
+ # @return [String] The bitrate of the media
287
+ def bitrate
288
+ @properties['bitrate']
289
+ end
290
+
291
+ ##
292
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
293
+ def date_created
294
+ @properties['date_created']
295
+ end
296
+
297
+ ##
298
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
299
+ def date_updated
300
+ @properties['date_updated']
301
+ end
302
+
303
+ ##
304
+ # @return [String] The duration of the MediaRecording
305
+ def duration
306
+ @properties['duration']
307
+ end
308
+
309
+ ##
310
+ # @return [media_recording.Format] The format of the MediaRecording
311
+ def format
312
+ @properties['format']
313
+ end
314
+
315
+ ##
316
+ # @return [String] The URLs of related resources
317
+ def links
318
+ @properties['links']
319
+ end
320
+
321
+ ##
322
+ # @return [String] The SID of the MediaProcessor
323
+ def processor_sid
324
+ @properties['processor_sid']
325
+ end
326
+
327
+ ##
328
+ # @return [String] The dimensions of the video image in pixels
329
+ def resolution
330
+ @properties['resolution']
331
+ end
332
+
333
+ ##
334
+ # @return [String] The SID of the resource that generated the original media
335
+ def source_sid
336
+ @properties['source_sid']
337
+ end
338
+
339
+ ##
340
+ # @return [String] The unique string that identifies the resource
341
+ def sid
342
+ @properties['sid']
343
+ end
344
+
345
+ ##
346
+ # @return [String] The size of the recording media
347
+ def media_size
348
+ @properties['media_size']
349
+ end
350
+
351
+ ##
352
+ # @return [media_recording.Status] The status of the MediaRecording
353
+ def status
354
+ @properties['status']
355
+ end
356
+
357
+ ##
358
+ # @return [String] The URL to which Twilio will send MediaRecording event updates
359
+ def status_callback
360
+ @properties['status_callback']
361
+ end
362
+
363
+ ##
364
+ # @return [String] The HTTP method Twilio should use to call the `status_callback` URL
365
+ def status_callback_method
366
+ @properties['status_callback_method']
367
+ end
368
+
369
+ ##
370
+ # @return [String] The absolute URL of the resource
371
+ def url
372
+ @properties['url']
373
+ end
374
+
375
+ ##
376
+ # Delete the MediaRecordingInstance
377
+ # @return [Boolean] true if delete succeeds, false otherwise
378
+ def delete
379
+ context.delete
380
+ end
381
+
382
+ ##
383
+ # Fetch the MediaRecordingInstance
384
+ # @return [MediaRecordingInstance] Fetched MediaRecordingInstance
385
+ def fetch
386
+ context.fetch
387
+ end
388
+
389
+ ##
390
+ # Provide a user friendly representation
391
+ def to_s
392
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
393
+ "<Twilio.Media.V1.MediaRecordingInstance #{values}>"
394
+ end
395
+
396
+ ##
397
+ # Provide a detailed, user friendly representation
398
+ def inspect
399
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
400
+ "<Twilio.Media.V1.MediaRecordingInstance #{values}>"
401
+ end
402
+ end
403
+ end
404
+ end
405
+ end
406
+ end
@@ -0,0 +1,221 @@
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 Media < Domain
12
+ class V1 < Version
13
+ class PlayerStreamerContext < InstanceContext
14
+ class PlaybackGrantList < ListResource
15
+ ##
16
+ # Initialize the PlaybackGrantList
17
+ # @param [Version] version Version that contains the resource
18
+ # @param [String] sid The unique string generated to identify the PlayerStreamer
19
+ # resource that this PlaybackGrant authorizes views for.
20
+ # @return [PlaybackGrantList] PlaybackGrantList
21
+ def initialize(version, sid: nil)
22
+ super(version)
23
+
24
+ # Path Solution
25
+ @solution = {sid: sid}
26
+ end
27
+
28
+ ##
29
+ # Provide a user friendly representation
30
+ def to_s
31
+ '#<Twilio.Media.V1.PlaybackGrantList>'
32
+ end
33
+ end
34
+
35
+ class PlaybackGrantPage < Page
36
+ ##
37
+ # Initialize the PlaybackGrantPage
38
+ # @param [Version] version Version that contains the resource
39
+ # @param [Response] response Response from the API
40
+ # @param [Hash] solution Path solution for the resource
41
+ # @return [PlaybackGrantPage] PlaybackGrantPage
42
+ def initialize(version, response, solution)
43
+ super(version, response)
44
+
45
+ # Path Solution
46
+ @solution = solution
47
+ end
48
+
49
+ ##
50
+ # Build an instance of PlaybackGrantInstance
51
+ # @param [Hash] payload Payload response from the API
52
+ # @return [PlaybackGrantInstance] PlaybackGrantInstance
53
+ def get_instance(payload)
54
+ PlaybackGrantInstance.new(@version, payload, sid: @solution[:sid], )
55
+ end
56
+
57
+ ##
58
+ # Provide a user friendly representation
59
+ def to_s
60
+ '<Twilio.Media.V1.PlaybackGrantPage>'
61
+ end
62
+ end
63
+
64
+ class PlaybackGrantContext < InstanceContext
65
+ ##
66
+ # Initialize the PlaybackGrantContext
67
+ # @param [Version] version Version that contains the resource
68
+ # @param [String] sid The SID of the PlayerStreamer resource to fetch.
69
+ # @return [PlaybackGrantContext] PlaybackGrantContext
70
+ def initialize(version, sid)
71
+ super(version)
72
+
73
+ # Path Solution
74
+ @solution = {sid: sid, }
75
+ @uri = "/PlayerStreamers/#{@solution[:sid]}/PlaybackGrant"
76
+ end
77
+
78
+ ##
79
+ # Create the PlaybackGrantInstance
80
+ # @param [String] ttl The time to live of the PlaybackGrant. Default value is 15
81
+ # seconds. Maximum value is 60 seconds.
82
+ # @param [String] access_control_allow_origin The full origin URL where the
83
+ # livestream can be streamed. If this is not provided, it can be streamed from any
84
+ # domain.
85
+ # @return [PlaybackGrantInstance] Created PlaybackGrantInstance
86
+ def create(ttl: :unset, access_control_allow_origin: :unset)
87
+ data = Twilio::Values.of({'Ttl' => ttl, 'AccessControlAllowOrigin' => access_control_allow_origin, })
88
+
89
+ payload = @version.create('POST', @uri, data: data)
90
+
91
+ PlaybackGrantInstance.new(@version, payload, sid: @solution[:sid], )
92
+ end
93
+
94
+ ##
95
+ # Fetch the PlaybackGrantInstance
96
+ # @return [PlaybackGrantInstance] Fetched PlaybackGrantInstance
97
+ def fetch
98
+ payload = @version.fetch('GET', @uri)
99
+
100
+ PlaybackGrantInstance.new(@version, payload, sid: @solution[:sid], )
101
+ end
102
+
103
+ ##
104
+ # Provide a user friendly representation
105
+ def to_s
106
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
107
+ "#<Twilio.Media.V1.PlaybackGrantContext #{context}>"
108
+ end
109
+
110
+ ##
111
+ # Provide a detailed, user friendly representation
112
+ def inspect
113
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
114
+ "#<Twilio.Media.V1.PlaybackGrantContext #{context}>"
115
+ end
116
+ end
117
+
118
+ class PlaybackGrantInstance < InstanceResource
119
+ ##
120
+ # Initialize the PlaybackGrantInstance
121
+ # @param [Version] version Version that contains the resource
122
+ # @param [Hash] payload payload that contains response from Twilio
123
+ # @param [String] sid The unique string generated to identify the PlayerStreamer
124
+ # resource that this PlaybackGrant authorizes views for.
125
+ # @return [PlaybackGrantInstance] PlaybackGrantInstance
126
+ def initialize(version, payload, sid: nil)
127
+ super(version)
128
+
129
+ # Marshaled Properties
130
+ @properties = {
131
+ 'sid' => payload['sid'],
132
+ 'url' => payload['url'],
133
+ 'account_sid' => payload['account_sid'],
134
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
135
+ 'grant' => payload['grant'],
136
+ }
137
+
138
+ # Context
139
+ @instance_context = nil
140
+ @params = {'sid' => sid, }
141
+ end
142
+
143
+ ##
144
+ # Generate an instance context for the instance, the context is capable of
145
+ # performing various actions. All instance actions are proxied to the context
146
+ # @return [PlaybackGrantContext] PlaybackGrantContext for this PlaybackGrantInstance
147
+ def context
148
+ unless @instance_context
149
+ @instance_context = PlaybackGrantContext.new(@version, @params['sid'], )
150
+ end
151
+ @instance_context
152
+ end
153
+
154
+ ##
155
+ # @return [String] The unique string that identifies the PlayerStreamer associated with this PlaybackGrant.
156
+ def sid
157
+ @properties['sid']
158
+ end
159
+
160
+ ##
161
+ # @return [String] The absolute URL of the resource
162
+ def url
163
+ @properties['url']
164
+ end
165
+
166
+ ##
167
+ # @return [String] The SID of the Account that created the resource
168
+ def account_sid
169
+ @properties['account_sid']
170
+ end
171
+
172
+ ##
173
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
174
+ def date_created
175
+ @properties['date_created']
176
+ end
177
+
178
+ ##
179
+ # @return [Hash] The grant that authorizes the player sdk to connect to the livestream
180
+ def grant
181
+ @properties['grant']
182
+ end
183
+
184
+ ##
185
+ # Create the PlaybackGrantInstance
186
+ # @param [String] ttl The time to live of the PlaybackGrant. Default value is 15
187
+ # seconds. Maximum value is 60 seconds.
188
+ # @param [String] access_control_allow_origin The full origin URL where the
189
+ # livestream can be streamed. If this is not provided, it can be streamed from any
190
+ # domain.
191
+ # @return [PlaybackGrantInstance] Created PlaybackGrantInstance
192
+ def create(ttl: :unset, access_control_allow_origin: :unset)
193
+ context.create(ttl: ttl, access_control_allow_origin: access_control_allow_origin, )
194
+ end
195
+
196
+ ##
197
+ # Fetch the PlaybackGrantInstance
198
+ # @return [PlaybackGrantInstance] Fetched PlaybackGrantInstance
199
+ def fetch
200
+ context.fetch
201
+ end
202
+
203
+ ##
204
+ # Provide a user friendly representation
205
+ def to_s
206
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
207
+ "<Twilio.Media.V1.PlaybackGrantInstance #{values}>"
208
+ end
209
+
210
+ ##
211
+ # Provide a detailed, user friendly representation
212
+ def inspect
213
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
214
+ "<Twilio.Media.V1.PlaybackGrantInstance #{values}>"
215
+ end
216
+ end
217
+ end
218
+ end
219
+ end
220
+ end
221
+ end