Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.

Change travis CI to GH actions #946

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dfc4e09
Change travis CI to GH actions
fefi95 Oct 22, 2021
8f2dd4e
Fix sync-example.7.x syntax error
alexisbcc Dec 8, 2021
5928ddb
Add missing eof
alexisbcc Dec 8, 2021
4854f55
Fix example-1.7.x syntax error
alexisbcc Dec 8, 2021
dfb95d8
Fix multiple styling issues for python snippets
alexisbcc Dec 8, 2021
94f63f5
Fix print string style
alexisbcc Dec 8, 2021
f36761e
Fix python tests runner
alexisbcc Dec 10, 2021
4931fc5
Revert "Fix python tests runner"
alexisbcc Dec 10, 2021
2666b1d
Fix node linting issues
alexisbcc Dec 8, 2021
e341904
Fix several ruby styling issues
alexisbcc Dec 9, 2021
0c5b2d0
Fix several ruby styling issues
alexisbcc Dec 9, 2021
c433953
Fix several ruby styling issues
alexisbcc Dec 9, 2021
36abf88
Fix several ruby styling issues
alexisbcc Dec 9, 2021
6bdef25
Fix several ruby styling issues
alexisbcc Dec 9, 2021
bd80d1d
Restore missing python tests runner methods
alexisbcc Dec 13, 2021
18bf21b
Change GH actions rule to run for all PR's against any branch
alexisbcc Dec 13, 2021
c6cefe1
Fix dict update and line break
alexisbcc Dec 13, 2021
523e169
Change download file example code
alexisbcc Dec 13, 2021
0bef4fe
Remove snippet execution temporary to make the CI pass
alexisbcc Dec 14, 2021
4ed1f78
Remove rubocop method length verification
alexisbcc Jan 5, 2022
44496e0
Merge pull request #956 from TwilioDevEd/fix-node-snippets
jefflinwood Jan 6, 2022
5250407
Merge pull request #957 from TwilioDevEd/fix-ruby-snippets
jefflinwood Jan 6, 2022
2c997b4
Merge pull request #955 from TwilioDevEd/fix-python-snippets
jefflinwood Jan 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix several ruby styling issues
  • Loading branch information
alexisbcc committed Dec 10, 2021
commit e3419041ad55f3219c10c13ed2c84b32be8d0532
6 changes: 3 additions & 3 deletions api-auth/api-auth.5.x.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require 'twilio-ruby'

# To set up environmental variables, see http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID'] # Your Account SID from www.twilio.com/console
api_key = ENV['TWILIO_API_KEY'] # You can generate this from www.twilio.com/console/runtime/api-keys/create
api_secret = ENV['TWILIO_API_KEY_SECRET'] # You can generate this from www.twilio.com/console/runtime/api-keys/create
account_sid = ENV['TWILIO_ACCOUNT_SID'] # Your Account SID from www.twilio.com/console
api_key = ENV['TWILIO_API_KEY'] # You can generate this from www.twilio.com/console/runtime/api-keys/create
api_secret = ENV['TWILIO_API_KEY_SECRET'] # You can generate this from www.twilio.com/console/runtime/api-keys/create

# DANGER! This is insecure. See http://twil.io/secure
@client = Twilio::REST::Client.new api_key, api_secret, account_sid
Expand Down
2 changes: 1 addition & 1 deletion client/capability-token-2way/capability-token.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'sinatra'

get '/token' do
# To set up environmental variables, see http://twil.io/secure
# To set up environmental variables, see http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
capability = Twilio::JWT::ClientCapability.new(account_sid, auth_token)
Expand Down
2 changes: 1 addition & 1 deletion client/capability-token-incoming/capability-token.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'sinatra'

get '/token' do
# To set up environmental variables, see http://twil.io/secure
# To set up environmental variables, see http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
capability = Twilio::JWT::ClientCapability.new(account_sid, auth_token)
Expand Down
2 changes: 1 addition & 1 deletion client/capability-token-outgoing/capability-token.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'sinatra'

get '/token' do
# To set up environmental variables, see http://twil.io/secure
# To set up environmental variables, see http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
capability = Twilio::JWT::ClientCapability.new(account_sid, auth_token)
Expand Down
2 changes: 1 addition & 1 deletion client/capability-token/capability-token.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'sinatra'

get '/token' do
# To set up environmental variables, see http://twil.io/secure
# To set up environmental variables, see http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
capability = Twilio::JWT::ClientCapability.new(account_sid, auth_token)
Expand Down
2 changes: 1 addition & 1 deletion client/response-twiml-client/response-twiml-client.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
r.Dial callerId: '+15017122661' do |d|
# wrap the phone number or client name in the appropriate TwiML verb
# by checking if the number given has only digits and format symbols
if params['To'].match?(/^[\d\+\-\(\) ]+$/)
if params['To'].match?(/^[\d+\-() ]+$/)
d.Number params['To']
else
d.Client params['To']
Expand Down
1 change: 0 additions & 1 deletion fax/basic-send/basic-send.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

Net::HTTP.start(uri.host, uri.port,
use_ssl: uri.scheme == 'https') do |http|

request = Net::HTTP::Post.new uri.request_uri
request.basic_auth account_sid, auth_token
request.body = URI.encode_www_form(To: '+15558675310',
Expand Down
1 change: 0 additions & 1 deletion fax/instance-get-example/instance-get-example.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

Net::HTTP.start(uri.host, uri.port,
use_ssl: uri.scheme == 'https') do |http|

request = Net::HTTP::Get.new uri.request_uri
request.basic_auth(account_sid, auth_token)

Expand Down
1 change: 0 additions & 1 deletion fax/instance-post-example/instance-post-example.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

Net::HTTP.start(uri.host, uri.port,
use_ssl: uri.scheme == 'https') do |http|

request = Net::HTTP::Post.new uri.request_uri
request.basic_auth(account_sid, auth_token)
request.body = URI.encode_www_form(Status: 'canceled')
Expand Down
1 change: 0 additions & 1 deletion fax/list-get-example/list-get-example.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

Net::HTTP.start(uri.host, uri.port,
use_ssl: uri.scheme == 'https') do |http|

request = Net::HTTP::Get.new uri.request_uri
request.basic_auth(account_sid, auth_token)

Expand Down
1 change: 0 additions & 1 deletion fax/sip-send/example-1/example-1.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

Net::HTTP.start(uri.host, uri.port,
use_ssl: uri.scheme == 'https') do |http|

request = Net::HTTP::Post.new uri.request_uri
request.basic_auth(account_sid, auth_token)
request.body = URI.encode_www_form(To: 'sip:kate@example.com',
Expand Down
1 change: 0 additions & 1 deletion fax/sip-send/example-2/example-2.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

Net::HTTP.start(uri.host, uri.port,
use_ssl: uri.scheme == 'https') do |http|

request = Net::HTTP::Post.new uri.request_uri
request.basic_auth(account_sid, auth_token)
request.body = URI.encode_www_form(To: 'sip:kate@example.com',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

payload_url = add_ons['results']['ibm_watson_speechtotext']['payload'][0]['url']

# To set up environmental variables, see http://twil.io/secure
# To set up environmental variables, see http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
resp = HTTParty.get(
Expand Down
2 changes: 1 addition & 1 deletion ip-messaging/rest/roles/update-role/update-role.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
# Update a role
role = service.roles('RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch
new_permissions = role.permissions | ['sendMediaMessage']
role = role.update(permission: new_permissions)
role.update(permission: new_permissions)
puts "Role #{role.sid} now has permissions #{role.permissions.join(', ')}"
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

# Create an Access Token for Chat usage
token = Twilio::Util::AccessToken.new(
# To set up environmental variables, see http://twil.io/secure
# To set up environmental variables, see http://twil.io/secure
ENV['TWILIO_ACCOUNT_SID'],
ENV['TWILIO_API_KEY'],
ENV['TWILIO_API_SECRET'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

puts number.carrier['type']
puts number.carrier['name']
rescue Twilio::REST::RestError => err
if err.status_code === 404
rescue Twilio::REST::RestError => e
if e.status_code === 404
puts 'No carrier information'
else
puts err.message
puts e.message
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

service = client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')

service = service.update(
service.update(
friendly_name: 'Another Awesome Service',
facebook_messenger_page_id: 'your_page_id',
messaging_service_sid: 'your_twilio_messaging_service_sid'
Expand Down
2 changes: 1 addition & 1 deletion notifications/rest/users/create-user/create-user.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
.users.create(
identity: 'User0001',
segment: ['premium', 'fitness-lifestyle']
segment: %w[premium fitness-lifestyle]
)

puts user.sid
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# Build task actions that say something and listens for a repsonse.
hello_world_task_actions = {
"actions" => [
'actions' => [
{ "say": "Hi there, I'm your virtual assistant! How can I help you?" },
{ "listen": true }
]
Expand All @@ -19,11 +19,11 @@
# Create the hello_world task
# Replace 'UAXXX...' with your Assistant's unique SID https://www.twilio.com/console/autopilot/list
task = @client.autopilot.assistants('UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
.tasks
.create(
unique_name: "hello-world",
actions: hello_world_task_actions
)
.tasks
.create(
unique_name: 'hello-world',
actions: hello_world_task_actions
)

puts "Hello-world task has been created!"
puts 'Hello-world task has been created!'
puts task.sid
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@

# Build task actions that say something and listens for a repsonse.
phrases = [
"hello",
"hi",
"Hello",
"Hi there"
'hello',
'hi',
'Hello',
'Hi there'
]

# Create the hello_world task
# Replace 'UAXXX...' with your Assistant's unique SID https://www.twilio.com/console/autopilot/list
phrases.each do |phrase|
sample = @client.autopilot.assistants('UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
.tasks("hello-world")
.samples
.create(
language: "en-us",
tagged_text: phrase
)
.tasks('hello-world')
.samples
.create(
language: 'en-us',
tagged_text: phrase
)

puts sample.sid
end
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@
@client = Twilio::REST::Client.new(account_sid, auth_token)

phrases = [
"Tell me a joke",
"Tell me a joke",
"Id like to hear a joke",
"Do you know any good jokes?",
"Joke",
"Tell joke",
"Tell me something funny",
"Make me laugh",
"I want to hear a joke",
"Can I hear a joke?",
"I like jokes",
"Id like to hear a punny joke"
'Tell me a joke',
'Tell me a joke',
'Id like to hear a joke',
'Do you know any good jokes?',
'Joke',
'Tell joke',
'Tell me something funny',
'Make me laugh',
'I want to hear a joke',
'Can I hear a joke?',
'I like jokes',
'Id like to hear a punny joke'
]

# Replace 'UAXXX...' with your Assistant's unique SID https://www.twilio.com/console/autopilot/list
phrases.each do |phrase|
sample = @client.autopilot.assistants('UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
.tasks("tell-a-joke")
.samples
.create(
language: "en-us",
tagged_text: phrase
)
.tasks('tell-a-joke')
.samples
.create(
language: 'en-us',
tagged_text: phrase
)

puts sample.sid
end
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

# Provide actions for the new task
joke_actions = {
"actions" => [
{ "say": "I was going to look for my missing watch, but I could never find the time." },
'actions' => [
{ "say": 'I was going to look for my missing watch, but I could never find the time.' },
]
}

# Create a new task named 'tell_a_joke'
# Replace 'UAXXX...' with your Assistant's unique SID https://www.twilio.com/console/autopilot/list
task = @client.autopilot.assistants('UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
.tasks
.create(
unique_name: "tell-a-joke",
actions: joke_actions
)
.tasks
.create(
unique_name: 'tell-a-joke',
actions: joke_actions
)

puts "Tell-a-joke task has been created!"
puts 'Tell-a-joke task has been created!'
puts task.sid
6 changes: 3 additions & 3 deletions quickstart/ruby/autopilot/query-task/query_task.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

# Replace 'UAXXX...' with your Assistant's unique SID https://www.twilio.com/console/autopilot/list
query = @client.preview.understand
.assistants('UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
.queries
.create(language: 'en-US', query: 'Tell me a joke')
.assistants('UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
.queries
.create(language: 'en-US', query: 'Tell me a joke')

puts query.results['task']
6 changes: 3 additions & 3 deletions quickstart/ruby/sms/example-1/send_notifications.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
to = '+15555555555' # Your mobile phone number

client.messages.create(
from: from,
to: to,
body: "Hey friend!"
from: from,
to: to,
body: 'Hey friend!'
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
@client = Twilio::REST::Client.new(account_sid, auth_token)

call = @client.calls.create(
to: "+15558675310",
from: "+15017122661",
url: "http://demo.twilio.com/docs/voice.xml")
puts call.to
to: '+15558675310',
from: '+15017122661',
url: 'http://demo.twilio.com/docs/voice.xml'
)
puts call.to
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
require 'bundler'
Bundler.require()
Bundler.require

def self.get_or_post(url,&block)
get(url,&block)
post(url,&block)
def self.get_or_post(url, &block)
get(url, &block)
post(url, &block)
end

get_or_post '/answer' do

Twilio::TwiML::VoiceResponse.new do |r|
r.say(message: "Thank you for calling! Have a great day.")
end.to_s

end
Twilio::TwiML::VoiceResponse.new do |r|
r.say(message: 'Thank you for calling! Have a great day.')
end.to_s
end
1 change: 0 additions & 1 deletion rest/access-tokens/sync-example/sync-example.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
api_secret = ENV['TWILIO_API_KEY_SECRET']
twilio_sync_service = ENV['TWILIO_SYNC_SERVICE_SID']


# Required for Sync
identity = 'user'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@client = Twilio::REST::Client.new(account_sid, auth_token)

incoming_phone_number = @client
.incoming_phone_numbers('PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
.fetch
.incoming_phone_numbers('PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
.fetch

puts incoming_phone_number.sid
2 changes: 1 addition & 1 deletion rest/messages/feedback-confirm/feedback-confirm.5.x.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

post '/confirm' do
# Get your Account SID and Auth Token from twilio.com/console
# To set up environmental variables, see http://twil.io/secure
# To set up environmental variables, see http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']

Expand Down
Loading