twilio-ruby 5.4.5 → 5.5.0

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.
@@ -273,17 +273,17 @@ module Twilio
273
273
 
274
274
  ##
275
275
  # Access the participants
276
- # @return [RoomParticipantList]
277
- # @return [RoomParticipantContext] if sid was passed.
276
+ # @return [ParticipantList]
277
+ # @return [ParticipantContext] if sid was passed.
278
278
  def participants(sid=:unset)
279
279
  raise ArgumentError, 'sid cannot be nil' if sid.nil?
280
280
 
281
281
  if sid != :unset
282
- return RoomParticipantContext.new(@version, @solution[:sid], sid)
282
+ return ParticipantContext.new(@version, @solution[:sid], sid)
283
283
  end
284
284
 
285
285
  unless @participants
286
- @participants = RoomParticipantList.new(@version, room_sid: @solution[:sid])
286
+ @participants = ParticipantList.new(@version, room_sid: @solution[:sid])
287
287
  end
288
288
 
289
289
  @participants
@@ -9,12 +9,12 @@ module Twilio
9
9
  class Video < Domain
10
10
  class V1 < Version
11
11
  class RoomContext < InstanceContext
12
- class RoomParticipantList < ListResource
12
+ class ParticipantList < ListResource
13
13
  ##
14
- # Initialize the RoomParticipantList
14
+ # Initialize the ParticipantList
15
15
  # @param [Version] version Version that contains the resource
16
16
  # @param [String] room_sid The room_sid
17
- # @return [RoomParticipantList] RoomParticipantList
17
+ # @return [ParticipantList] ParticipantList
18
18
  def initialize(version, room_sid: nil)
19
19
  super(version)
20
20
 
@@ -24,10 +24,10 @@ module Twilio
24
24
  end
25
25
 
26
26
  ##
27
- # Lists RoomParticipantInstance records from the API as a list.
27
+ # Lists ParticipantInstance records from the API as a list.
28
28
  # Unlike stream(), this operation is eager and will load `limit` records into
29
29
  # memory before returning.
30
- # @param [room_participant.Status] status The status
30
+ # @param [participant.Status] status The status
31
31
  # @param [String] identity The identity
32
32
  # @param [Time] date_created_after The date_created_after
33
33
  # @param [Time] date_created_before The date_created_before
@@ -50,10 +50,10 @@ module Twilio
50
50
  end
51
51
 
52
52
  ##
53
- # Streams RoomParticipantInstance records from the API as an Enumerable.
53
+ # Streams ParticipantInstance records from the API as an Enumerable.
54
54
  # This operation lazily loads records as efficiently as possible until the limit
55
55
  # is reached.
56
- # @param [room_participant.Status] status The status
56
+ # @param [participant.Status] status The status
57
57
  # @param [String] identity The identity
58
58
  # @param [Time] date_created_after The date_created_after
59
59
  # @param [Time] date_created_before The date_created_before
@@ -79,7 +79,7 @@ module Twilio
79
79
  end
80
80
 
81
81
  ##
82
- # When passed a block, yields RoomParticipantInstance records from the API.
82
+ # When passed a block, yields ParticipantInstance records from the API.
83
83
  # This operation lazily loads records as efficiently as possible until the limit
84
84
  # is reached.
85
85
  def each
@@ -93,16 +93,16 @@ module Twilio
93
93
  end
94
94
 
95
95
  ##
96
- # Retrieve a single page of RoomParticipantInstance records from the API.
96
+ # Retrieve a single page of ParticipantInstance records from the API.
97
97
  # Request is executed immediately.
98
- # @param [room_participant.Status] status The status
98
+ # @param [participant.Status] status The status
99
99
  # @param [String] identity The identity
100
100
  # @param [Time] date_created_after The date_created_after
101
101
  # @param [Time] date_created_before The date_created_before
102
102
  # @param [String] page_token PageToken provided by the API
103
103
  # @param [Integer] page_number Page Number, this value is simply for client state
104
104
  # @param [Integer] page_size Number of records to return, defaults to 50
105
- # @return [Page] Page of RoomParticipantInstance
105
+ # @return [Page] Page of ParticipantInstance
106
106
  def page(status: :unset, identity: :unset, date_created_after: :unset, date_created_before: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
107
107
  params = Twilio::Values.of({
108
108
  'Status' => status,
@@ -118,36 +118,36 @@ module Twilio
118
118
  @uri,
119
119
  params
120
120
  )
121
- RoomParticipantPage.new(@version, response, @solution)
121
+ ParticipantPage.new(@version, response, @solution)
122
122
  end
123
123
 
124
124
  ##
125
- # Retrieve a single page of RoomParticipantInstance records from the API.
125
+ # Retrieve a single page of ParticipantInstance records from the API.
126
126
  # Request is executed immediately.
127
127
  # @param [String] target_url API-generated URL for the requested results page
128
- # @return [Page] Page of RoomParticipantInstance
128
+ # @return [Page] Page of ParticipantInstance
129
129
  def get_page(target_url)
130
130
  response = @version.domain.request(
131
131
  'GET',
132
132
  target_url
133
133
  )
134
- RoomParticipantPage.new(@version, response, @solution)
134
+ ParticipantPage.new(@version, response, @solution)
135
135
  end
136
136
 
137
137
  ##
138
138
  # Provide a user friendly representation
139
139
  def to_s
140
- '#<Twilio.Video.V1.RoomParticipantList>'
140
+ '#<Twilio.Video.V1.ParticipantList>'
141
141
  end
142
142
  end
143
143
 
144
- class RoomParticipantPage < Page
144
+ class ParticipantPage < Page
145
145
  ##
146
- # Initialize the RoomParticipantPage
146
+ # Initialize the ParticipantPage
147
147
  # @param [Version] version Version that contains the resource
148
148
  # @param [Response] response Response from the API
149
149
  # @param [Hash] solution Path solution for the resource
150
- # @return [RoomParticipantPage] RoomParticipantPage
150
+ # @return [ParticipantPage] ParticipantPage
151
151
  def initialize(version, response, solution)
152
152
  super(version, response)
153
153
 
@@ -156,27 +156,27 @@ module Twilio
156
156
  end
157
157
 
158
158
  ##
159
- # Build an instance of RoomParticipantInstance
159
+ # Build an instance of ParticipantInstance
160
160
  # @param [Hash] payload Payload response from the API
161
- # @return [RoomParticipantInstance] RoomParticipantInstance
161
+ # @return [ParticipantInstance] ParticipantInstance
162
162
  def get_instance(payload)
163
- RoomParticipantInstance.new(@version, payload, room_sid: @solution[:room_sid])
163
+ ParticipantInstance.new(@version, payload, room_sid: @solution[:room_sid])
164
164
  end
165
165
 
166
166
  ##
167
167
  # Provide a user friendly representation
168
168
  def to_s
169
- '<Twilio.Video.V1.RoomParticipantPage>'
169
+ '<Twilio.Video.V1.ParticipantPage>'
170
170
  end
171
171
  end
172
172
 
173
- class RoomParticipantContext < InstanceContext
173
+ class ParticipantContext < InstanceContext
174
174
  ##
175
- # Initialize the RoomParticipantContext
175
+ # Initialize the ParticipantContext
176
176
  # @param [Version] version Version that contains the resource
177
177
  # @param [String] room_sid The room_sid
178
178
  # @param [String] sid The sid
179
- # @return [RoomParticipantContext] RoomParticipantContext
179
+ # @return [ParticipantContext] ParticipantContext
180
180
  def initialize(version, room_sid, sid)
181
181
  super(version)
182
182
 
@@ -189,8 +189,8 @@ module Twilio
189
189
  end
190
190
 
191
191
  ##
192
- # Fetch a RoomParticipantInstance
193
- # @return [RoomParticipantInstance] Fetched RoomParticipantInstance
192
+ # Fetch a ParticipantInstance
193
+ # @return [ParticipantInstance] Fetched ParticipantInstance
194
194
  def fetch
195
195
  params = Twilio::Values.of({})
196
196
 
@@ -200,13 +200,13 @@ module Twilio
200
200
  params,
201
201
  )
202
202
 
203
- RoomParticipantInstance.new(@version, payload, room_sid: @solution[:room_sid], sid: @solution[:sid])
203
+ ParticipantInstance.new(@version, payload, room_sid: @solution[:room_sid], sid: @solution[:sid])
204
204
  end
205
205
 
206
206
  ##
207
- # Update the RoomParticipantInstance
208
- # @param [room_participant.Status] status The status
209
- # @return [RoomParticipantInstance] Updated RoomParticipantInstance
207
+ # Update the ParticipantInstance
208
+ # @param [participant.Status] status The status
209
+ # @return [ParticipantInstance] Updated ParticipantInstance
210
210
  def update(status: :unset)
211
211
  data = Twilio::Values.of({'Status' => status})
212
212
 
@@ -216,7 +216,7 @@ module Twilio
216
216
  data: data,
217
217
  )
218
218
 
219
- RoomParticipantInstance.new(@version, payload, room_sid: @solution[:room_sid], sid: @solution[:sid])
219
+ ParticipantInstance.new(@version, payload, room_sid: @solution[:room_sid], sid: @solution[:sid])
220
220
  end
221
221
 
222
222
  ##
@@ -245,18 +245,18 @@ module Twilio
245
245
  # Provide a user friendly representation
246
246
  def to_s
247
247
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
248
- "#<Twilio.Video.V1.RoomParticipantContext #{context}>"
248
+ "#<Twilio.Video.V1.ParticipantContext #{context}>"
249
249
  end
250
250
  end
251
251
 
252
- class RoomParticipantInstance < InstanceResource
252
+ class ParticipantInstance < InstanceResource
253
253
  ##
254
- # Initialize the RoomParticipantInstance
254
+ # Initialize the ParticipantInstance
255
255
  # @param [Version] version Version that contains the resource
256
256
  # @param [Hash] payload payload that contains response from Twilio
257
257
  # @param [String] room_sid The room_sid
258
258
  # @param [String] sid The sid
259
- # @return [RoomParticipantInstance] RoomParticipantInstance
259
+ # @return [ParticipantInstance] ParticipantInstance
260
260
  def initialize(version, payload, room_sid: nil, sid: nil)
261
261
  super(version)
262
262
 
@@ -284,10 +284,10 @@ module Twilio
284
284
  ##
285
285
  # Generate an instance context for the instance, the context is capable of
286
286
  # performing various actions. All instance actions are proxied to the context
287
- # @return [RoomParticipantContext] RoomParticipantContext for this RoomParticipantInstance
287
+ # @return [ParticipantContext] ParticipantContext for this ParticipantInstance
288
288
  def context
289
289
  unless @instance_context
290
- @instance_context = RoomParticipantContext.new(@version, @params['room_sid'], @params['sid'])
290
+ @instance_context = ParticipantContext.new(@version, @params['room_sid'], @params['sid'])
291
291
  end
292
292
  @instance_context
293
293
  end
@@ -311,7 +311,7 @@ module Twilio
311
311
  end
312
312
 
313
313
  ##
314
- # @return [room_participant.Status] The status
314
+ # @return [participant.Status] The status
315
315
  def status
316
316
  @properties['status']
317
317
  end
@@ -365,16 +365,16 @@ module Twilio
365
365
  end
366
366
 
367
367
  ##
368
- # Fetch a RoomParticipantInstance
369
- # @return [RoomParticipantInstance] Fetched RoomParticipantInstance
368
+ # Fetch a ParticipantInstance
369
+ # @return [ParticipantInstance] Fetched ParticipantInstance
370
370
  def fetch
371
371
  context.fetch
372
372
  end
373
373
 
374
374
  ##
375
- # Update the RoomParticipantInstance
376
- # @param [room_participant.Status] status The status
377
- # @return [RoomParticipantInstance] Updated RoomParticipantInstance
375
+ # Update the ParticipantInstance
376
+ # @param [participant.Status] status The status
377
+ # @return [ParticipantInstance] Updated ParticipantInstance
378
378
  def update(status: :unset)
379
379
  context.update(status: status)
380
380
  end
@@ -390,14 +390,14 @@ module Twilio
390
390
  # Provide a user friendly representation
391
391
  def to_s
392
392
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
393
- "<Twilio.Video.V1.RoomParticipantInstance #{values}>"
393
+ "<Twilio.Video.V1.ParticipantInstance #{values}>"
394
394
  end
395
395
 
396
396
  ##
397
397
  # Provide a detailed, user friendly representation
398
398
  def inspect
399
399
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
400
- "<Twilio.Video.V1.RoomParticipantInstance #{values}>"
400
+ "<Twilio.Video.V1.ParticipantInstance #{values}>"
401
401
  end
402
402
  end
403
403
  end
@@ -9,7 +9,7 @@ module Twilio
9
9
  class Video < Domain
10
10
  class V1 < Version
11
11
  class RoomContext < InstanceContext
12
- class RoomParticipantContext < InstanceContext
12
+ class ParticipantContext < InstanceContext
13
13
  class PublishedTrackList < ListResource
14
14
  ##
15
15
  # Initialize the PublishedTrackList
@@ -1,4 +1,4 @@
1
- require 'libxml'
1
+ require 'nokogiri'
2
2
 
3
3
  ##
4
4
  # This code was generated by
@@ -11,11 +11,10 @@ module Twilio
11
11
  class TwiMLError < StandardError; end
12
12
 
13
13
  class TwiML
14
- attr_accessor :name, :indent
14
+ attr_accessor :name
15
15
 
16
- def initialize(indent: false, **keyword_args)
16
+ def initialize(**keyword_args)
17
17
  @name = self.class.name.split('::').last
18
- @indent = indent
19
18
  @value = nil
20
19
  @verbs = []
21
20
  @attrs = {}
@@ -35,17 +34,18 @@ module Twilio
35
34
  end
36
35
 
37
36
  def to_s(xml_declaration = true)
38
- xml = self.xml.to_s(indent: indent)
39
-
37
+ opts = { encoding: 'UTF-8', indent: 0 }
38
+ document = Nokogiri::XML::Document.new
39
+ xml = self.xml(document).to_xml(opts).gsub(/\n/, '')
40
40
  return ('<?xml version="1.0" encoding="UTF-8"?>' + xml) if xml_declaration
41
41
  xml
42
42
  end
43
43
 
44
- def xml
44
+ def xml(document)
45
45
  # create XML element
46
46
  value = (@value.is_a?(String) or @value == nil) ? @value : JSON.generate(@value)
47
- elem = LibXML::XML::Node.new(@name, value)
48
-
47
+ elem = Nokogiri::XML::Node.new(@name, document)
48
+ elem.content = value
49
49
  # set element attributes
50
50
  keys = @attrs.keys.sort
51
51
  keys.each do |key|
@@ -56,7 +56,7 @@ module Twilio
56
56
  end
57
57
 
58
58
  @verbs.each do |verb|
59
- elem << verb.xml
59
+ elem << verb.xml(document)
60
60
  end
61
61
 
62
62
  elem
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '5.4.5'
2
+ VERSION = '5.5.0'
3
3
  end
@@ -31,6 +31,7 @@ describe 'Document' do
31
31
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
32
32
  "created_by": "created_by",
33
33
  "data": {},
34
+ "date_expires": "2015-07-30T21:00:00Z",
34
35
  "date_created": "2015-07-30T20:00:00Z",
35
36
  "date_updated": "2015-07-30T20:00:00Z",
36
37
  "revision": "revision",
@@ -103,6 +104,7 @@ describe 'Document' do
103
104
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
104
105
  "created_by": "created_by",
105
106
  "data": {},
107
+ "date_expires": "2015-07-30T21:00:00Z",
106
108
  "date_created": "2015-07-30T20:00:00Z",
107
109
  "date_updated": "2015-07-30T20:00:00Z",
108
110
  "revision": "revision",
@@ -174,6 +176,7 @@ describe 'Document' do
174
176
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
175
177
  "created_by": "created_by",
176
178
  "data": {},
179
+ "date_expires": "2015-07-30T21:00:00Z",
177
180
  "date_created": "2015-07-30T20:00:00Z",
178
181
  "date_updated": "2015-07-30T20:00:00Z",
179
182
  "revision": "revision",
@@ -210,15 +213,14 @@ describe 'Document' do
210
213
 
211
214
  expect {
212
215
  @client.sync.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
213
- .documents("ETaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update(data: "{}")
216
+ .documents("ETaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
214
217
  }.to raise_exception(Twilio::REST::TwilioError)
215
218
 
216
- values = {'Data' => Twilio.serialize_object("{}")}
219
+ values = {}
217
220
  expect(
218
221
  @holodeck.has_request?(Holodeck::Request.new(
219
222
  method: 'post',
220
223
  url: 'https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Documents/ETaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
221
- data: values,
222
224
  ))).to eq(true)
223
225
  end
224
226
 
@@ -230,6 +232,7 @@ describe 'Document' do
230
232
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
231
233
  "created_by": "created_by",
232
234
  "data": {},
235
+ "date_expires": "2015-07-30T21:00:00Z",
233
236
  "date_created": "2015-07-30T20:00:00Z",
234
237
  "date_updated": "2015-07-30T20:00:00Z",
235
238
  "revision": "revision",
@@ -245,7 +248,7 @@ describe 'Document' do
245
248
  ))
246
249
 
247
250
  actual = @client.sync.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
248
- .documents("ETaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update(data: "{}")
251
+ .documents("ETaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
249
252
 
250
253
  expect(actual).to_not eq(nil)
251
254
  end
@@ -32,6 +32,7 @@ describe 'SyncListItem' do
32
32
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
33
33
  "created_by": "created_by",
34
34
  "data": {},
35
+ "date_expires": "2015-07-30T21:00:00Z",
35
36
  "date_created": "2015-07-30T20:00:00Z",
36
37
  "date_updated": "2015-07-30T20:00:00Z",
37
38
  "index": 100,
@@ -106,6 +107,7 @@ describe 'SyncListItem' do
106
107
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
107
108
  "created_by": "created_by",
108
109
  "data": {},
110
+ "date_expires": "2015-07-30T21:00:00Z",
109
111
  "date_created": "2015-07-30T20:00:00Z",
110
112
  "date_updated": "2015-07-30T20:00:00Z",
111
113
  "index": 100,
@@ -177,6 +179,7 @@ describe 'SyncListItem' do
177
179
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
178
180
  "created_by": "created_by",
179
181
  "data": {},
182
+ "date_expires": "2015-07-30T21:00:00Z",
180
183
  "date_created": "2015-07-30T20:00:00Z",
181
184
  "date_updated": "2015-07-30T20:00:00Z",
182
185
  "index": 100,
@@ -212,15 +215,14 @@ describe 'SyncListItem' do
212
215
  expect {
213
216
  @client.sync.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
214
217
  .sync_lists("ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
215
- .sync_list_items(1).update(data: "{}")
218
+ .sync_list_items(1).update()
216
219
  }.to raise_exception(Twilio::REST::TwilioError)
217
220
 
218
- values = {'Data' => Twilio.serialize_object("{}")}
221
+ values = {}
219
222
  expect(
220
223
  @holodeck.has_request?(Holodeck::Request.new(
221
224
  method: 'post',
222
225
  url: 'https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/1',
223
- data: values,
224
226
  ))).to eq(true)
225
227
  end
226
228
 
@@ -232,6 +234,7 @@ describe 'SyncListItem' do
232
234
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
233
235
  "created_by": "created_by",
234
236
  "data": {},
237
+ "date_expires": "2015-07-30T21:00:00Z",
235
238
  "date_created": "2015-07-30T20:00:00Z",
236
239
  "date_updated": "2015-07-30T20:00:00Z",
237
240
  "index": 100,
@@ -245,7 +248,7 @@ describe 'SyncListItem' do
245
248
 
246
249
  actual = @client.sync.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
247
250
  .sync_lists("ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
248
- .sync_list_items(1).update(data: "{}")
251
+ .sync_list_items(1).update()
249
252
 
250
253
  expect(actual).to_not eq(nil)
251
254
  end