Skip to content

Commit afb70b9

Browse files
committed
Refactor 2nd round
1 parent 7a0109a commit afb70b9

File tree

267 files changed

+1232
-727
lines changed

Some content is hidden

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

267 files changed

+1232
-727
lines changed

add-ons/lookups/payfone-tcpa-compliance/payfone-tcpa-compliance.5.x.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
# Initialize Twilio Client
99
@client = Twilio::REST::Client.new(account_sid, auth_token)
1010

11+
key = 'payfone_tcpa_compliance.RightPartyContactedDate'
12+
1113
number = @client.lookups.v1
12-
.phone_numbers('+16502530000') \
14+
.phone_numbers('+16502530000')
1315
.fetch(add_ons: 'payfone_tcpa_compliance',
14-
add_ons_data: {
15-
'payfone_tcpa_compliance.RightPartyContactedDate' => '20160101'
16-
})
16+
add_ons_data: { key => '20160101' })
1717

1818
print(number.add_ons)
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
token = capability.generate expires = 600
1+
token = capability.generate expires: 600
2+
3+
puts token
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
token = capability.generate expires = 600
1+
token = capability.generate expires: 600
2+
3+
puts token

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
r.Dial callerId: '+15017250604' do |d|
88
# wrap the phone number or client name in the appropriate TwiML verb
99
# by checking if the number given has only digits and format symbols
10-
if params['To'] =~ /^[\d\+\-\(\) ]+$/
10+
if params['To'].match?(/^[\d\+\-\(\) ]+$/)
1111
d.Number params['To']
1212
else
1313
d.Client params['To']

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
r.Dial callerId: '+15017250604' do |d|
88
# wrap the phone number or client name in the appropriate TwiML verb
99
# by checking if the number given has only digits and format symbols
10-
if params['To'] =~ /^[\d\+\-\(\) ]+$/
10+
if params['To'].match?(/^[\d\+\-\(\) ]+$/)
1111
d.Number params['To']
1212
else
1313
d.Client params['To']

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77

88
uri = URI('https://fax.twilio.com/v1/Faxes')
99

10-
Net::HTTP.start(uri.host, uri.port,
11-
use_ssl: uri.scheme == 'https') do |http|
12-
10+
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
1311
request = Net::HTTP::Post.new uri.request_uri
1412
request.basic_auth account_sid, auth_token
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')
13+
to = 'sip:kate@example.com?hatchkey=4815162342;transport=TCP'
14+
media_url = 'https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf'
15+
request.body = URI.encode_www_form(to: to, from: 'Jack', media_url: media_url)
1816

1917
response = http.request request
2018

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
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
17-
d.Conference 'My conference', startConferenceOnEnter: true, endConferenceOnExit: true
17+
d.Conference('My conference',
18+
startConferenceOnEnter: true,
19+
endConferenceOnExit: true)
1820
else
1921
# Otherwise have the caller join as a regular participant
2022
d.Conference 'My conference', startConferenceOnEnter: false

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
# Initialize the client
44
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
55
auth_token = 'your_auth_token'
6-
ip_messaging_client = Twilio::REST::IpMessagingClient.new(account_sid, auth_token)
6+
ip_messaging_client = Twilio::REST::IpMessagingClient.new account_sid,
7+
auth_token
78

89
# Create the channel
9-
service = ip_messaging_client.services.get('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
10-
channel = service.channels.create
10+
channel = ip_messaging_client
11+
.services.get('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
12+
.channels.create
1113
puts channel

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
# initialize the client
44
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
55
auth_token = 'your_auth_token'
6-
ip_messaging_client = Twilio::REST::IpMessagingClient.new(account_sid, auth_token)
6+
ip_messaging_client = Twilio::REST::IpMessagingClient.new account_sid,
7+
auth_token
78

89
# Delete the channel
9-
service = ip_messaging_client.services.get('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
10-
channel = service.channels.create
11-
response = channel.delete
10+
response = ip_messaging_client
11+
.services.get('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
12+
.channels.create
13+
.delete
1214
puts response

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
# Initialize the client
44
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
55
auth_token = 'your_auth_token'
6-
ip_messaging_client = Twilio::REST::IpMessagingClient.new(account_sid, auth_token)
6+
ip_messaging_client = Twilio::REST::IpMessagingClient.new account_sid,
7+
auth_token
78

89
# List the channels
9-
service = ip_messaging_client.services.get('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
10-
channels = service.channels.list
10+
channels = ip_messaging_client
11+
.services.get('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
12+
.channels.list
1113
puts channels

0 commit comments

Comments
 (0)