twilio-ruby 5.6.1 → 5.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -242,6 +242,7 @@ module Twilio
242
242
  'container_format' => payload['container_format'],
243
243
  'codec' => payload['codec'],
244
244
  'grouping_sids' => payload['grouping_sids'],
245
+ 'track_name' => payload['track_name'],
245
246
  'links' => payload['links'],
246
247
  }
247
248
 
@@ -333,6 +334,12 @@ module Twilio
333
334
  @properties['grouping_sids']
334
335
  end
335
336
 
337
+ ##
338
+ # @return [String] The track_name
339
+ def track_name
340
+ @properties['track_name']
341
+ end
342
+
336
343
  ##
337
344
  # @return [String] The links
338
345
  def links
@@ -186,6 +186,7 @@ module Twilio
186
186
 
187
187
  # Dependents
188
188
  @published_tracks = nil
189
+ @subscribed_tracks = nil
189
190
  end
190
191
 
191
192
  ##
@@ -241,6 +242,22 @@ module Twilio
241
242
  @published_tracks
242
243
  end
243
244
 
245
+ ##
246
+ # Access the subscribed_tracks
247
+ # @return [SubscribedTrackList]
248
+ # @return [SubscribedTrackContext]
249
+ def subscribed_tracks
250
+ unless @subscribed_tracks
251
+ @subscribed_tracks = SubscribedTrackList.new(
252
+ @version,
253
+ room_sid: @solution[:room_sid],
254
+ subscriber_sid: @solution[:sid],
255
+ )
256
+ end
257
+
258
+ @subscribed_tracks
259
+ end
260
+
244
261
  ##
245
262
  # Provide a user friendly representation
246
263
  def to_s
@@ -386,6 +403,13 @@ module Twilio
386
403
  context.published_tracks
387
404
  end
388
405
 
406
+ ##
407
+ # Access the subscribed_tracks
408
+ # @return [subscribed_tracks] subscribed_tracks
409
+ def subscribed_tracks
410
+ context.subscribed_tracks
411
+ end
412
+
389
413
  ##
390
414
  # Provide a user friendly representation
391
415
  def to_s
@@ -0,0 +1,311 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Video < Domain
10
+ class V1 < Version
11
+ class RoomContext < InstanceContext
12
+ class ParticipantContext < InstanceContext
13
+ class SubscribedTrackList < ListResource
14
+ ##
15
+ # Initialize the SubscribedTrackList
16
+ # @param [Version] version Version that contains the resource
17
+ # @param [String] room_sid The room_sid
18
+ # @param [String] subscriber_sid The subscriber_sid
19
+ # @return [SubscribedTrackList] SubscribedTrackList
20
+ def initialize(version, room_sid: nil, subscriber_sid: nil)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {room_sid: room_sid, subscriber_sid: subscriber_sid}
25
+ @uri = "/Rooms/#{@solution[:room_sid]}/Participants/#{@solution[:subscriber_sid]}/SubscribedTracks"
26
+ end
27
+
28
+ ##
29
+ # Lists SubscribedTrackInstance 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 [Time] date_created_after The date_created_after
33
+ # @param [Time] date_created_before The date_created_before
34
+ # @param [String] track The track
35
+ # @param [String] publisher The publisher
36
+ # @param [subscribed_track.Kind] kind The kind
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(date_created_after: :unset, date_created_before: :unset, track: :unset, publisher: :unset, kind: :unset, limit: nil, page_size: nil)
45
+ self.stream(
46
+ date_created_after: date_created_after,
47
+ date_created_before: date_created_before,
48
+ track: track,
49
+ publisher: publisher,
50
+ kind: kind,
51
+ limit: limit,
52
+ page_size: page_size
53
+ ).entries
54
+ end
55
+
56
+ ##
57
+ # Streams SubscribedTrackInstance records from the API as an Enumerable.
58
+ # This operation lazily loads records as efficiently as possible until the limit
59
+ # is reached.
60
+ # @param [Time] date_created_after The date_created_after
61
+ # @param [Time] date_created_before The date_created_before
62
+ # @param [String] track The track
63
+ # @param [String] publisher The publisher
64
+ # @param [subscribed_track.Kind] kind The kind
65
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
66
+ # guarantees to never return more than limit. Default is no limit.
67
+ # @param [Integer] page_size Number of records to fetch per request, when
68
+ # not set will use the default value of 50 records. If no page_size is defined
69
+ # but a limit is defined, stream() will attempt to read the limit with the most
70
+ # efficient page size, i.e. min(limit, 1000)
71
+ # @return [Enumerable] Enumerable that will yield up to limit results
72
+ def stream(date_created_after: :unset, date_created_before: :unset, track: :unset, publisher: :unset, kind: :unset, limit: nil, page_size: nil)
73
+ limits = @version.read_limits(limit, page_size)
74
+
75
+ page = self.page(
76
+ date_created_after: date_created_after,
77
+ date_created_before: date_created_before,
78
+ track: track,
79
+ publisher: publisher,
80
+ kind: kind,
81
+ page_size: limits[:page_size],
82
+ )
83
+
84
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
85
+ end
86
+
87
+ ##
88
+ # When passed a block, yields SubscribedTrackInstance records from the API.
89
+ # This operation lazily loads records as efficiently as possible until the limit
90
+ # is reached.
91
+ def each
92
+ limits = @version.read_limits
93
+
94
+ page = self.page(page_size: limits[:page_size], )
95
+
96
+ @version.stream(page,
97
+ limit: limits[:limit],
98
+ page_limit: limits[:page_limit]).each {|x| yield x}
99
+ end
100
+
101
+ ##
102
+ # Retrieve a single page of SubscribedTrackInstance records from the API.
103
+ # Request is executed immediately.
104
+ # @param [Time] date_created_after The date_created_after
105
+ # @param [Time] date_created_before The date_created_before
106
+ # @param [String] track The track
107
+ # @param [String] publisher The publisher
108
+ # @param [subscribed_track.Kind] kind The kind
109
+ # @param [String] page_token PageToken provided by the API
110
+ # @param [Integer] page_number Page Number, this value is simply for client state
111
+ # @param [Integer] page_size Number of records to return, defaults to 50
112
+ # @return [Page] Page of SubscribedTrackInstance
113
+ def page(date_created_after: :unset, date_created_before: :unset, track: :unset, publisher: :unset, kind: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
114
+ params = Twilio::Values.of({
115
+ 'DateCreatedAfter' => Twilio.serialize_iso8601_datetime(date_created_after),
116
+ 'DateCreatedBefore' => Twilio.serialize_iso8601_datetime(date_created_before),
117
+ 'Track' => track,
118
+ 'Publisher' => publisher,
119
+ 'Kind' => kind,
120
+ 'PageToken' => page_token,
121
+ 'Page' => page_number,
122
+ 'PageSize' => page_size,
123
+ })
124
+ response = @version.page(
125
+ 'GET',
126
+ @uri,
127
+ params
128
+ )
129
+ SubscribedTrackPage.new(@version, response, @solution)
130
+ end
131
+
132
+ ##
133
+ # Retrieve a single page of SubscribedTrackInstance records from the API.
134
+ # Request is executed immediately.
135
+ # @param [String] target_url API-generated URL for the requested results page
136
+ # @return [Page] Page of SubscribedTrackInstance
137
+ def get_page(target_url)
138
+ response = @version.domain.request(
139
+ 'GET',
140
+ target_url
141
+ )
142
+ SubscribedTrackPage.new(@version, response, @solution)
143
+ end
144
+
145
+ ##
146
+ # Update the SubscribedTrackInstance
147
+ # @param [String] track The track
148
+ # @param [String] publisher The publisher
149
+ # @param [subscribed_track.Kind] kind The kind
150
+ # @param [subscribed_track.Status] status The status
151
+ # @return [SubscribedTrackInstance] Updated SubscribedTrackInstance
152
+ def update(track: :unset, publisher: :unset, kind: :unset, status: :unset)
153
+ data = Twilio::Values.of({
154
+ 'Track' => track,
155
+ 'Publisher' => publisher,
156
+ 'Kind' => kind,
157
+ 'Status' => status,
158
+ })
159
+
160
+ payload = @version.update(
161
+ 'POST',
162
+ @uri,
163
+ data: data,
164
+ )
165
+
166
+ SubscribedTrackInstance.new(
167
+ @version,
168
+ payload,
169
+ room_sid: @solution[:room_sid],
170
+ subscriber_sid: @solution[:subscriber_sid],
171
+ )
172
+ end
173
+
174
+ ##
175
+ # Provide a user friendly representation
176
+ def to_s
177
+ '#<Twilio.Video.V1.SubscribedTrackList>'
178
+ end
179
+ end
180
+
181
+ class SubscribedTrackPage < Page
182
+ ##
183
+ # Initialize the SubscribedTrackPage
184
+ # @param [Version] version Version that contains the resource
185
+ # @param [Response] response Response from the API
186
+ # @param [Hash] solution Path solution for the resource
187
+ # @return [SubscribedTrackPage] SubscribedTrackPage
188
+ def initialize(version, response, solution)
189
+ super(version, response)
190
+
191
+ # Path Solution
192
+ @solution = solution
193
+ end
194
+
195
+ ##
196
+ # Build an instance of SubscribedTrackInstance
197
+ # @param [Hash] payload Payload response from the API
198
+ # @return [SubscribedTrackInstance] SubscribedTrackInstance
199
+ def get_instance(payload)
200
+ SubscribedTrackInstance.new(
201
+ @version,
202
+ payload,
203
+ room_sid: @solution[:room_sid],
204
+ subscriber_sid: @solution[:subscriber_sid],
205
+ )
206
+ end
207
+
208
+ ##
209
+ # Provide a user friendly representation
210
+ def to_s
211
+ '<Twilio.Video.V1.SubscribedTrackPage>'
212
+ end
213
+ end
214
+
215
+ class SubscribedTrackInstance < InstanceResource
216
+ ##
217
+ # Initialize the SubscribedTrackInstance
218
+ # @param [Version] version Version that contains the resource
219
+ # @param [Hash] payload payload that contains response from Twilio
220
+ # @param [String] room_sid The room_sid
221
+ # @param [String] subscriber_sid The subscriber_sid
222
+ # @return [SubscribedTrackInstance] SubscribedTrackInstance
223
+ def initialize(version, payload, room_sid: nil, subscriber_sid: nil)
224
+ super(version)
225
+
226
+ # Marshaled Properties
227
+ @properties = {
228
+ 'sid' => payload['sid'],
229
+ 'room_sid' => payload['room_sid'],
230
+ 'name' => payload['name'],
231
+ 'publisher_sid' => payload['publisher_sid'],
232
+ 'subscriber_sid' => payload['subscriber_sid'],
233
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
234
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
235
+ 'enabled' => payload['enabled'],
236
+ 'kind' => payload['kind'],
237
+ }
238
+ end
239
+
240
+ ##
241
+ # @return [String] The sid
242
+ def sid
243
+ @properties['sid']
244
+ end
245
+
246
+ ##
247
+ # @return [String] The room_sid
248
+ def room_sid
249
+ @properties['room_sid']
250
+ end
251
+
252
+ ##
253
+ # @return [String] The name
254
+ def name
255
+ @properties['name']
256
+ end
257
+
258
+ ##
259
+ # @return [String] The publisher_sid
260
+ def publisher_sid
261
+ @properties['publisher_sid']
262
+ end
263
+
264
+ ##
265
+ # @return [String] The subscriber_sid
266
+ def subscriber_sid
267
+ @properties['subscriber_sid']
268
+ end
269
+
270
+ ##
271
+ # @return [Time] The date_created
272
+ def date_created
273
+ @properties['date_created']
274
+ end
275
+
276
+ ##
277
+ # @return [Time] The date_updated
278
+ def date_updated
279
+ @properties['date_updated']
280
+ end
281
+
282
+ ##
283
+ # @return [Boolean] The enabled
284
+ def enabled
285
+ @properties['enabled']
286
+ end
287
+
288
+ ##
289
+ # @return [subscribed_track.Kind] The kind
290
+ def kind
291
+ @properties['kind']
292
+ end
293
+
294
+ ##
295
+ # Provide a user friendly representation
296
+ def to_s
297
+ "<Twilio.Video.V1.SubscribedTrackInstance>"
298
+ end
299
+
300
+ ##
301
+ # Provide a detailed, user friendly representation
302
+ def inspect
303
+ "<Twilio.Video.V1.SubscribedTrackInstance>"
304
+ end
305
+ end
306
+ end
307
+ end
308
+ end
309
+ end
310
+ end
311
+ end
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '5.6.1'
2
+ VERSION = '5.6.2'
3
3
  end
@@ -140,32 +140,4 @@ describe 'Engagement' do
140
140
 
141
141
  expect(actual).to_not eq(nil)
142
142
  end
143
-
144
- it "can delete" do
145
- @holodeck.mock(Twilio::Response.new(500, ''))
146
-
147
- expect {
148
- @client.preview.studio.flows("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
149
- .engagements("FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
150
- }.to raise_exception(Twilio::REST::TwilioError)
151
-
152
- values = {}
153
- expect(
154
- @holodeck.has_request?(Holodeck::Request.new(
155
- method: 'delete',
156
- url: 'https://preview.twilio.com/Studio/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
157
- ))).to eq(true)
158
- end
159
-
160
- it "receives delete responses" do
161
- @holodeck.mock(Twilio::Response.new(
162
- 204,
163
- nil,
164
- ))
165
-
166
- actual = @client.preview.studio.flows("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
167
- .engagements("FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
168
-
169
- expect(actual).to eq(true)
170
- end
171
143
  end
@@ -0,0 +1,96 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ require 'spec_helper.rb'
8
+
9
+ describe 'Step' do
10
+ it "can read" do
11
+ @holodeck.mock(Twilio::Response.new(500, ''))
12
+
13
+ expect {
14
+ @client.studio.v1.flows("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
15
+ .engagements("FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
16
+ .steps.list()
17
+ }.to raise_exception(Twilio::REST::TwilioError)
18
+
19
+ values = {}
20
+ expect(
21
+ @holodeck.has_request?(Holodeck::Request.new(
22
+ method: 'get',
23
+ url: 'https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps',
24
+ ))).to eq(true)
25
+ end
26
+
27
+ it "receives read_empty responses" do
28
+ @holodeck.mock(Twilio::Response.new(
29
+ 200,
30
+ %q[
31
+ {
32
+ "meta": {
33
+ "previous_page_url": null,
34
+ "next_page_url": null,
35
+ "url": "https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps?PageSize=50&Page=0",
36
+ "page": 0,
37
+ "first_page_url": "https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps?PageSize=50&Page=0",
38
+ "page_size": 50,
39
+ "key": "steps"
40
+ },
41
+ "steps": []
42
+ }
43
+ ]
44
+ ))
45
+
46
+ actual = @client.studio.v1.flows("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
47
+ .engagements("FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
48
+ .steps.list()
49
+
50
+ expect(actual).to_not eq(nil)
51
+ end
52
+
53
+ it "can fetch" do
54
+ @holodeck.mock(Twilio::Response.new(500, ''))
55
+
56
+ expect {
57
+ @client.studio.v1.flows("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
58
+ .engagements("FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
59
+ .steps("FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
60
+ }.to raise_exception(Twilio::REST::TwilioError)
61
+
62
+ values = {}
63
+ expect(
64
+ @holodeck.has_request?(Holodeck::Request.new(
65
+ method: 'get',
66
+ url: 'https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps/FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
67
+ ))).to eq(true)
68
+ end
69
+
70
+ it "receives fetch responses" do
71
+ @holodeck.mock(Twilio::Response.new(
72
+ 200,
73
+ %q[
74
+ {
75
+ "sid": "FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
76
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
77
+ "flow_sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
78
+ "engagement_sid": "FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
79
+ "name": "incomingRequest",
80
+ "context": {},
81
+ "transitioned_from": "Trigger",
82
+ "transitioned_to": "Ended",
83
+ "date_created": "2017-11-06T12:00:00Z",
84
+ "date_updated": null,
85
+ "url": "https://studio.twilio.com/v1/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Engagements/FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Steps/FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
86
+ }
87
+ ]
88
+ ))
89
+
90
+ actual = @client.studio.v1.flows("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
91
+ .engagements("FNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
92
+ .steps("FTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
93
+
94
+ expect(actual).to_not eq(nil)
95
+ end
96
+ end