Skip to content

Commit 7a0109a

Browse files
committed
Refactor 1st round
1 parent 66b5b0f commit 7a0109a

File tree

579 files changed

+1360
-1446
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

579 files changed

+1360
-1446
lines changed

client/capability-token-2way/capability-token.4.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
capability = Twilio::Util::Capability.new account_sid, auth_token
88
# Create an application SID at
99
# twilio.com/console/phone-numbers/dev-tools/twiml-apps and use it here
10-
capability.allow_client_outgoing "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
10+
capability.allow_client_outgoing 'APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
1111
capability.allow_client_incoming params['ClientName']
1212
token = capability.generate
1313

client/capability-token-2way/capability-token.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# Create an application sid at
1010
# twilio.com/console/phone-numbers/dev-tools/twiml-apps and use it here
11-
capability.allow_client_outgoing("APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
11+
capability.allow_client_outgoing('APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
1212
capability.allow_client_incoming(params['ClientName'])
1313
token = capability.generate
1414

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
token = capability.generate expires=600
1+
token = capability.generate expires = 600
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
token = capability.generate expires=600
1+
token = capability.generate expires = 600

client/capability-token-incoming/capability-token.4.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
66
auth_token = 'your_auth_token'
77
capability = Twilio::Util::Capability.new account_sid, auth_token
8-
capability.allow_client_incoming "jenny"
8+
capability.allow_client_incoming 'jenny'
99
token = capability.generate
1010

1111
content_type 'application/jwt'

client/capability-token-incoming/capability-token.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
auth_token = 'your_auth_token'
77
capability = Twilio::JWT::Capability.new(account_sid, auth_token)
88

9-
capability.allow_client_incoming("jenny")
9+
capability.allow_client_incoming('jenny')
1010
token = capability.generate
1111

1212
content_type 'application/jwt'

client/capability-token-outgoing/capability-token.4.x.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
66
auth_token = 'your_auth_token'
77
capability = Twilio::Util::Capability.new account_sid, auth_token
8-
# Create an application sid at
8+
# Create an application sid at
99
# twilio.com/console/phone-numbers/dev-tools/twiml-apps and use it here
10-
capability.allow_client_outgoing "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
10+
capability.allow_client_outgoing 'APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
1111
token = capability.generate
1212

1313
content_type 'application/jwt'

client/capability-token/capability-token.4.x.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
66
auth_token = 'your_auth_token'
77
capability = Twilio::Util::Capability.new account_sid, auth_token
8-
# Create an application sid at
8+
# Create an application sid at
99
# twilio.com/console/phone-numbers/dev-tools/twiml-apps and use it here
10-
capability.allow_client_outgoing "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
11-
capability.allow_client_incoming "jenny"
10+
capability.allow_client_outgoing 'APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
11+
capability.allow_client_incoming 'jenny'
1212
token = capability.generate
1313

1414
content_type 'application/jwt'

client/capability-token/capability-token.5.x.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
# Create an application sid at
1010
# twilio.com/console/phone-numbers/dev-tools/twiml-apps and use it here
11-
capability.allow_client_outgoing("APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
12-
capability.allow_client_incoming("jenny")
11+
capability.allow_client_outgoing('APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
12+
capability.allow_client_incoming('jenny')
1313
token = capability.generate
1414

1515
content_type 'application/jwt'

client/response-twiml-client/response-twiml-client.4.x.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
end
1515
end
1616
else
17-
r.Say "Thanks for calling!"
17+
r.Say 'Thanks for calling!'
1818
end
1919
end
20-
20+
2121
content_type 'text/xml'
2222
twiml.text
2323
end

client/response-twiml-client/response-twiml-client.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
end
1515
end
1616
else
17-
r.Say "Thanks for calling!"
17+
r.Say 'Thanks for calling!'
1818
end
1919
end
2020

client/response-twiml-dial/response-twiml-dial.4.x.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
d.Number params['To']
99
end
1010
else
11-
r.Say "Thanks for calling!"
11+
r.Say 'Thanks for calling!'
1212
end
1313
end
14-
14+
1515
content_type 'text/xml'
1616
twiml.text
1717
end

client/response-twiml-dial/response-twiml-dial.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
d.Number params['To']
99
end
1010
else
11-
r.Say "Thanks for calling!"
11+
r.Say 'Thanks for calling!'
1212
end
1313
end
1414

client/response-twiml/response-twiml.4.x.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
post '/voice' do
55
twiml = Twilio::TwiML::Response.new do |r|
6-
r.Say "Thanks for calling!"
6+
r.Say 'Thanks for calling!'
77
end
8-
8+
99
content_type 'text/xml'
1010
twiml.text
1111
end

client/response-twiml/response-twiml.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
post '/voice' do
55
twiml = Twilio::TwiML::Response.new do |r|
6-
r.Say "Thanks for calling!"
6+
r.Say 'Thanks for calling!'
77
end
88

99
content_type 'text/xml'

fax/basic-receive/basic-receive.4.x.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33

44
# Define a handler for when the fax is initially sent
55
post '/fax/sent' do
6-
# Let's manually build some TwiML. We can choose to receive the
7-
# fax with <Receive>, or reject with <Reject>.
8-
content_type 'text/xml'
6+
# Let's manually build some TwiML. We can choose to receive the
7+
# fax with <Receive>, or reject with <Reject>.
8+
content_type 'text/xml'
99

10-
<<-twiml
10+
<<-twiml
1111
<Response>
1212
<Receive action="/fax/received"/>
1313
</Response>'
1414
twiml
1515
end
1616

17-
1817
# Define a handler for when the fax is finished sending to us - if successful,
1918
# We will have a URL to the contents of the fax at this point
2019
post '/fax/received' do

fax/basic-send/basic-send.5.x.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88
uri = URI('https://fax.twilio.com/v1/Faxes')
99

1010
Net::HTTP.start(uri.host, uri.port,
11-
:use_ssl => uri.scheme == 'https') do |http|
11+
use_ssl: uri.scheme == 'https') do |http|
1212

1313
request = Net::HTTP::Post.new uri.request_uri
1414
request.basic_auth account_sid, auth_token
15-
request.body = URI.encode_www_form({
16-
:To => '+15558675309',
17-
:From => '+15017250604',
18-
:MediaUrl => 'https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf'
19-
})
15+
request.body = URI.encode_www_form(To: '+15558675309',
16+
From: '+15017250604',
17+
MediaUrl: 'https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf')
2018

2119
response = http.request request
2220

fax/instance-get-example/instance-get-example.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
uri = URI('https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
99

1010
Net::HTTP.start(uri.host, uri.port,
11-
:use_ssl => uri.scheme == 'https') do |http|
11+
use_ssl: uri.scheme == 'https') do |http|
1212

1313
request = Net::HTTP::Get.new uri.request_uri
1414
request.basic_auth account_sid, auth_token

fax/instance-post-example/instance-post-example.5.x.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88
uri = URI('https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
99

1010
Net::HTTP.start(uri.host, uri.port,
11-
:use_ssl => uri.scheme == 'https') do |http|
11+
use_ssl: uri.scheme == 'https') do |http|
1212

1313
request = Net::HTTP::Post.new uri.request_uri
1414
request.basic_auth account_sid, auth_token
15-
request.body = URI.encode_www_form({
16-
:Status => 'canceled'
17-
})
15+
request.body = URI.encode_www_form(Status: 'canceled')
1816

1917
response = http.request request
2018

fax/list-get-example/list-get-example.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
uri = URI('https://fax.twilio.com/v1/Faxes')
99

1010
Net::HTTP.start(uri.host, uri.port,
11-
:use_ssl => uri.scheme == 'https') do |http|
11+
use_ssl: uri.scheme == 'https') do |http|
1212

1313
request = Net::HTTP::Get.new uri.request_uri
1414
request.basic_auth account_sid, auth_token

fax/sip-send/example-1/example-1.5.x.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88
uri = URI('https://fax.twilio.com/v1/Faxes')
99

1010
Net::HTTP.start(uri.host, uri.port,
11-
:use_ssl => uri.scheme == 'https') do |http|
11+
use_ssl: uri.scheme == 'https') do |http|
1212

1313
request = Net::HTTP::Post.new uri.request_uri
1414
request.basic_auth account_sid, auth_token
15-
request.body = URI.encode_www_form({
16-
:To => 'sip:kate@example.com',
17-
:From => 'Jack',
18-
:MediaUrl => 'https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf'
19-
})
15+
request.body = URI.encode_www_form(To: 'sip:kate@example.com',
16+
From: 'Jack',
17+
MediaUrl: 'https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf')
2018

2119
response = http.request request
2220

fax/sip-send/example-2/example-2.5.x.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@
88
uri = URI('https://fax.twilio.com/v1/Faxes')
99

1010
Net::HTTP.start(uri.host, uri.port,
11-
:use_ssl => uri.scheme == 'https') do |http|
11+
use_ssl: uri.scheme == 'https') do |http|
1212

1313
request = Net::HTTP::Post.new uri.request_uri
1414
request.basic_auth account_sid, auth_token
15-
request.body = URI.encode_www_form({
16-
:To => 'sip:kate@example.com',
17-
:From => 'Jack',
18-
:MediaUrl => 'https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf',
19-
:SipAuthUsername => 'jack',
20-
:SipAuthPassword => 'secret'
21-
})
15+
request.body = URI.encode_www_form(To: 'sip:kate@example.com',
16+
From: 'Jack',
17+
MediaUrl: 'https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf',
18+
SipAuthUsername: 'jack',
19+
SipAuthPassword: 'secret')
2220

2321
response = http.request request
2422

fax/sip-send/example-3/example-3.5.x.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88
uri = URI('https://fax.twilio.com/v1/Faxes')
99

1010
Net::HTTP.start(uri.host, uri.port,
11-
:use_ssl => uri.scheme == 'https') do |http|
11+
use_ssl: uri.scheme == 'https') do |http|
1212

1313
request = Net::HTTP::Post.new uri.request_uri
1414
request.basic_auth account_sid, auth_token
15-
request.body = URI.encode_www_form({
16-
:To => 'sip:kate@example.com?hatchkey=4815162342;transport=TCP',
17-
:From => 'Jack',
18-
:MediaUrl => 'https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf'
19-
})
15+
request.body = URI.encode_www_form(To: 'sip:kate@example.com?hatchkey=4815162342;transport=TCP',
16+
From: 'Jack',
17+
MediaUrl: 'https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf')
2018

2119
response = http.request request
2220

guides/voice/conference-calls-guide/moderated-conference/moderated-conference.4.x.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
require 'twilio-ruby'
55

66
# Update with your own phone number in E.164 format
7-
MODERATOR = '+15558675309'
7+
MODERATOR = '+15558675309'.freeze
88

99
post '/voice' do
1010
# Start our TwiML response
1111
Twilio::TwiML::Response.new do |r|
1212
# Start with a <Dial> verb
1313
r.Dial do |d|
14-
if (params['From'] == MODERATOR)
14+
if params['From'] == MODERATOR
1515
# If the caller is our MODERATOR, then start the conference when they
1616
# join and end the conference when they leave
1717
d.Conference 'My conference', startConferenceOnEnter: true, endConferenceOnExit: true

guides/voice/gather-dtmf-tones-guide/gather-example-step-1/example.4.x.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,3 @@
3333
end.text
3434
end
3535
end
36-

guides/voice/gather-dtmf-tones-guide/gather-example-step-2/example.4.x.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,3 @@
3838
end.text
3939
end
4040
end
41-
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Get twilio-ruby from twilio.com/docs/ruby/install
2-
require 'rubygems' # This line not needed for ruby > 1.8
2+
require 'rubygems' # This line not needed for ruby > 1.8
33
require 'twilio-ruby'
44

55
# Get your Account Sid and Auth Token from twilio.com/user/account
66
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
77
auth_token = 'your_auth_token'
88
@client = Twilio::REST::Client.new account_sid, auth_token
99

10-
call = @client.account.calls.create(:url => "http://demo.twilio.com/docs/voice.xml",
11-
:to => "+14155551212",
12-
:from => "+15017250604",
13-
:record => true)
10+
call = @client.account.calls.create(url: 'http://demo.twilio.com/docs/voice.xml',
11+
to: '+14155551212',
12+
from: '+15017250604',
13+
record: true)
1414
puts call.to

ip-messaging/rest/channels/create-channels/create-channels.4.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77

88
# Create the channel
99
service = ip_messaging_client.services.get('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
10-
channel = service.channels.create()
10+
channel = service.channels.create
1111
puts channel

ip-messaging/rest/channels/create-channels/create-channels.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88

99
# Create the channel
1010
service = @client.chat.v2.services(service_sid)
11-
channel = service.channels.create(unique_name: "my-channel")
11+
channel = service.channels.create(unique_name: 'my-channel')
1212
puts "Channel #{channel.sid} (\"#{channel.unique_name}\") created!"
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
require 'twilio-ruby'
22

3-
#initialize the client
3+
# initialize the client
44
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
55
auth_token = 'your_auth_token'
66
ip_messaging_client = Twilio::REST::IpMessagingClient.new(account_sid, auth_token)
77

8-
#Delete the channel
8+
# Delete the channel
99
service = ip_messaging_client.services.get('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
10-
channel = service.channels.create()
11-
response = channel.delete()
10+
channel = service.channels.create
11+
response = channel.delete
1212
puts response

ip-messaging/rest/channels/delete-channels/delete-channels.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
service_sid = 'ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)
88

9-
# Delete a particular
9+
# Delete a particular
1010
channel_to_delete = 'CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
1111
service = @client.chat.v2.services(service_sid)
1212
response = service.channels(channel_to_delete).delete

ip-messaging/rest/channels/list-channels/list-channels.4.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77

88
# List the channels
99
service = ip_messaging_client.services.get('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
10-
channels = service.channels.list()
10+
channels = service.channels.list
1111
puts channels

ip-messaging/rest/channels/list-channels/list-channels.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
# List the channels
1010
service = @client.chat.v2.services(service_sid)
1111
channels = service.channels.each do |c|
12-
puts "#{c.sid} \"#{c.unique_name}\""
12+
puts "#{c.sid} \"#{c.unique_name}\""
1313
end

ip-messaging/rest/channels/update-channels/update-channels.4.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
# Update the channel
99
service = ip_messaging_client.services.get('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
10-
channel = service.channels.create()
10+
channel = service.channels.create
1111
channel_updated = channel.update(unique_name: 'NEW_SID')
1212
puts channel_updated

0 commit comments

Comments
 (0)