examples/examples.rb in twilio-ruby-5.0.0.rc26 vs examples/examples.rb in twilio-ruby-5.0.0
- old
+ new
@@ -29,11 +29,11 @@
puts call.sid
end
# get a particular call and list its recording urls
@client.calls('CAXXXXXXX').recordings.each do |r|
- puts r.wav
+ puts r.wav
end
# make a new outgoing call. returns a call object just like calls.get
@call = @client.calls.create(
from: '+14159341234',
@@ -77,23 +77,21 @@
# get a list of supported country codes
@client.available_phone_numbers.list
# print some available numbers
@client.available_phone_numbers('US').local.list.each do |num|
-
+ puts num
end
@numbers = @client.available_phone_numbers('US').local.list(area_code: '908')
@numbers.each { |num| puts num.phone_number }
# buy the first one
@client.incoming_phone_numbers.create(phone_number: @numbers[0].phone_number)
# update an existing phone number's voice url
-@client.incoming_phone_numbers('PNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx').update(
- voice_url: 'http://example.com/voice'
-)
+@client.incoming_phone_numbers('PNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx').update(voice_url: 'http://example.com/voice')
# decommission an existing phone number
numbers = @client.incoming_phone_numbers.list(friendly_name: 'A Fabulous Friendly Name')
number = numbers[0].sid
@client.incoming_phone_numbers(number).delete
@@ -108,12 +106,14 @@
@participants.each do |p|
puts p.sid
end
# update a conference participant
-@client.conferences('CFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
- .participants('CAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx').update(muted: 'true')
+@client
+ .conferences('CFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
+ .participants('CAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
+ .update(muted: 'true')
################ QUEUES ###################
# create a new queue
@queue = @client.queues.create(friendly_name: 'MyQueue', max_size: 50)
@@ -123,13 +123,15 @@
# get a particular queue and its members
@queue = @client.queues('QQxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx').fetch
@members = @queue.members
-#list members
+# list members
@members.list.each do |m|
puts m.wait_time
end
# dequeue a particular user and run twiml at a specific url
-@client.queues('QQxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
- .members('CAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx').update(url: 'http://myapp.com/deque', method: 'POST')
\ No newline at end of file
+@client
+ .queues('QQxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
+ .members('CAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
+ .update(url: 'http://myapp.com/deque', method: 'POST')