Skip to content

Commit 91540af

Browse files
committed
Reindent and update Twilio references in Ruby snippets (part 1)
- Reindent multiparameter method calls - Update reference to Twilio console in comments - Update comments pointing at helper library in Ruby snippets - Fix double indent on Ruby snippets - Add new line character to end of all Ruby files that didn't have it before appling ruby-beautify, as it has a bug affecting files with no new line character and it is a good practice anyway
1 parent adb14e8 commit 91540af

File tree

223 files changed

+339
-355
lines changed

Some content is hidden

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

223 files changed

+339
-355
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
require 'sinatra'
33

44
get '/token' do
5-
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6-
auth_token = 'your_auth_token'
7-
capability = Twilio::Util::Capability.new account_sid, auth_token
8-
# Create an application sid at
9-
# twilio.com/console/phone-numbers/dev-tools/twiml-apps and use it here
10-
capability.allow_client_outgoing "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
11-
capability.allow_client_incoming params['ClientName']
12-
token = capability.generate
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
capability = Twilio::Util::Capability.new account_sid, auth_token
8+
# Create an application SID at
9+
# twilio.com/console/phone-numbers/dev-tools/twiml-apps and use it here
10+
capability.allow_client_outgoing "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
11+
capability.allow_client_incoming params['ClientName']
12+
token = capability.generate
1313

14-
content_type 'application/jwt'
15-
token
14+
content_type 'application/jwt'
15+
token
1616
end
1717

18-
# TODO: post '/voice' do
18+
# TODO: post '/voice' do
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: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
require 'sinatra'
33

44
get '/token' do
5-
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6-
auth_token = 'your_auth_token'
7-
capability = Twilio::Util::Capability.new account_sid, auth_token
8-
capability.allow_client_incoming "jenny"
9-
token = capability.generate
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
capability = Twilio::Util::Capability.new account_sid, auth_token
8+
capability.allow_client_incoming "jenny"
9+
token = capability.generate
1010

11-
content_type 'application/jwt'
12-
token
11+
content_type 'application/jwt'
12+
token
1313
end
1414

15-
# TODO: post '/voice' do
15+
# TODO: post '/voice' do

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
require 'sinatra'
33

44
get '/token' do
5-
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6-
auth_token = 'your_auth_token'
7-
capability = Twilio::Util::Capability.new account_sid, auth_token
8-
# Create an application sid at
9-
# twilio.com/console/phone-numbers/dev-tools/twiml-apps and use it here
10-
capability.allow_client_outgoing "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
11-
token = capability.generate
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
capability = Twilio::Util::Capability.new account_sid, auth_token
8+
# Create an application sid at
9+
# twilio.com/console/phone-numbers/dev-tools/twiml-apps and use it here
10+
capability.allow_client_outgoing "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
11+
token = capability.generate
1212

13-
content_type 'application/jwt'
14-
token
13+
content_type 'application/jwt'
14+
token
1515
end
1616

17-
# TODO: post '/voice' do
17+
# TODO: post '/voice' do

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
require 'sinatra'
33

44
get '/token' do
5-
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6-
auth_token = 'your_auth_token'
7-
capability = Twilio::Util::Capability.new account_sid, auth_token
8-
# Create an application sid at
9-
# 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"
12-
token = capability.generate
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
capability = Twilio::Util::Capability.new account_sid, auth_token
8+
# Create an application sid at
9+
# 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"
12+
token = capability.generate
1313

14-
content_type 'application/jwt'
15-
token
14+
content_type 'application/jwt'
15+
token
1616
end
1717

18-
# TODO: post '/voice' do
18+
# TODO: post '/voice' do

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
twiml.text
2323
end
2424

25-
# TODO: get '/token' do
25+
# TODO: get '/token' do

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
twiml.text
1717
end
1818

19-
# TODO: get '/token' do
19+
# TODO: get '/token' do

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
twiml.text
1111
end
1212

13-
# TODO: get '/token' do
13+
# TODO: get '/token' do

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@
3737
r.redirect('/voice')
3838
end.text
3939
end
40-
end
40+
end

guides/voice/record-calls-guide/record-outgoing-call/example-1.4.x.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
@client = Twilio::REST::Client.new account_sid, auth_token
99

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

guides/voice/record-calls-guide/record-outgoing-call/example-1.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require 'rubygems' # This line not needed for ruby > 1.8
33
require 'twilio-ruby'
44

5-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
5+
# Get your Account SID and Auth Token from twilio.com/console
66
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
77
auth_token = 'your_auth_token'
88
@client = Twilio::REST::Client.new(account_sid, auth_token)

guides/voice/record-calls-guide/record-twiml/example.4.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
# End the call with <Hangup>
1515
r.Hangup
1616
end.text
17-
end
17+
end

guides/voice/record-calls-guide/record-twiml/example.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
# End the call with <Hangup>
1515
r.Hangup
1616
end.text
17-
end
17+
end

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
@@ -9,4 +9,4 @@
99
# Create the channel
1010
service = ip_messaging_client.services.get('SERVICE_SID')
1111
channel = service.channels.create()
12-
puts channel
12+
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
@@ -1,7 +1,7 @@
11
require 'http'
22
require 'twilio-ruby'
33

4-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
4+
# Get your Account SID and Auth Token from twilio.com/console
55
account_sid = 'ACCOUNT_SID'
66
auth_token = 'AUTH_TOKEN'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
service = ip_messaging_client.services.get('SERVICE_SID')
1111
channel = service.channels.create()
1212
response = channel.delete()
13-
puts response
13+
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
@@ -1,7 +1,7 @@
11
require 'http'
22
require 'twilio-ruby'
33

4-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
4+
# Get your Account SID and Auth Token from twilio.com/console
55
account_sid = 'ACCOUNT_SID'
66
auth_token = 'AUTH_TOKEN'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)

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
@@ -9,4 +9,4 @@
99
# List the channels
1010
service = ip_messaging_client.services.get('SERVICE_SID')
1111
channels = service.channels.list()
12-
puts channels
12+
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
@@ -1,7 +1,7 @@
11
require 'http'
22
require 'twilio-ruby'
33

4-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
4+
# Get your Account SID and Auth Token from twilio.com/console
55
account_sid = 'ACCOUNT_SID'
66
auth_token = 'AUTH_TOKEN'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
# Retrieve the channel
1010
service = ip_messaging_client.services.get('SERVICE_SID')
1111
channel = service.channels.get('CHANNEL_SID')
12-
puts channel
12+
puts channel

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'http'
22
require 'twilio-ruby'
33

4-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
4+
# Get your Account SID and Auth Token from twilio.com/console
55
account_sid = 'ACCOUNT_SID'
66
auth_token = 'AUTH_TOKEN'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'http'
22
require 'twilio-ruby'
33

4-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
4+
# Get your Account SID and Auth Token from twilio.com/console
55
account_sid = 'ACCOUNT_SID'
66
auth_token = 'AUTH_TOKEN'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)

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

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

99
# Create the credential
1010
credential = ip_messaging_client.credentials.create(type:'key')
11-
puts credentials
11+
puts credentials

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'http'
22
require 'twilio-ruby'
33

4-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
4+
# Get your Account SID and Auth Token from twilio.com/console
55
account_sid = 'ACCOUNT_SID'
66
auth_token = 'AUTH_TOKEN'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)

ip-messaging/rest/credentials/delete-credentials/delete-credentials.4.x.rb

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

99
# Delete the credential
1010
response = ip_messaging_client.credentials.delete()
11-
puts response
11+
puts response

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'http'
22
require 'twilio-ruby'
33

4-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
4+
# Get your Account SID and Auth Token from twilio.com/console
55
account_sid = 'ACCOUNT_SID'
66
auth_token = 'AUTH_TOKEN'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'http'
22
require 'twilio-ruby'
33

4-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
4+
# Get your Account SID and Auth Token from twilio.com/console
55
account_sid = 'ACCOUNT_SID'
66
auth_token = 'AUTH_TOKEN'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)

ip-messaging/rest/credentials/retrieve-credentials/retrieve-credential.4.x.rb

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

99
# Retrieve the credential
1010
credential = ip_messaging_client.credentials.get('CREDENTIAL_SID')
11-
puts credential
11+
puts credential

ip-messaging/rest/credentials/retrieve-credentials/retrieve-credential.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'http'
22
require 'twilio-ruby'
33

4-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
4+
# Get your Account SID and Auth Token from twilio.com/console
55
account_sid = 'ACCOUNT_SID'
66
auth_token = 'AUTH_TOKEN'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)

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

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

99
# Update the credential
1010
credential = ip_messaging_client.credentials.get('CREDENTIAL_SID')
11-
puts credential.update(sid:'NEW_SID')
11+
puts credential.update(sid:'NEW_SID')

ip-messaging/rest/credentials/update-credentials/update-credentials.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'http'
22
require 'twilio-ruby'
33

4-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
4+
# Get your Account SID and Auth Token from twilio.com/console
55
account_sid = 'ACCOUNT_SID'
66
auth_token = 'AUTH_TOKEN'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)

ip-messaging/rest/members/add-member/add-member.4.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
service = ip_messaging_client.services.get('SERVICE_SID')
1111
channel = service.channels.get('CHANNEL_SID')
1212
member = channel.members.create(Identity:'IDENTITY')
13-
puts member
13+
puts member

ip-messaging/rest/members/add-member/add-member.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'http'
22
require 'twilio-ruby'
33

4-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
4+
# Get your Account SID and Auth Token from twilio.com/console
55
account_sid = 'ACCOUNT_SID'
66
auth_token = 'AUTH_TOKEN'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
service = ip_messaging_client.services.get('SERVICE_SID')
1111
channel = service.channels.get('CHANNEL_SID')
1212
members = channel.members.list()
13-
puts members
13+
puts members

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'http'
22
require 'twilio-ruby'
33

4-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
4+
# Get your Account SID and Auth Token from twilio.com/console
55
account_sid = 'ACCOUNT_SID'
66
auth_token = 'AUTH_TOKEN'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)

ip-messaging/rest/members/remove-member/remove-member.5.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'http'
22
require 'twilio-ruby'
33

4-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
4+
# Get your Account SID and Auth Token from twilio.com/console
55
account_sid = 'ACCOUNT_SID'
66
auth_token = 'AUTH_TOKEN'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)

ip-messaging/rest/members/retrieve-member/retrieve-member.4.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
service = ip_messaging_client.services.get('SERVICE_SID')
1111
channel = service.channels.get('CHANNEL_SID')
1212
member = channel.members.get('MEMBER_SID')
13-
puts member
13+
puts member

ip-messaging/rest/messages/delete-messages/delete-messages.4.x.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
channel = service.channels.get('CHANNEL_SID')
1212
message = channel.messages.get('MESSAGE_SID')
1313
response = message.delete()
14-
puts response
14+
puts response

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'http'
22
require 'twilio-ruby'
33

4-
# Get your Account Sid and Auth Token from https://www.twilio.com/console
4+
# Get your Account SID and Auth Token from twilio.com/console
55
account_sid = 'ACCOUNT_SID'
66
auth_token = 'AUTH_TOKEN'
77
@client = Twilio::REST::Client.new(account_sid, auth_token)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
service = ip_messaging_client.services.get('SERVICE_SID')
1111
channel = service.channels.get('CHANNEL_SID')
1212
messages = channel.messages.list()
13-
puts messages
13+
puts messages

0 commit comments

Comments
 (0)