twilio-ruby 5.10.5 → 5.10.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +10 -0
  3. data/CHANGES.md +10 -0
  4. data/Dockerfile +9 -0
  5. data/Makefile +11 -0
  6. data/README.md +5 -2
  7. data/lib/twilio-ruby/rest/api.rb +1 -2
  8. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +117 -32
  9. data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +30 -0
  10. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +112 -56
  11. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +460 -0
  12. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +7 -0
  13. data/lib/twilio-ruby/rest/api/v2010/account/transcription.rb +4 -4
  14. data/lib/twilio-ruby/rest/client.rb +1 -2
  15. data/lib/twilio-ruby/rest/preview.rb +8 -8
  16. data/lib/twilio-ruby/rest/preview/marketplace.rb +13 -13
  17. data/lib/twilio-ruby/rest/preview/understand/assistant/intent/field.rb +5 -2
  18. data/lib/twilio-ruby/rest/preview/understand/assistant/query.rb +8 -8
  19. data/lib/twilio-ruby/rest/proxy/v1/service.rb +9 -9
  20. data/lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb +10 -8
  21. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +3 -7
  22. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +3 -49
  23. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb +1 -1
  24. data/lib/twilio-ruby/rest/video.rb +18 -6
  25. data/lib/twilio-ruby/rest/video/v1.rb +27 -13
  26. data/lib/twilio-ruby/rest/video/v1/composition_settings.rb +278 -0
  27. data/lib/twilio-ruby/rest/video/v1/recording_settings.rb +278 -0
  28. data/lib/twilio-ruby/version.rb +1 -1
  29. data/spec/integration/api/v2010/account/call/recording_spec.rb +103 -0
  30. data/spec/integration/api/v2010/account/conference/recording_spec.rb +240 -0
  31. data/spec/integration/api/v2010/account/message_spec.rb +0 -5
  32. data/spec/integration/proxy/v1/service/session/participant_spec.rb +0 -48
  33. data/spec/integration/video/v1/composition_settings_spec.rb +86 -0
  34. data/spec/integration/video/v1/recording_settings_spec.rb +86 -0
  35. metadata +13 -3
@@ -17,7 +17,7 @@ module Twilio
17
17
  # Initialize the ParticipantList
18
18
  # @param [Version] version Version that contains the resource
19
19
  # @param [String] account_sid The unique id of the
20
- # [Account](https://www.twilio.com/docs/api/rest/account) that created this
20
+ # [Account](https://www.twilio.com/docs/iam/api/account) that created this
21
21
  # conference
22
22
  # @param [String] conference_sid A 34 character string that identifies the
23
23
  # conference this participant is in
@@ -33,35 +33,87 @@ module Twilio
33
33
  ##
34
34
  # Retrieve a single page of ParticipantInstance records from the API.
35
35
  # Request is executed immediately.
36
- # @param [String] from number, client id
37
- # @param [String] to number, client id, sip address
38
- # @param [String] status_callback absolute url
39
- # @param [String] status_callback_method GET, POST
40
- # @param [String] status_callback_event initiated, ringing, answered, completed
41
- # @param [String] timeout 5-600
42
- # @param [Boolean] record true, false
43
- # @param [Boolean] muted true, false
44
- # @param [String] beep true, false, onEnter, onExit
45
- # @param [Boolean] start_conference_on_enter true, false
46
- # @param [Boolean] end_conference_on_exit true, false
47
- # @param [String] wait_url absolute url
48
- # @param [String] wait_method GET, POST
49
- # @param [Boolean] early_media true, false
50
- # @param [String] max_participants 2-10
51
- # @param [String] conference_record true, false, record-from-start, do-not-record
52
- # @param [String] conference_trim trim-silence or do-not-trim
53
- # @param [String] conference_status_callback absolute url
54
- # @param [String] conference_status_callback_method GET, POST
55
- # @param [String] conference_status_callback_event start end join leave mute hold
56
- # speaker
57
- # @param [String] recording_channels mono, dual
58
- # @param [String] recording_status_callback absolute url
59
- # @param [String] recording_status_callback_method GET, POST
60
- # @param [String] sip_auth_username sip username
61
- # @param [String] sip_auth_password sip password
62
- # @param [String] region us1, ie1, de1, sg1, br1, au1, jp1
63
- # @param [String] conference_recording_status_callback absolute url
64
- # @param [String] conference_recording_status_callback_method GET, POST
36
+ # @param [String] from The `from` phone number that will dial the new conference
37
+ # participant. Values may be a phone number or client id.
38
+ # @param [String] to The phone number, client id, or sip address you are inviting
39
+ # to this conference.
40
+ # @param [String] status_callback The absolute URL where Twilio should send a
41
+ # webhook with conference event information that you request with the
42
+ # `StatusCallbackEvent` parameter.
43
+ # @param [String] status_callback_method The method Twilio should use when
44
+ # requesting your `StatusCallback` URL. Options are `GET` and `POST`. Defaults to
45
+ # `POST`.
46
+ # @param [String] status_callback_event Specifies which conference state changes
47
+ # should generate a webhook to the `StatusCallback` URL. Options are `initiated`,
48
+ # `ringing`, `answered`, and `completed`. To specify multiple values, separate
49
+ # each with a space. Defaults to `completed`.
50
+ # @param [String] timeout The number of seconds (integer) that Twilio should allow
51
+ # the phone to ring before assuming there is no answer. Defaults to 60 seconds.
52
+ # Minimum allowed timeout is `5`, max is `600`. Twilio always adds a 5-second
53
+ # timeout buffer to outgoing calls, so if you enter a timeout value of 10 seconds,
54
+ # you will see an actual timeout closer to 15 seconds.
55
+ # @param [Boolean] record Records the agent and their conferences, including
56
+ # downtime between conferences. Values may be `true` or `false`. Defaults to
57
+ # `false`.
58
+ # @param [Boolean] muted Specify whether the agent can speak in the conference.
59
+ # Values can be `true` or `false`. Defaults to `false`.
60
+ # @param [String] beep Play a notification beep to the conference when this
61
+ # participant joins. Options are `true`, `false`, `onEnter`, or `onExit`. Defaults
62
+ # to `true`.
63
+ # @param [Boolean] start_conference_on_enter If the conference has not already
64
+ # begun, `true` will start the conference when this participant joins. Specifying
65
+ # `false` will mute the participant and play background music until the conference
66
+ # begins. Defaults to `true`.
67
+ # @param [Boolean] end_conference_on_exit If `true`, will end the conference when
68
+ # this participant leaves. Defaults to `false`.
69
+ # @param [String] wait_url Specify an absolute URL that hosts music to play before
70
+ # the conference starts. Defualts to Twilio's standard [hold
71
+ # music](https://www.twilio.com/labs/twimlets/holdmusic).
72
+ # @param [String] wait_method Specify which method, `GET` or `POST`, Twilio should
73
+ # use to request the `WaitUrl` for this conference. Be sure to use `GET` if you
74
+ # are directly requesting static audio files so that Twilio properly caches the
75
+ # files. Defaults to `POST`.
76
+ # @param [Boolean] early_media Allow an agent to hear the state of the outbound
77
+ # call, including ringing or disconnect messages. Can be `true` or `false`.
78
+ # Defaults to `true`.
79
+ # @param [String] max_participants The maximum number of participants within this
80
+ # agent conference. Values can be positive integers from `2`-`10`. Defaults to
81
+ # `10`.
82
+ # @param [String] conference_record Records the conference that this participant
83
+ # is joining. Options are `true`, `false`, `record-from-start`, and
84
+ # `do-not-record`. Deafults to `false`
85
+ # @param [String] conference_trim Specify whether to trim leading and trailing
86
+ # silence from your recorded conference audio files. Options are `trim-silence`
87
+ # and `do-not-trim`. Defaults to `trim-silence`
88
+ # @param [String] conference_status_callback The absolute URL Twilio should
89
+ # request with conference events specified in `ConferenceStatusCallbackEvent`.
90
+ # This value is set by the first Participant to join the conference, and
91
+ # subsequent callback URLs will be ignored.
92
+ # @param [String] conference_status_callback_method The HTTP method Twilio should
93
+ # use when requesting the `ConferenceStatusCallback` URL. Either `GET` or `POST`.
94
+ # Defaults to `POST`.
95
+ # @param [String] conference_status_callback_event Specifies which conference
96
+ # state changes should generate a webhook to the URL specified in the
97
+ # `ConferenceStatusCallback` attribute. Available values are `start`, `end`,
98
+ # `join`, `leave`, `mute`, `hold`, and `speaker`. To specify multiple values,
99
+ # separate them with a space. Defaults to `start` and `end`.
100
+ # @param [String] recording_channels Set the recording channels for the final
101
+ # agent/conference recording. Either `mono` or `dual`. Defaults to `mono`.
102
+ # @param [String] recording_status_callback Specifies the `absolute URL` that
103
+ # Twilio should request when the recording is available if the agent and
104
+ # conference are recorded.
105
+ # @param [String] recording_status_callback_method The HTTP method Twilio should
106
+ # use when requesting the `RecordingStatusCallback`. `GET` or `POST`. Defaults to
107
+ # `POST`.
108
+ # @param [String] sip_auth_username SIP username used for authenticating.
109
+ # @param [String] sip_auth_password SIP password for authentication.
110
+ # @param [String] region Specifies the
111
+ # [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where Twilio should mix the recorded audio. Options are `us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, `jp1`.
112
+ # @param [String] conference_recording_status_callback The `absolute URL` Twilio
113
+ # should request when the conference recording is available.
114
+ # @param [String] conference_recording_status_callback_method The HTTP method
115
+ # Twilio should use when requesting your recording status callback URL, either
116
+ # `GET` or `POST`. Defaults to `POST`.
65
117
  # @param [String] recording_status_callback_event The
66
118
  # recording_status_callback_event
67
119
  # @param [String] conference_recording_status_callback_event The
@@ -119,10 +171,10 @@ module Twilio
119
171
  # Lists ParticipantInstance records from the API as a list.
120
172
  # Unlike stream(), this operation is eager and will load `limit` records into
121
173
  # memory before returning.
122
- # @param [Boolean] muted Only show participants that are muted or unmuted. Either
123
- # `true` or `false`.
124
- # @param [Boolean] hold Only show participants that are held or unheld. Either
125
- # `true` or `false`.
174
+ # @param [Boolean] muted Only return participants that are muted or unmuted.
175
+ # Either `true` or `false`.
176
+ # @param [Boolean] hold Only return participants that are on hold or not on hold.
177
+ # Either `true` or `false`.
126
178
  # @param [Integer] limit Upper limit for the number of records to return. stream()
127
179
  # guarantees to never return more than limit. Default is no limit
128
180
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -138,10 +190,10 @@ module Twilio
138
190
  # Streams ParticipantInstance records from the API as an Enumerable.
139
191
  # This operation lazily loads records as efficiently as possible until the limit
140
192
  # is reached.
141
- # @param [Boolean] muted Only show participants that are muted or unmuted. Either
142
- # `true` or `false`.
143
- # @param [Boolean] hold Only show participants that are held or unheld. Either
144
- # `true` or `false`.
193
+ # @param [Boolean] muted Only return participants that are muted or unmuted.
194
+ # Either `true` or `false`.
195
+ # @param [Boolean] hold Only return participants that are on hold or not on hold.
196
+ # Either `true` or `false`.
145
197
  # @param [Integer] limit Upper limit for the number of records to return. stream()
146
198
  # guarantees to never return more than limit. Default is no limit.
147
199
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -174,10 +226,10 @@ module Twilio
174
226
  ##
175
227
  # Retrieve a single page of ParticipantInstance records from the API.
176
228
  # Request is executed immediately.
177
- # @param [Boolean] muted Only show participants that are muted or unmuted. Either
178
- # `true` or `false`.
179
- # @param [Boolean] hold Only show participants that are held or unheld. Either
180
- # `true` or `false`.
229
+ # @param [Boolean] muted Only return participants that are muted or unmuted.
230
+ # Either `true` or `false`.
231
+ # @param [Boolean] hold Only return participants that are on hold or not on hold.
232
+ # Either `true` or `false`.
181
233
  # @param [String] page_token PageToken provided by the API
182
234
  # @param [Integer] page_number Page Number, this value is simply for client state
183
235
  # @param [Integer] page_size Number of records to return, defaults to 50
@@ -258,8 +310,8 @@ module Twilio
258
310
  # @param [Version] version Version that contains the resource
259
311
  # @param [String] account_sid The account_sid
260
312
  # @param [String] conference_sid The string that uniquely identifies the
261
- # conference this participant is in
262
- # @param [String] call_sid The call_sid
313
+ # conference this participant is in.
314
+ # @param [String] call_sid The Participant's unique Call SID.
263
315
  # @return [ParticipantContext] ParticipantContext
264
316
  def initialize(version, account_sid, conference_sid, call_sid)
265
317
  super(version)
@@ -296,15 +348,17 @@ module Twilio
296
348
  # `false` will un-mute. Anything other than `true` or `false` is interpreted as
297
349
  # `false`.
298
350
  # @param [Boolean] hold Specifying `true` will hold the participant, while `false`
299
- # will un-hold.
351
+ # will remove them from hold.
300
352
  # @param [String] hold_url The 'HoldUrl' attribute lets you specify a URL for
301
- # music that plays when a participant is held. The URL may be an MP3, a WAV or a
302
- # TwiML document that uses `<Play>`, `<Say>` or `<Redirect>`.
303
- # @param [String] hold_method Specify GET or POST, defaults to GET
353
+ # music that plays when a participant is on hold. The URL may be an MP3, a WAV or
354
+ # a TwiML document that uses `<Play>`, `<Say>` or `<Redirect>`.
355
+ # @param [String] hold_method Specify the HTTP method Twilio should use to request
356
+ # your `HoldUrl`, either `GET` or `POST`. Defaults to `GET`.
304
357
  # @param [String] announce_url The 'AnnounceUrl' attribute lets you specify a URL
305
358
  # for announcing something to the participant. The URL may return an MP3, a WAV or
306
359
  # a TwiML document with `<Play>` or `<Say>`.
307
- # @param [String] announce_method Specify GET or POST, defaults to POST
360
+ # @param [String] announce_method Specify the HTTP method Twilio should use to
361
+ # request your `AnnounceUrl`, either `GET` or `POST`. Defaults to `POST`.
308
362
  # @return [ParticipantInstance] Updated ParticipantInstance
309
363
  def update(muted: :unset, hold: :unset, hold_url: :unset, hold_method: :unset, announce_url: :unset, announce_method: :unset)
310
364
  data = Twilio::Values.of({
@@ -352,11 +406,11 @@ module Twilio
352
406
  # @param [Version] version Version that contains the resource
353
407
  # @param [Hash] payload payload that contains response from Twilio
354
408
  # @param [String] account_sid The unique id of the
355
- # [Account](https://www.twilio.com/docs/api/rest/account) that created this
409
+ # [Account](https://www.twilio.com/docs/iam/api/account) that created this
356
410
  # conference
357
411
  # @param [String] conference_sid A 34 character string that identifies the
358
412
  # conference this participant is in
359
- # @param [String] call_sid The call_sid
413
+ # @param [String] call_sid The Participant's unique Call SID.
360
414
  # @return [ParticipantInstance] ParticipantInstance
361
415
  def initialize(version, payload, account_sid: nil, conference_sid: nil, call_sid: nil)
362
416
  super(version)
@@ -480,15 +534,17 @@ module Twilio
480
534
  # `false` will un-mute. Anything other than `true` or `false` is interpreted as
481
535
  # `false`.
482
536
  # @param [Boolean] hold Specifying `true` will hold the participant, while `false`
483
- # will un-hold.
537
+ # will remove them from hold.
484
538
  # @param [String] hold_url The 'HoldUrl' attribute lets you specify a URL for
485
- # music that plays when a participant is held. The URL may be an MP3, a WAV or a
486
- # TwiML document that uses `<Play>`, `<Say>` or `<Redirect>`.
487
- # @param [String] hold_method Specify GET or POST, defaults to GET
539
+ # music that plays when a participant is on hold. The URL may be an MP3, a WAV or
540
+ # a TwiML document that uses `<Play>`, `<Say>` or `<Redirect>`.
541
+ # @param [String] hold_method Specify the HTTP method Twilio should use to request
542
+ # your `HoldUrl`, either `GET` or `POST`. Defaults to `GET`.
488
543
  # @param [String] announce_url The 'AnnounceUrl' attribute lets you specify a URL
489
544
  # for announcing something to the participant. The URL may return an MP3, a WAV or
490
545
  # a TwiML document with `<Play>` or `<Say>`.
491
- # @param [String] announce_method Specify GET or POST, defaults to POST
546
+ # @param [String] announce_method Specify the HTTP method Twilio should use to
547
+ # request your `AnnounceUrl`, either `GET` or `POST`. Defaults to `POST`.
492
548
  # @return [ParticipantInstance] Updated ParticipantInstance
493
549
  def update(muted: :unset, hold: :unset, hold_url: :unset, hold_method: :unset, announce_url: :unset, announce_method: :unset)
494
550
  context.update(
@@ -0,0 +1,460 @@
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 ConferenceContext < InstanceContext
15
+ class RecordingList < ListResource
16
+ ##
17
+ # Initialize the RecordingList
18
+ # @param [Version] version Version that contains the resource
19
+ # @param [String] account_sid The unique ID of the
20
+ # [Account](https://www.twilio.com/docs/api/rest/account) responsible for this
21
+ # recording.
22
+ # @param [String] conference_sid The unique id for the conference associated with
23
+ # the recording.
24
+ # @return [RecordingList] RecordingList
25
+ def initialize(version, account_sid: nil, conference_sid: nil)
26
+ super(version)
27
+
28
+ # Path Solution
29
+ @solution = {account_sid: account_sid, conference_sid: conference_sid}
30
+ @uri = "/Accounts/#{@solution[:account_sid]}/Conferences/#{@solution[:conference_sid]}/Recordings.json"
31
+ end
32
+
33
+ ##
34
+ # Lists RecordingInstance 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 [Time] date_created_before Filter by date created
38
+ # @param [Time] date_created Filter by date created
39
+ # @param [Time] date_created_after Filter by date created
40
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
41
+ # guarantees to never return more than limit. Default is no limit
42
+ # @param [Integer] page_size Number of records to fetch per request, when
43
+ # not set will use the default value of 50 records. If no page_size is defined
44
+ # but a limit is defined, stream() will attempt to read the limit with the most
45
+ # efficient page size, i.e. min(limit, 1000)
46
+ # @return [Array] Array of up to limit results
47
+ def list(date_created_before: :unset, date_created: :unset, date_created_after: :unset, limit: nil, page_size: nil)
48
+ self.stream(
49
+ date_created_before: date_created_before,
50
+ date_created: date_created,
51
+ date_created_after: date_created_after,
52
+ limit: limit,
53
+ page_size: page_size
54
+ ).entries
55
+ end
56
+
57
+ ##
58
+ # Streams RecordingInstance 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 [Time] date_created_before Filter by date created
62
+ # @param [Time] date_created Filter by date created
63
+ # @param [Time] date_created_after Filter by date created
64
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
65
+ # guarantees to never return more than limit. Default is no limit.
66
+ # @param [Integer] page_size Number of records to fetch per request, when
67
+ # not set will use the default value of 50 records. If no page_size is defined
68
+ # but a limit is defined, stream() will attempt to read the limit with the most
69
+ # efficient page size, i.e. min(limit, 1000)
70
+ # @return [Enumerable] Enumerable that will yield up to limit results
71
+ def stream(date_created_before: :unset, date_created: :unset, date_created_after: :unset, limit: nil, page_size: nil)
72
+ limits = @version.read_limits(limit, page_size)
73
+
74
+ page = self.page(
75
+ date_created_before: date_created_before,
76
+ date_created: date_created,
77
+ date_created_after: date_created_after,
78
+ page_size: limits[:page_size],
79
+ )
80
+
81
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
82
+ end
83
+
84
+ ##
85
+ # When passed a block, yields RecordingInstance records from the API.
86
+ # This operation lazily loads records as efficiently as possible until the limit
87
+ # is reached.
88
+ def each
89
+ limits = @version.read_limits
90
+
91
+ page = self.page(page_size: limits[:page_size], )
92
+
93
+ @version.stream(page,
94
+ limit: limits[:limit],
95
+ page_limit: limits[:page_limit]).each {|x| yield x}
96
+ end
97
+
98
+ ##
99
+ # Retrieve a single page of RecordingInstance records from the API.
100
+ # Request is executed immediately.
101
+ # @param [Time] date_created_before Filter by date created
102
+ # @param [Time] date_created Filter by date created
103
+ # @param [Time] date_created_after Filter by date created
104
+ # @param [String] page_token PageToken provided by the API
105
+ # @param [Integer] page_number Page Number, this value is simply for client state
106
+ # @param [Integer] page_size Number of records to return, defaults to 50
107
+ # @return [Page] Page of RecordingInstance
108
+ def page(date_created_before: :unset, date_created: :unset, date_created_after: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
109
+ params = Twilio::Values.of({
110
+ 'DateCreated<' => Twilio.serialize_iso8601_date(date_created_before),
111
+ 'DateCreated' => Twilio.serialize_iso8601_date(date_created),
112
+ 'DateCreated>' => Twilio.serialize_iso8601_date(date_created_after),
113
+ 'PageToken' => page_token,
114
+ 'Page' => page_number,
115
+ 'PageSize' => page_size,
116
+ })
117
+ response = @version.page(
118
+ 'GET',
119
+ @uri,
120
+ params
121
+ )
122
+ RecordingPage.new(@version, response, @solution)
123
+ end
124
+
125
+ ##
126
+ # Retrieve a single page of RecordingInstance records from the API.
127
+ # Request is executed immediately.
128
+ # @param [String] target_url API-generated URL for the requested results page
129
+ # @return [Page] Page of RecordingInstance
130
+ def get_page(target_url)
131
+ response = @version.domain.request(
132
+ 'GET',
133
+ target_url
134
+ )
135
+ RecordingPage.new(@version, response, @solution)
136
+ end
137
+
138
+ ##
139
+ # Provide a user friendly representation
140
+ def to_s
141
+ '#<Twilio.Api.V2010.RecordingList>'
142
+ end
143
+ end
144
+
145
+ class RecordingPage < Page
146
+ ##
147
+ # Initialize the RecordingPage
148
+ # @param [Version] version Version that contains the resource
149
+ # @param [Response] response Response from the API
150
+ # @param [Hash] solution Path solution for the resource
151
+ # @return [RecordingPage] RecordingPage
152
+ def initialize(version, response, solution)
153
+ super(version, response)
154
+
155
+ # Path Solution
156
+ @solution = solution
157
+ end
158
+
159
+ ##
160
+ # Build an instance of RecordingInstance
161
+ # @param [Hash] payload Payload response from the API
162
+ # @return [RecordingInstance] RecordingInstance
163
+ def get_instance(payload)
164
+ RecordingInstance.new(
165
+ @version,
166
+ payload,
167
+ account_sid: @solution[:account_sid],
168
+ conference_sid: @solution[:conference_sid],
169
+ )
170
+ end
171
+
172
+ ##
173
+ # Provide a user friendly representation
174
+ def to_s
175
+ '<Twilio.Api.V2010.RecordingPage>'
176
+ end
177
+ end
178
+
179
+ class RecordingContext < InstanceContext
180
+ ##
181
+ # Initialize the RecordingContext
182
+ # @param [Version] version Version that contains the resource
183
+ # @param [String] account_sid The account_sid
184
+ # @param [String] conference_sid The conference Sid that uniquely identifies this
185
+ # resource
186
+ # @param [String] sid The recording Sid that uniquely identifies this resource
187
+ # @return [RecordingContext] RecordingContext
188
+ def initialize(version, account_sid, conference_sid, sid)
189
+ super(version)
190
+
191
+ # Path Solution
192
+ @solution = {account_sid: account_sid, conference_sid: conference_sid, sid: sid, }
193
+ @uri = "/Accounts/#{@solution[:account_sid]}/Conferences/#{@solution[:conference_sid]}/Recordings/#{@solution[:sid]}.json"
194
+ end
195
+
196
+ ##
197
+ # Update the RecordingInstance
198
+ # @param [recording.Status] status The status to change the recording to.
199
+ # Possible values : stopped, paused, in-progress
200
+ # @return [RecordingInstance] Updated RecordingInstance
201
+ def update(status: nil)
202
+ data = Twilio::Values.of({'Status' => status, })
203
+
204
+ payload = @version.update(
205
+ 'POST',
206
+ @uri,
207
+ data: data,
208
+ )
209
+
210
+ RecordingInstance.new(
211
+ @version,
212
+ payload,
213
+ account_sid: @solution[:account_sid],
214
+ conference_sid: @solution[:conference_sid],
215
+ sid: @solution[:sid],
216
+ )
217
+ end
218
+
219
+ ##
220
+ # Fetch a RecordingInstance
221
+ # @return [RecordingInstance] Fetched RecordingInstance
222
+ def fetch
223
+ params = Twilio::Values.of({})
224
+
225
+ payload = @version.fetch(
226
+ 'GET',
227
+ @uri,
228
+ params,
229
+ )
230
+
231
+ RecordingInstance.new(
232
+ @version,
233
+ payload,
234
+ account_sid: @solution[:account_sid],
235
+ conference_sid: @solution[:conference_sid],
236
+ sid: @solution[:sid],
237
+ )
238
+ end
239
+
240
+ ##
241
+ # Deletes the RecordingInstance
242
+ # @return [Boolean] true if delete succeeds, true otherwise
243
+ def delete
244
+ @version.delete('delete', @uri)
245
+ end
246
+
247
+ ##
248
+ # Provide a user friendly representation
249
+ def to_s
250
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
251
+ "#<Twilio.Api.V2010.RecordingContext #{context}>"
252
+ end
253
+ end
254
+
255
+ class RecordingInstance < InstanceResource
256
+ ##
257
+ # Initialize the RecordingInstance
258
+ # @param [Version] version Version that contains the resource
259
+ # @param [Hash] payload payload that contains response from Twilio
260
+ # @param [String] account_sid The unique ID of the
261
+ # [Account](https://www.twilio.com/docs/api/rest/account) responsible for this
262
+ # recording.
263
+ # @param [String] conference_sid The unique id for the conference associated with
264
+ # the recording.
265
+ # @param [String] sid The recording Sid that uniquely identifies this resource
266
+ # @return [RecordingInstance] RecordingInstance
267
+ def initialize(version, payload, account_sid: nil, conference_sid: nil, sid: nil)
268
+ super(version)
269
+
270
+ # Marshaled Properties
271
+ @properties = {
272
+ 'account_sid' => payload['account_sid'],
273
+ 'api_version' => payload['api_version'],
274
+ 'call_sid' => payload['call_sid'],
275
+ 'conference_sid' => payload['conference_sid'],
276
+ 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
277
+ 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
278
+ 'start_time' => Twilio.deserialize_rfc2822(payload['start_time']),
279
+ 'duration' => payload['duration'],
280
+ 'sid' => payload['sid'],
281
+ 'price' => payload['price'].to_f,
282
+ 'price_unit' => payload['price_unit'],
283
+ 'status' => payload['status'],
284
+ 'channels' => payload['channels'].to_i,
285
+ 'source' => payload['source'],
286
+ 'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i,
287
+ 'encryption_details' => payload['encryption_details'],
288
+ 'uri' => payload['uri'],
289
+ }
290
+
291
+ # Context
292
+ @instance_context = nil
293
+ @params = {
294
+ 'account_sid' => account_sid,
295
+ 'conference_sid' => conference_sid,
296
+ 'sid' => sid || @properties['sid'],
297
+ }
298
+ end
299
+
300
+ ##
301
+ # Generate an instance context for the instance, the context is capable of
302
+ # performing various actions. All instance actions are proxied to the context
303
+ # @return [RecordingContext] RecordingContext for this RecordingInstance
304
+ def context
305
+ unless @instance_context
306
+ @instance_context = RecordingContext.new(
307
+ @version,
308
+ @params['account_sid'],
309
+ @params['conference_sid'],
310
+ @params['sid'],
311
+ )
312
+ end
313
+ @instance_context
314
+ end
315
+
316
+ ##
317
+ # @return [String] The unique sid that identifies this account
318
+ def account_sid
319
+ @properties['account_sid']
320
+ end
321
+
322
+ ##
323
+ # @return [String] The version of the API in use during the recording.
324
+ def api_version
325
+ @properties['api_version']
326
+ end
327
+
328
+ ##
329
+ # @return [String] The unique id for the call leg that corresponds to the recording.
330
+ def call_sid
331
+ @properties['call_sid']
332
+ end
333
+
334
+ ##
335
+ # @return [String] The unique id for the conference associated with the recording.
336
+ def conference_sid
337
+ @properties['conference_sid']
338
+ end
339
+
340
+ ##
341
+ # @return [Time] The date this resource was created
342
+ def date_created
343
+ @properties['date_created']
344
+ end
345
+
346
+ ##
347
+ # @return [Time] The date this resource was last updated
348
+ def date_updated
349
+ @properties['date_updated']
350
+ end
351
+
352
+ ##
353
+ # @return [Time] The start time of the recording, given in RFC 2822 format.
354
+ def start_time
355
+ @properties['start_time']
356
+ end
357
+
358
+ ##
359
+ # @return [String] The length of the recording, in seconds.
360
+ def duration
361
+ @properties['duration']
362
+ end
363
+
364
+ ##
365
+ # @return [String] A string that uniquely identifies this recording
366
+ def sid
367
+ @properties['sid']
368
+ end
369
+
370
+ ##
371
+ # @return [String] The one-time cost of creating this recording.
372
+ def price
373
+ @properties['price']
374
+ end
375
+
376
+ ##
377
+ # @return [String] The currency used in the Price property.
378
+ def price_unit
379
+ @properties['price_unit']
380
+ end
381
+
382
+ ##
383
+ # @return [recording.Status] The status of the recording.
384
+ def status
385
+ @properties['status']
386
+ end
387
+
388
+ ##
389
+ # @return [String] The number of channels in the final recording file as an integer.
390
+ def channels
391
+ @properties['channels']
392
+ end
393
+
394
+ ##
395
+ # @return [recording.Source] The way in which this recording was created.
396
+ def source
397
+ @properties['source']
398
+ end
399
+
400
+ ##
401
+ # @return [String] More information about the recording failure, if Status is failed.
402
+ def error_code
403
+ @properties['error_code']
404
+ end
405
+
406
+ ##
407
+ # @return [Hash] Details for how to decrypt the recording.
408
+ def encryption_details
409
+ @properties['encryption_details']
410
+ end
411
+
412
+ ##
413
+ # @return [String] The URI for this resource
414
+ def uri
415
+ @properties['uri']
416
+ end
417
+
418
+ ##
419
+ # Update the RecordingInstance
420
+ # @param [recording.Status] status The status to change the recording to.
421
+ # Possible values : stopped, paused, in-progress
422
+ # @return [RecordingInstance] Updated RecordingInstance
423
+ def update(status: nil)
424
+ context.update(status: status, )
425
+ end
426
+
427
+ ##
428
+ # Fetch a RecordingInstance
429
+ # @return [RecordingInstance] Fetched RecordingInstance
430
+ def fetch
431
+ context.fetch
432
+ end
433
+
434
+ ##
435
+ # Deletes the RecordingInstance
436
+ # @return [Boolean] true if delete succeeds, true otherwise
437
+ def delete
438
+ context.delete
439
+ end
440
+
441
+ ##
442
+ # Provide a user friendly representation
443
+ def to_s
444
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
445
+ "<Twilio.Api.V2010.RecordingInstance #{values}>"
446
+ end
447
+
448
+ ##
449
+ # Provide a detailed, user friendly representation
450
+ def inspect
451
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
452
+ "<Twilio.Api.V2010.RecordingInstance #{values}>"
453
+ end
454
+ end
455
+ end
456
+ end
457
+ end
458
+ end
459
+ end
460
+ end