From e3419041ad55f3219c10c13ed2c84b32be8d0532 Mon Sep 17 00:00:00 2001 From: Alexis Crespo Date: Thu, 9 Dec 2021 11:25:55 -0500 Subject: [PATCH 1/7] Fix several ruby styling issues --- api-auth/api-auth.5.x.rb | 6 ++-- .../capability-token.5.x.rb | 2 +- .../capability-token.5.x.rb | 2 +- .../capability-token.5.x.rb | 2 +- .../capability-token/capability-token.5.x.rb | 2 +- .../response-twiml-client.5.x.rb | 2 +- fax/basic-send/basic-send.5.x.rb | 1 - .../instance-get-example.5.x.rb | 1 - .../instance-post-example.5.x.rb | 1 - fax/list-get-example/list-get-example.5.x.rb | 1 - fax/sip-send/example-1/example-1.5.x.rb | 1 - fax/sip-send/example-2/example-2.5.x.rb | 1 - .../use-add-on-data/use-add-on-data.5.x.rb | 2 +- .../rest/roles/update-role/update-role.5.x.rb | 2 +- .../token-generation-server.5.x.rb | 2 +- .../lookup-get-basic-example-1.5.x.rb | 6 ++-- .../update-service/update-service.5.x.rb | 2 +- .../rest/users/create-user/create-user.5.x.rb | 2 +- .../create_hello_world_task.5.x.rb | 14 ++++---- .../create_hello_world_samples.5.x.rb | 20 +++++------ .../create_joke_samples.5.x.rb | 36 +++++++++---------- .../create-joke-task/create_joke_task.5.x.rb | 16 ++++----- .../autopilot/query-task/query_task.5.x.rb | 6 ++-- .../sms/example-1/send_notifications.5.x.rb | 6 ++-- .../example-1-make-call/outgoing_call.5.x.rb | 9 ++--- .../respond_to_call.5.x.rb | 18 +++++----- .../sync-example/sync-example.5.x.rb | 1 - .../instance-get-example-1.5.x.rb | 4 +-- .../feedback-confirm/feedback-confirm.5.x.rb | 2 +- .../generate-twiml-dynamic-sms.5.x.rb | 5 +-- .../exchanging-numbers-example-1.5.x.rb | 4 +-- .../instance/post/example-1/example-1.5.x.rb | 2 +- .../jwts/taskqueue/example-1/example-1.5.x.rb | 2 +- .../reservations/call/example-1.5.x.rb | 10 +++--- .../reservations/conference/conference.5.x.rb | 10 +++--- .../reservations/dequeue/example-1.5.x.rb | 4 +-- .../instance/post/example-1/example-1.5.x.rb | 2 +- .../reservations/redirect/redirect.5.x.rb | 6 ++-- .../workers/realtime/example-1.5.x.rb | 3 +- .../instance/post/example-1/example-1.5.x.rb | 2 +- .../list/get/example-1/example-1.5.x.rb | 2 +- .../list/post/example-1/example-1.5.x.rb | 4 +-- .../instance/post/example-1/example-1.5.x.rb | 2 +- .../list/post/example-1/example-1.5.x.rb | 6 ++-- .../twiml/example2/example/example.5.x.rb | 1 - .../instance/post/example-1/example-1.5.x.rb | 4 ++- .../list/get/example-1/example-1.5.x.rb | 2 +- .../instance/post/example-1/example-1.5.x.rb | 2 +- .../instance/post/example-1/example-1.5.x.rb | 2 +- 49 files changed, 119 insertions(+), 126 deletions(-) diff --git a/api-auth/api-auth.5.x.rb b/api-auth/api-auth.5.x.rb index 83a0e8e531..4f7cb76461 100644 --- a/api-auth/api-auth.5.x.rb +++ b/api-auth/api-auth.5.x.rb @@ -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 diff --git a/client/capability-token-2way/capability-token.5.x.rb b/client/capability-token-2way/capability-token.5.x.rb index 4a638bb8f4..895edb2e2f 100644 --- a/client/capability-token-2way/capability-token.5.x.rb +++ b/client/capability-token-2way/capability-token.5.x.rb @@ -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) diff --git a/client/capability-token-incoming/capability-token.5.x.rb b/client/capability-token-incoming/capability-token.5.x.rb index 1a2f869205..2d126ba659 100644 --- a/client/capability-token-incoming/capability-token.5.x.rb +++ b/client/capability-token-incoming/capability-token.5.x.rb @@ -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) diff --git a/client/capability-token-outgoing/capability-token.5.x.rb b/client/capability-token-outgoing/capability-token.5.x.rb index 8029757a12..1d151d9655 100644 --- a/client/capability-token-outgoing/capability-token.5.x.rb +++ b/client/capability-token-outgoing/capability-token.5.x.rb @@ -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) diff --git a/client/capability-token/capability-token.5.x.rb b/client/capability-token/capability-token.5.x.rb index 6ca410c101..b8d975a179 100644 --- a/client/capability-token/capability-token.5.x.rb +++ b/client/capability-token/capability-token.5.x.rb @@ -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) diff --git a/client/response-twiml-client/response-twiml-client.5.x.rb b/client/response-twiml-client/response-twiml-client.5.x.rb index a218e223c8..b4232f6ace 100644 --- a/client/response-twiml-client/response-twiml-client.5.x.rb +++ b/client/response-twiml-client/response-twiml-client.5.x.rb @@ -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'] diff --git a/fax/basic-send/basic-send.5.x.rb b/fax/basic-send/basic-send.5.x.rb index d74fe95397..3a0bb708e5 100644 --- a/fax/basic-send/basic-send.5.x.rb +++ b/fax/basic-send/basic-send.5.x.rb @@ -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', diff --git a/fax/instance-get-example/instance-get-example.5.x.rb b/fax/instance-get-example/instance-get-example.5.x.rb index 81111be784..99920807ae 100644 --- a/fax/instance-get-example/instance-get-example.5.x.rb +++ b/fax/instance-get-example/instance-get-example.5.x.rb @@ -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) diff --git a/fax/instance-post-example/instance-post-example.5.x.rb b/fax/instance-post-example/instance-post-example.5.x.rb index f25ab98103..d7806e584d 100644 --- a/fax/instance-post-example/instance-post-example.5.x.rb +++ b/fax/instance-post-example/instance-post-example.5.x.rb @@ -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') diff --git a/fax/list-get-example/list-get-example.5.x.rb b/fax/list-get-example/list-get-example.5.x.rb index 7e1878641f..442e3af05c 100644 --- a/fax/list-get-example/list-get-example.5.x.rb +++ b/fax/list-get-example/list-get-example.5.x.rb @@ -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) diff --git a/fax/sip-send/example-1/example-1.5.x.rb b/fax/sip-send/example-1/example-1.5.x.rb index 03625a2017..9e462d592e 100644 --- a/fax/sip-send/example-1/example-1.5.x.rb +++ b/fax/sip-send/example-1/example-1.5.x.rb @@ -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', diff --git a/fax/sip-send/example-2/example-2.5.x.rb b/fax/sip-send/example-2/example-2.5.x.rb index 794e713985..f7f0f8b3df 100644 --- a/fax/sip-send/example-2/example-2.5.x.rb +++ b/fax/sip-send/example-2/example-2.5.x.rb @@ -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', diff --git a/guides/voice/recording-add-on-guide/use-add-on-data/use-add-on-data.5.x.rb b/guides/voice/recording-add-on-guide/use-add-on-data/use-add-on-data.5.x.rb index 0eb31ad9d3..aa25aaf672 100644 --- a/guides/voice/recording-add-on-guide/use-add-on-data/use-add-on-data.5.x.rb +++ b/guides/voice/recording-add-on-guide/use-add-on-data/use-add-on-data.5.x.rb @@ -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( diff --git a/ip-messaging/rest/roles/update-role/update-role.5.x.rb b/ip-messaging/rest/roles/update-role/update-role.5.x.rb index 0eca481ece..3ae965e2ae 100644 --- a/ip-messaging/rest/roles/update-role/update-role.5.x.rb +++ b/ip-messaging/rest/roles/update-role/update-role.5.x.rb @@ -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(', ')}" diff --git a/ip-messaging/users/token-generation-server/token-generation-server.5.x.rb b/ip-messaging/users/token-generation-server/token-generation-server.5.x.rb index 995f8677e0..a9ea91a736 100644 --- a/ip-messaging/users/token-generation-server/token-generation-server.5.x.rb +++ b/ip-messaging/users/token-generation-server/token-generation-server.5.x.rb @@ -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'], diff --git a/lookups/lookup-get-basic-example-1/lookup-get-basic-example-1.5.x.rb b/lookups/lookup-get-basic-example-1/lookup-get-basic-example-1.5.x.rb index 8c621ac04b..2c73f3a0d3 100644 --- a/lookups/lookup-get-basic-example-1/lookup-get-basic-example-1.5.x.rb +++ b/lookups/lookup-get-basic-example-1/lookup-get-basic-example-1.5.x.rb @@ -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 diff --git a/notifications/rest/services/update-service/update-service.5.x.rb b/notifications/rest/services/update-service/update-service.5.x.rb index 8681b81f88..27426c518d 100644 --- a/notifications/rest/services/update-service/update-service.5.x.rb +++ b/notifications/rest/services/update-service/update-service.5.x.rb @@ -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' diff --git a/notifications/rest/users/create-user/create-user.5.x.rb b/notifications/rest/users/create-user/create-user.5.x.rb index 3280b584d9..9163b7dd18 100644 --- a/notifications/rest/users/create-user/create-user.5.x.rb +++ b/notifications/rest/users/create-user/create-user.5.x.rb @@ -12,7 +12,7 @@ .notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') .users.create( identity: 'User0001', - segment: ['premium', 'fitness-lifestyle'] + segment: %w[premium fitness-lifestyle] ) puts user.sid diff --git a/quickstart/ruby/autopilot/create-first-task/create_hello_world_task.5.x.rb b/quickstart/ruby/autopilot/create-first-task/create_hello_world_task.5.x.rb index 4a25c7e716..7b3449dba1 100644 --- a/quickstart/ruby/autopilot/create-first-task/create_hello_world_task.5.x.rb +++ b/quickstart/ruby/autopilot/create-first-task/create_hello_world_task.5.x.rb @@ -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 } ] @@ -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 diff --git a/quickstart/ruby/autopilot/create-hello-world-samples/create_hello_world_samples.5.x.rb b/quickstart/ruby/autopilot/create-hello-world-samples/create_hello_world_samples.5.x.rb index 6a3cca2190..b5a94c76b6 100644 --- a/quickstart/ruby/autopilot/create-hello-world-samples/create_hello_world_samples.5.x.rb +++ b/quickstart/ruby/autopilot/create-hello-world-samples/create_hello_world_samples.5.x.rb @@ -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 diff --git a/quickstart/ruby/autopilot/create-joke-samples/create_joke_samples.5.x.rb b/quickstart/ruby/autopilot/create-joke-samples/create_joke_samples.5.x.rb index c44be81fea..339ea35b72 100644 --- a/quickstart/ruby/autopilot/create-joke-samples/create_joke_samples.5.x.rb +++ b/quickstart/ruby/autopilot/create-joke-samples/create_joke_samples.5.x.rb @@ -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 diff --git a/quickstart/ruby/autopilot/create-joke-task/create_joke_task.5.x.rb b/quickstart/ruby/autopilot/create-joke-task/create_joke_task.5.x.rb index b1656f06b1..551199fbbd 100644 --- a/quickstart/ruby/autopilot/create-joke-task/create_joke_task.5.x.rb +++ b/quickstart/ruby/autopilot/create-joke-task/create_joke_task.5.x.rb @@ -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 diff --git a/quickstart/ruby/autopilot/query-task/query_task.5.x.rb b/quickstart/ruby/autopilot/query-task/query_task.5.x.rb index 1cb2940412..c8b5bf6888 100644 --- a/quickstart/ruby/autopilot/query-task/query_task.5.x.rb +++ b/quickstart/ruby/autopilot/query-task/query_task.5.x.rb @@ -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'] diff --git a/quickstart/ruby/sms/example-1/send_notifications.5.x.rb b/quickstart/ruby/sms/example-1/send_notifications.5.x.rb index 9148214903..c34f5f174b 100644 --- a/quickstart/ruby/sms/example-1/send_notifications.5.x.rb +++ b/quickstart/ruby/sms/example-1/send_notifications.5.x.rb @@ -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!' ) diff --git a/quickstart/ruby/voice/example-1-make-call/outgoing_call.5.x.rb b/quickstart/ruby/voice/example-1-make-call/outgoing_call.5.x.rb index 41585ebb27..36cf537c4e 100644 --- a/quickstart/ruby/voice/example-1-make-call/outgoing_call.5.x.rb +++ b/quickstart/ruby/voice/example-1-make-call/outgoing_call.5.x.rb @@ -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 \ No newline at end of file + to: '+15558675310', + from: '+15017122661', + url: 'http://demo.twilio.com/docs/voice.xml' +) +puts call.to diff --git a/quickstart/ruby/voice/example-2-receive-call/respond_to_call.5.x.rb b/quickstart/ruby/voice/example-2-receive-call/respond_to_call.5.x.rb index 7ec2f279f3..c3b5a68df0 100644 --- a/quickstart/ruby/voice/example-2-receive-call/respond_to_call.5.x.rb +++ b/quickstart/ruby/voice/example-2-receive-call/respond_to_call.5.x.rb @@ -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 \ No newline at end of file + Twilio::TwiML::VoiceResponse.new do |r| + r.say(message: 'Thank you for calling! Have a great day.') + end.to_s +end diff --git a/rest/access-tokens/sync-example/sync-example.5.x.rb b/rest/access-tokens/sync-example/sync-example.5.x.rb index 6a121b7bf7..06e8c86164 100644 --- a/rest/access-tokens/sync-example/sync-example.5.x.rb +++ b/rest/access-tokens/sync-example/sync-example.5.x.rb @@ -7,7 +7,6 @@ api_secret = ENV['TWILIO_API_KEY_SECRET'] twilio_sync_service = ENV['TWILIO_SYNC_SERVICE_SID'] - # Required for Sync identity = 'user' diff --git a/rest/incoming-phone-numbers/instance-get-example-1/instance-get-example-1.5.x.rb b/rest/incoming-phone-numbers/instance-get-example-1/instance-get-example-1.5.x.rb index bfad02efc6..22b78210d1 100644 --- a/rest/incoming-phone-numbers/instance-get-example-1/instance-get-example-1.5.x.rb +++ b/rest/incoming-phone-numbers/instance-get-example-1/instance-get-example-1.5.x.rb @@ -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 diff --git a/rest/messages/feedback-confirm/feedback-confirm.5.x.rb b/rest/messages/feedback-confirm/feedback-confirm.5.x.rb index 362b560bb1..a9552af9d7 100644 --- a/rest/messages/feedback-confirm/feedback-confirm.5.x.rb +++ b/rest/messages/feedback-confirm/feedback-confirm.5.x.rb @@ -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'] diff --git a/rest/messages/generate-twiml-dynamic-sms/generate-twiml-dynamic-sms.5.x.rb b/rest/messages/generate-twiml-dynamic-sms/generate-twiml-dynamic-sms.5.x.rb index 45cc1b1fbb..7c677b23b9 100644 --- a/rest/messages/generate-twiml-dynamic-sms/generate-twiml-dynamic-sms.5.x.rb +++ b/rest/messages/generate-twiml-dynamic-sms/generate-twiml-dynamic-sms.5.x.rb @@ -9,9 +9,10 @@ # Build response based on given body param twiml = Twilio::TwiML::MessagingResponse.new do |resp| - if body == 'hello' + case body + when 'hello' resp.message body: 'Hi!' - elsif body == 'bye' + when 'bye' resp.message body: 'Goodbye' end end diff --git a/rest/subaccounts/exchanging-numbers-example-1/exchanging-numbers-example-1.5.x.rb b/rest/subaccounts/exchanging-numbers-example-1/exchanging-numbers-example-1.5.x.rb index 1bd907bebf..0997e17cbd 100644 --- a/rest/subaccounts/exchanging-numbers-example-1/exchanging-numbers-example-1.5.x.rb +++ b/rest/subaccounts/exchanging-numbers-example-1/exchanging-numbers-example-1.5.x.rb @@ -10,7 +10,7 @@ @client = Twilio::REST::Client.new(account_sid, auth_token) incoming_phone_number = @client - .incoming_phone_numbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .update(account_sid: sub_account_sid) + .incoming_phone_numbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') + .update(account_sid: sub_account_sid) puts incoming_phone_number.friendly_name diff --git a/rest/taskrouter/activities/instance/post/example-1/example-1.5.x.rb b/rest/taskrouter/activities/instance/post/example-1/example-1.5.x.rb index 1a2a5e7f06..a5170e9b14 100644 --- a/rest/taskrouter/activities/instance/post/example-1/example-1.5.x.rb +++ b/rest/taskrouter/activities/instance/post/example-1/example-1.5.x.rb @@ -13,6 +13,6 @@ activity = client.taskrouter.v1.workspaces(workspace_sid) .activities(activity_sid) -activity = activity.update(friendly_name: 'NewAvailableFriendlyName') +activity.update(friendly_name: 'NewAvailableFriendlyName') puts activity.friendly_name diff --git a/rest/taskrouter/jwts/taskqueue/example-1/example-1.5.x.rb b/rest/taskrouter/jwts/taskqueue/example-1/example-1.5.x.rb index 7d7397564b..e770214879 100644 --- a/rest/taskrouter/jwts/taskqueue/example-1/example-1.5.x.rb +++ b/rest/taskrouter/jwts/taskqueue/example-1/example-1.5.x.rb @@ -9,7 +9,7 @@ taskqueue_sid = 'WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' capability = Twilio::JWT::TaskRouterCapability.new( - (account_sid, auth_token), + account_sid, auth_token, workspace_sid, taskqueue_sid ) diff --git a/rest/taskrouter/reservations/call/example-1.5.x.rb b/rest/taskrouter/reservations/call/example-1.5.x.rb index be728ab7b2..b5646af3b4 100644 --- a/rest/taskrouter/reservations/call/example-1.5.x.rb +++ b/rest/taskrouter/reservations/call/example-1.5.x.rb @@ -14,12 +14,12 @@ reservation = client.taskrouter.v1.workspaces(workspace_sid) .tasks(task_sid).reservations(reservation_sid) -reservation = reservation.update( - instruction: 'call', - call_from: '+15558675310', - call_url: 'http://example.com/agent_answer', +reservation.update( + instruction: 'call', + call_from: '+15558675310', + call_url: 'http://example.com/agent_answer', call_status_callback_url: 'http://example.com/agent_answer_status_callback', - call_accept: 'true' + call_accept: 'true' ) puts reservation.reservation_status diff --git a/rest/taskrouter/reservations/conference/conference.5.x.rb b/rest/taskrouter/reservations/conference/conference.5.x.rb index 5f88a93d7d..11eb26c637 100644 --- a/rest/taskrouter/reservations/conference/conference.5.x.rb +++ b/rest/taskrouter/reservations/conference/conference.5.x.rb @@ -12,14 +12,14 @@ @client = Twilio::REST::Client.new(account_sid, auth_token) reservation = @client.taskrouter.v1.workspaces(workspace_sid) - .tasks(task_sid).reservations(reservation_sid) + .tasks(task_sid).reservations(reservation_sid) # Update a Reservation with a Conference instruction status_callback = %w[start end join leave mute hold] -reservation = reservation.update(instruction: 'conference', - from: '+18001231234', - conference_status_callback: 'https://www.example.com/ConferenceEvents', - conference_status_callback_event: status_callback) +reservation.update(instruction: 'conference', + from: '+18001231234', + conference_status_callback: 'https://www.example.com/ConferenceEvents', + conference_status_callback_event: status_callback) puts reservation.reservation_status diff --git a/rest/taskrouter/reservations/dequeue/example-1.5.x.rb b/rest/taskrouter/reservations/dequeue/example-1.5.x.rb index 60a0302e66..a64bac7969 100644 --- a/rest/taskrouter/reservations/dequeue/example-1.5.x.rb +++ b/rest/taskrouter/reservations/dequeue/example-1.5.x.rb @@ -14,8 +14,8 @@ reservation = client.taskrouter.v1.workspaces(workspace_sid) .tasks(task_sid).reservations(reservation_sid) -reservation = reservation.update(instruction: 'dequeue', - dequeue_from: '+18001231234') +reservation.update(instruction: 'dequeue', + dequeue_from: '+18001231234') puts reservation.reservation_status diff --git a/rest/taskrouter/reservations/instance/post/example-1/example-1.5.x.rb b/rest/taskrouter/reservations/instance/post/example-1/example-1.5.x.rb index 7170e33d00..36816e1be4 100644 --- a/rest/taskrouter/reservations/instance/post/example-1/example-1.5.x.rb +++ b/rest/taskrouter/reservations/instance/post/example-1/example-1.5.x.rb @@ -14,7 +14,7 @@ reservation = client.taskrouter.v1.workspaces(workspace_sid) .tasks(task_sid).reservations(reservation_sid) -reservation = reservation.update(reservation_status: 'accepted') +reservation.update(reservation_status: 'accepted') puts reservation.reservation_status diff --git a/rest/taskrouter/reservations/redirect/redirect.5.x.rb b/rest/taskrouter/reservations/redirect/redirect.5.x.rb index 91780bf474..9144a03a2b 100644 --- a/rest/taskrouter/reservations/redirect/redirect.5.x.rb +++ b/rest/taskrouter/reservations/redirect/redirect.5.x.rb @@ -14,10 +14,10 @@ reservation = client.taskrouter.v1.workspaces(workspace_sid) .tasks(task_sid).reservations(reservation_sid) -reservation = reservation.update( - instruction: 'Redirect', +reservation.update( + instruction: 'Redirect', redirect_call_sid: 'CA123456789', - redirect_url: 'http://example.com/assignment_redirect' + redirect_url: 'http://example.com/assignment_redirect' ) puts reservation.reservation_status diff --git a/rest/taskrouter/statistics/workers/realtime/example-1.5.x.rb b/rest/taskrouter/statistics/workers/realtime/example-1.5.x.rb index 426cb106fc..017a668756 100644 --- a/rest/taskrouter/statistics/workers/realtime/example-1.5.x.rb +++ b/rest/taskrouter/statistics/workers/realtime/example-1.5.x.rb @@ -12,5 +12,4 @@ statistics = client.taskrouter.v1.workspaces(workspace_sid) .workers.real_time_statistics.fetch -puts statistics.activity_statistics[0]['workers'] \ - + ' in ' + statistics.activity_statistics[0]['friendly_name'] +puts "#{statistics.activity_statistics[0]['workers']} in #{statistics.activity_statistics[0]['friendly_name']}" diff --git a/rest/taskrouter/taskchannels/instance/post/example-1/example-1.5.x.rb b/rest/taskrouter/taskchannels/instance/post/example-1/example-1.5.x.rb index 3709a147ad..140edb6181 100644 --- a/rest/taskrouter/taskchannels/instance/post/example-1/example-1.5.x.rb +++ b/rest/taskrouter/taskchannels/instance/post/example-1/example-1.5.x.rb @@ -12,7 +12,7 @@ task_channel = client.taskrouter.v1.workspaces(workspace_sid).task_channels(task_channel_sid) -task_channel.update(friendly_name: "My Channel") +task_channel.update(friendly_name: 'My Channel') puts task_channel.friendly_name puts task_channel.unique_name diff --git a/rest/taskrouter/taskchannels/list/get/example-1/example-1.5.x.rb b/rest/taskrouter/taskchannels/list/get/example-1/example-1.5.x.rb index 1427d8d824..10c606fb52 100644 --- a/rest/taskrouter/taskchannels/list/get/example-1/example-1.5.x.rb +++ b/rest/taskrouter/taskchannels/list/get/example-1/example-1.5.x.rb @@ -10,6 +10,6 @@ client = Twilio::REST::Client.new(account_sid, auth_token) client.taskrouter.v1.workspaces(workspace_sid) - .task_channels.list.each do |task_channel| + .task_channels.list.each do |task_channel| puts task_channel.unique_name end diff --git a/rest/taskrouter/taskchannels/list/post/example-1/example-1.5.x.rb b/rest/taskrouter/taskchannels/list/post/example-1/example-1.5.x.rb index f89b5d5794..18b4d8aef7 100644 --- a/rest/taskrouter/taskchannels/list/post/example-1/example-1.5.x.rb +++ b/rest/taskrouter/taskchannels/list/post/example-1/example-1.5.x.rb @@ -10,8 +10,8 @@ client = Twilio::REST::Client.new(account_sid, auth_token) task_channel = client.taskrouter.v1.workspaces(workspace_sid).task_channels - .create(friendly_name: "My Channel", - unique_name: "my-channel") + .create(friendly_name: 'My Channel', + unique_name: 'my-channel') puts task_channel.friendly_name puts task_channel.unique_name diff --git a/rest/taskrouter/taskqueues/instance/post/example-1/example-1.5.x.rb b/rest/taskrouter/taskqueues/instance/post/example-1/example-1.5.x.rb index 5dca142903..944e3b3023 100644 --- a/rest/taskrouter/taskqueues/instance/post/example-1/example-1.5.x.rb +++ b/rest/taskrouter/taskqueues/instance/post/example-1/example-1.5.x.rb @@ -13,6 +13,6 @@ taskqueue = client.taskrouter.v1.workspaces(workspace_sid) .task_queues(taskqueue_sid) -taskqueue = taskqueue.update(target_workers: 'languages HAS "english"') +taskqueue.update(target_workers: 'languages HAS "english"') puts taskqueue.target_workers diff --git a/rest/taskrouter/taskqueues/list/post/example-1/example-1.5.x.rb b/rest/taskrouter/taskqueues/list/post/example-1/example-1.5.x.rb index 2725ffa3fd..de0e6cca2c 100644 --- a/rest/taskrouter/taskqueues/list/post/example-1/example-1.5.x.rb +++ b/rest/taskrouter/taskqueues/list/post/example-1/example-1.5.x.rb @@ -10,10 +10,10 @@ client = Twilio::REST::Client.new(account_sid, auth_token) taskqueue = client.taskrouter.v1.workspaces(workspace_sid).task_queues.create( - friendly_name: 'English', + friendly_name: 'English', reservation_activity_sid: 'WAxxxx', - assignment_activity_sid: 'WAyyyy', - target_workers: 'languages HAS "english"' + assignment_activity_sid: 'WAyyyy', + target_workers: 'languages HAS "english"' ) puts taskqueue.friendly_name diff --git a/rest/taskrouter/twiml/example2/example/example.5.x.rb b/rest/taskrouter/twiml/example2/example/example.5.x.rb index 106935821f..1c992ff0e5 100644 --- a/rest/taskrouter/twiml/example2/example/example.5.x.rb +++ b/rest/taskrouter/twiml/example2/example/example.5.x.rb @@ -5,7 +5,6 @@ set :port, 8080 post '/enqueue_call' do - attributes = '{"account_number": "12345abcdef"}' Twilio::TwiML::VoiceResponse.new do |response| diff --git a/rest/taskrouter/worker-channels/instance/post/example-1/example-1.5.x.rb b/rest/taskrouter/worker-channels/instance/post/example-1/example-1.5.x.rb index 0625da01d6..3e53cc7563 100644 --- a/rest/taskrouter/worker-channels/instance/post/example-1/example-1.5.x.rb +++ b/rest/taskrouter/worker-channels/instance/post/example-1/example-1.5.x.rb @@ -11,7 +11,9 @@ client = Twilio::REST::Client.new(account_sid, auth_token) worker_channel = client.taskrouter.v1.workspaces(workspace_sid) - .workers(worker_sid).worker_channels('voice').update(capacity: 1) + .workers(worker_sid) + .worker_channels('voice') + .update(capacity: 1) puts worker_channel.sid diff --git a/rest/taskrouter/worker-channels/list/get/example-1/example-1.5.x.rb b/rest/taskrouter/worker-channels/list/get/example-1/example-1.5.x.rb index 0a191f8a32..55f16590f0 100644 --- a/rest/taskrouter/worker-channels/list/get/example-1/example-1.5.x.rb +++ b/rest/taskrouter/worker-channels/list/get/example-1/example-1.5.x.rb @@ -11,6 +11,6 @@ client = Twilio::REST::Client.new(account_sid, auth_token) client.taskrouter.v1.workspaces(workspace_sid).workers(worker_sid) - .worker_channels.list.each do |worker_channel| + .worker_channels.list.each do |worker_channel| puts worker_channel.task_channel_unique_name end diff --git a/rest/taskrouter/workers/instance/post/example-1/example-1.5.x.rb b/rest/taskrouter/workers/instance/post/example-1/example-1.5.x.rb index cc024e46e5..5885e4f651 100644 --- a/rest/taskrouter/workers/instance/post/example-1/example-1.5.x.rb +++ b/rest/taskrouter/workers/instance/post/example-1/example-1.5.x.rb @@ -13,6 +13,6 @@ worker = client.taskrouter.v1.workspaces(workspace_sid) .workers(worker_sid).fetch -worker = worker.update(attributes: '{"type":"support"}') +worker.update(attributes: '{"type":"support"}') puts worker.attributes diff --git a/rest/taskrouter/workflows/instance/post/example-1/example-1.5.x.rb b/rest/taskrouter/workflows/instance/post/example-1/example-1.5.x.rb index d1e6cba30c..52f917c72b 100644 --- a/rest/taskrouter/workflows/instance/post/example-1/example-1.5.x.rb +++ b/rest/taskrouter/workflows/instance/post/example-1/example-1.5.x.rb @@ -13,6 +13,6 @@ workflow = client.taskrouter.v1.workspaces(workspace_sid) .workflows(workflow_sid) -workflow = workflow.update(task_reservation_timeout: '20') +workflow.update(task_reservation_timeout: '20') puts workflow.task_reservation_timeout From 0c5b2d0b389421ceab2b8987f51316d2989e1bc5 Mon Sep 17 00:00:00 2001 From: Alexis Crespo Date: Thu, 9 Dec 2021 12:34:39 -0500 Subject: [PATCH 2/7] Fix several ruby styling issues --- .../lookup-get-carrier-cname-example-1.5.x.rb | 2 +- .../create-joke-task/create_joke_task.5.x.rb | 2 +- .../reservations/reject/example-1.5.x.rb | 2 +- .../environment-variables-1.5.x.rb | 2 +- .../signature_validation.5.x.rb | 8 ++-- .../get-completed-compositions.5.x.rb | 6 +-- .../get-composition-media-file.5.x.rb | 4 +- .../get-composition/get-composition.5.x.rb | 2 +- .../get-room-compositions.5.x.rb | 6 +-- .../remove-participant.rb | 4 +- .../list-subscribed-tracks.5.x.rb | 4 +- ...retrieve-track-published-by-participant.rb | 8 ++-- ...etrieve-tracks-published-by-participant.rb | 11 ++--- .../retrieve-participants-disconnected.rb | 8 ++-- .../retrieve-a-participant.rb | 2 +- .../retrieve-subscribe-rules.5.x.rb | 4 +- .../retrieve-subscribed-track.5.x.rb | 4 +- .../update-subscribe-rules-dynamic.5.x.rb | 45 +++++++++---------- .../update-customer-rules.5.x.rb | 12 ++--- .../recording-rules-audio-all.5.x.rb | 3 +- .../recording-rules-one-participant.5.x.rb | 4 +- .../recording-rules-stop-all.5.x.rb | 3 +- .../retrieve-media-for-room-recording.5.x.rb | 6 +-- .../token-generation-server.5.x.rb | 2 +- .../token-generation-server.5.x.rb | 2 +- 25 files changed, 77 insertions(+), 79 deletions(-) diff --git a/lookups/lookup-get-carrier-cname-example-1/lookup-get-carrier-cname-example-1.5.x.rb b/lookups/lookup-get-carrier-cname-example-1/lookup-get-carrier-cname-example-1.5.x.rb index 1e5c72ba79..075047ae61 100644 --- a/lookups/lookup-get-carrier-cname-example-1/lookup-get-carrier-cname-example-1.5.x.rb +++ b/lookups/lookup-get-carrier-cname-example-1/lookup-get-carrier-cname-example-1.5.x.rb @@ -10,7 +10,7 @@ encoded_phone_number = CGI.escape('+15108675310') number = @client.lookups.v1 .phone_numbers(encoded_phone_number) - .fetch(type: ['carrier', 'caller-name']) + .fetch(type: %w[carrier caller-name]) puts number.carrier['type'] puts number.carrier['name'] diff --git a/quickstart/ruby/autopilot/create-joke-task/create_joke_task.5.x.rb b/quickstart/ruby/autopilot/create-joke-task/create_joke_task.5.x.rb index 551199fbbd..f99e86f8a8 100644 --- a/quickstart/ruby/autopilot/create-joke-task/create_joke_task.5.x.rb +++ b/quickstart/ruby/autopilot/create-joke-task/create_joke_task.5.x.rb @@ -11,7 +11,7 @@ # 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.' }, + { "say": 'I was going to look for my missing watch, but I could never find the time.' } ] } diff --git a/rest/taskrouter/reservations/reject/example-1.5.x.rb b/rest/taskrouter/reservations/reject/example-1.5.x.rb index ad5c6cd132..8a5c36072a 100644 --- a/rest/taskrouter/reservations/reject/example-1.5.x.rb +++ b/rest/taskrouter/reservations/reject/example-1.5.x.rb @@ -14,7 +14,7 @@ reservation = client.taskrouter.v1.workspaces(workspace_sid) .tasks(task_sid).reservations(reservation_sid) -reservation = reservation.update(reservation_status: 'rejected') +reservation.update(reservation_status: 'rejected') puts reservation.reservation_status diff --git a/security/environment_variables/environment-variables-1.5.x.rb b/security/environment_variables/environment-variables-1.5.x.rb index 45eb54a27f..0c82e7e62f 100644 --- a/security/environment_variables/environment-variables-1.5.x.rb +++ b/security/environment_variables/environment-variables-1.5.x.rb @@ -7,4 +7,4 @@ auth_token = ENV['TWILIO_AUTH_TOKEN'] @client = Twilio::REST::Client.new(account_sid, auth_token) -# Make API calls here... \ No newline at end of file +# Make API calls here... diff --git a/security/signature_validation/signature_validation.5.x.rb b/security/signature_validation/signature_validation.5.x.rb index b3f6689f72..ef998ca6c3 100644 --- a/security/signature_validation/signature_validation.5.x.rb +++ b/security/signature_validation/signature_validation.5.x.rb @@ -9,10 +9,10 @@ url = 'https://mycompany.com/myapp.php?foo=1&bar=2' params = { 'CallSid' => 'CA1234567890ABCDE', - 'Caller' => '+12349013030', - 'Digits' => '1234', - 'From' => '+12349013030', - 'To' => '+18005551212' + 'Caller' => '+12349013030', + 'Digits' => '1234', + 'From' => '+12349013030', + 'To' => '+18005551212' } # The X-Twilio-Signature header attached to the request twilio_signature = '0/KCTR6DLpKmkAf8muzZqo1nDgQ=' diff --git a/video/rest/compositions/get-completed-compositions/get-completed-compositions.5.x.rb b/video/rest/compositions/get-completed-compositions/get-completed-compositions.5.x.rb index 5b369647fa..80cde20720 100644 --- a/video/rest/compositions/get-completed-compositions/get-completed-compositions.5.x.rb +++ b/video/rest/compositions/get-completed-compositions/get-completed-compositions.5.x.rb @@ -10,9 +10,9 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) compositions = @client.video.compositions - .list( - status: 'completed' - ) + .list( + status: 'completed' + ) compositions.each do |c| puts c.sid diff --git a/video/rest/compositions/get-composition-media-file/get-composition-media-file.5.x.rb b/video/rest/compositions/get-composition-media-file/get-composition-media-file.5.x.rb index 63440750a1..0369d6b995 100644 --- a/video/rest/compositions/get-composition-media-file/get-composition-media-file.5.x.rb +++ b/video/rest/compositions/get-composition-media-file/get-composition-media-file.5.x.rb @@ -14,10 +14,10 @@ uri = "https://video.twilio.com/v1/Compositions/#{composition_sid}/Media?Ttl=3600" -response = client.request("video.twilio.com", 433, 'GET', uri) +response = client.request('video.twilio.com', 433, 'GET', uri) media_location = response.body['redirect_to'] # For example, write the composition media to a local file -open('myFile.mp4', "wb") do |file| +open('myFile.mp4', 'wb') do |file| file << open(media_location).read end diff --git a/video/rest/compositions/get-composition/get-composition.5.x.rb b/video/rest/compositions/get-composition/get-composition.5.x.rb index 83146c55c9..d3233bf1ff 100644 --- a/video/rest/compositions/get-composition/get-composition.5.x.rb +++ b/video/rest/compositions/get-composition/get-composition.5.x.rb @@ -10,6 +10,6 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) composition = @client.video.compositions(CJXXXX) - .fetch() + .fetch puts composition.sid diff --git a/video/rest/compositions/get-room-compositions/get-room-compositions.5.x.rb b/video/rest/compositions/get-room-compositions/get-room-compositions.5.x.rb index 04c1338a9b..044dc9d2b1 100644 --- a/video/rest/compositions/get-room-compositions/get-room-compositions.5.x.rb +++ b/video/rest/compositions/get-room-compositions/get-room-compositions.5.x.rb @@ -10,9 +10,9 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) compositions = @client.video.compositions - .list( - room_sid: 'RMXXXX' - ) + .list( + room_sid: 'RMXXXX' + ) compositions.each do |c| puts c.sid diff --git a/video/rest/rooms/participants/kick-remove-participant/remove-participant.rb b/video/rest/rooms/participants/kick-remove-participant/remove-participant.rb index 4a94dbc6da..4791953c82 100644 --- a/video/rest/rooms/participants/kick-remove-participant/remove-participant.rb +++ b/video/rest/rooms/participants/kick-remove-participant/remove-participant.rb @@ -9,7 +9,7 @@ client = Twilio::REST::Client.new api_key_sid, api_key_secret participant = client.video.rooms('DailyStandup') - .participants('Alice') - .update(status: 'disconnected') + .participants('Alice') + .update(status: 'disconnected') puts participant.status diff --git a/video/rest/rooms/participants/list-subscribed-tracks/list-subscribed-tracks.5.x.rb b/video/rest/rooms/participants/list-subscribed-tracks/list-subscribed-tracks.5.x.rb index 7378aba553..7815fd6f06 100644 --- a/video/rest/rooms/participants/list-subscribed-tracks/list-subscribed-tracks.5.x.rb +++ b/video/rest/rooms/participants/list-subscribed-tracks/list-subscribed-tracks.5.x.rb @@ -10,8 +10,8 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) subscribe_tracks = @client.video.rooms('RMXXXX').participant('PAXXXX') - .subscribe_rules.list() + .subscribe_rules.list subscribe_tracks.each do |subscribed_track| - puts "Read subscribed track with sid = " + subscribed_track.sid + puts "Read subscribed track with sid = #{subscribed_track.sid}" end diff --git a/video/rest/rooms/participants/published-track/retrieve-track-published-by-participant/retrieve-track-published-by-participant.rb b/video/rest/rooms/participants/published-track/retrieve-track-published-by-participant/retrieve-track-published-by-participant.rb index 73629f78c7..10bf5dafd3 100644 --- a/video/rest/rooms/participants/published-track/retrieve-track-published-by-participant/retrieve-track-published-by-participant.rb +++ b/video/rest/rooms/participants/published-track/retrieve-track-published-by-participant/retrieve-track-published-by-participant.rb @@ -8,8 +8,8 @@ client = Twilio::REST::Client.new api_key_sid, api_key_secret -publishedTrack = client.video.rooms('DailyStandup') - .participants('Alice') - .published_tracks('Camera').fetch +published_track = client.video.rooms('DailyStandup') + .participants('Alice') + .published_tracks('Camera').fetch -puts publishedTrack.date_created +puts published_track.date_created diff --git a/video/rest/rooms/participants/published-track/retrieve-tracks-published-by-participant/retrieve-tracks-published-by-participant.rb b/video/rest/rooms/participants/published-track/retrieve-tracks-published-by-participant/retrieve-tracks-published-by-participant.rb index 0b033b00e4..20e4f250e1 100644 --- a/video/rest/rooms/participants/published-track/retrieve-tracks-published-by-participant/retrieve-tracks-published-by-participant.rb +++ b/video/rest/rooms/participants/published-track/retrieve-tracks-published-by-participant/retrieve-tracks-published-by-participant.rb @@ -8,9 +8,10 @@ client = Twilio::REST::Client.new api_key_sid, api_key_secret -publishedTracks = client.video.rooms('DailyStandup') - .participants('Alice') - .published_tracks.list +published_tracks = client.video.rooms('DailyStandup') + .participants('Alice') + .published_tracks.list -publishedTracks.each do |publishedTrack| - puts publishedTrack.sid +published_tracks.each do |published_track| + puts published_track.sid +end diff --git a/video/rest/rooms/participants/retrieve-participant-list-disconnected/retrieve-participants-disconnected.rb b/video/rest/rooms/participants/retrieve-participant-list-disconnected/retrieve-participants-disconnected.rb index 761e62ce3d..2bc0222e19 100644 --- a/video/rest/rooms/participants/retrieve-participant-list-disconnected/retrieve-participants-disconnected.rb +++ b/video/rest/rooms/participants/retrieve-participant-list-disconnected/retrieve-participants-disconnected.rb @@ -8,7 +8,7 @@ client = Twilio::REST::Client.new api_key_sid, api_key_secret -participants = client.video.rooms('RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .participants.list(status: 'disconnected').each do |participant| - puts participant.sid - end +client.video.rooms('RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') + .participants.list(status: 'disconnected').each do |participant| + puts participant.sid +end diff --git a/video/rest/rooms/participants/retrieve-participant/retrieve-a-participant.rb b/video/rest/rooms/participants/retrieve-participant/retrieve-a-participant.rb index 5ec87aa936..7a9159769d 100644 --- a/video/rest/rooms/participants/retrieve-participant/retrieve-a-participant.rb +++ b/video/rest/rooms/participants/retrieve-participant/retrieve-a-participant.rb @@ -9,6 +9,6 @@ client = Twilio::REST::Client.new api_key_sid, api_key_secret participant = client.video.rooms('DailyStandup') - .participants('Alice').fetch + .participants('Alice').fetch puts participant.sid diff --git a/video/rest/rooms/participants/retrieve-subscribe-rules/retrieve-subscribe-rules.5.x.rb b/video/rest/rooms/participants/retrieve-subscribe-rules/retrieve-subscribe-rules.5.x.rb index 3b579beda8..b738e6873c 100644 --- a/video/rest/rooms/participants/retrieve-subscribe-rules/retrieve-subscribe-rules.5.x.rb +++ b/video/rest/rooms/participants/retrieve-subscribe-rules/retrieve-subscribe-rules.5.x.rb @@ -10,8 +10,8 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) subscribe_rules = @client.video.rooms('RMXXXX').participants('PAXXXX') -.subscribe_rules.fetch() + .subscribe_rules.fetch subscribe_rules.rules.each do |rule| - puts "Read rule with type = " +rule["type"] + puts "Read rule with type = #{rule['type']}" end diff --git a/video/rest/rooms/participants/retrieve-subscribed-track/retrieve-subscribed-track.5.x.rb b/video/rest/rooms/participants/retrieve-subscribed-track/retrieve-subscribed-track.5.x.rb index 917b0eefd5..96df2d2083 100644 --- a/video/rest/rooms/participants/retrieve-subscribed-track/retrieve-subscribed-track.5.x.rb +++ b/video/rest/rooms/participants/retrieve-subscribed-track/retrieve-subscribed-track.5.x.rb @@ -10,6 +10,6 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) subscribed_track = @client.video.rooms('RMXXXX').participants('PAXXXX') - .subscribed_tracks('MTXXXX').fetch() + .subscribed_tracks('MTXXXX').fetch -puts "Read track subscription with sid = " + subscribe_track.sid +puts "Read track subscription with sid = #{subscribed_track.sid}" diff --git a/video/rest/rooms/participants/update-subscribe-rules-dynamic/update-subscribe-rules-dynamic.5.x.rb b/video/rest/rooms/participants/update-subscribe-rules-dynamic/update-subscribe-rules-dynamic.5.x.rb index 5b680a21e4..0488c462d4 100644 --- a/video/rest/rooms/participants/update-subscribe-rules-dynamic/update-subscribe-rules-dynamic.5.x.rb +++ b/video/rest/rooms/participants/update-subscribe-rules-dynamic/update-subscribe-rules-dynamic.5.x.rb @@ -10,45 +10,44 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) #------------------------------------------------------------------------------- -#1. At connect time Adam wants to receive all the tracks. +# 1. At connect time Adam wants to receive all the tracks. # Done by default rule. No further actions required. - #------------------------------------------------------------------------------- -#2. After a while, Adam notices his bandwidth consumption is too high and +# 2. After a while, Adam notices his bandwidth consumption is too high and # decides to unsubscribe from all video tracks @client.video.rooms('RMXXXX').participants('Adam') -.subscribe_rules.update( - rules = [ - {"type": "include", "kind": "audio"} - ] -) + .subscribe_rules.update( + rules: [ + { "type": 'include', "kind": 'audio' } + ] + ) puts 'Subscribe Rules updated successfully' #------------------------------------------------------------------------------- -#3. Later, a video screenshare track with SID MTXXXX is published to the room +# 3. Later, a video screenshare track with SID MTXXXX is published to the room # and Adam subscribes to it. @client.video.rooms('RMXXXX').participants('Adam') -.subscribe_rules.update( - rules = [ - {"type": "include", "kind": "audio"}, - {"type": "include", "track": "MTXXXX"} - ] -) + .subscribe_rules.update( + rules: [ + { "type": 'include', "kind": 'audio' }, + { "type": 'include', "track": 'MTXXXX' } + ] + ) puts 'Subscribe Rules updated successfully' #------------------------------------------------------------------------------- -#4. John, another participant, is in a noisy place and his audio track is +# 4. John, another participant, is in a noisy place and his audio track is # annoying. Adam decides to unsubscribe from it. @client.video.rooms('RMXXXX').participants('Adam') -.subscribe_rules.update( - rules = [ - {"type": "include", "kind": "audio"}, - {"type": "include", "track": "MTXXXX"}, - {"type": "exclude", "publisher": "John", "kind": "audio"} - ] -) + .subscribe_rules.update( + rules: [ + { "type": 'include', "kind": 'audio' }, + { "type": 'include', "track": 'MTXXXX' }, + { "type": 'exclude', "publisher": 'John', "kind": 'audio' } + ] + ) puts 'Subscribe Rules updated successfully' diff --git a/video/rest/rooms/participants/update-subscribe-rules-static/update-customer-rules.5.x.rb b/video/rest/rooms/participants/update-subscribe-rules-static/update-customer-rules.5.x.rb index 7624f9937a..bb8f90e605 100644 --- a/video/rest/rooms/participants/update-subscribe-rules-static/update-customer-rules.5.x.rb +++ b/video/rest/rooms/participants/update-subscribe-rules-static/update-customer-rules.5.x.rb @@ -10,11 +10,11 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) @client.video.rooms('RMXXXX').participants('Customer') -.subscribe_rules.update( - rules: [ - {"type": "include", "all": true}, - {"type": "exclude", "publisher": "Supervisor"} - ] -) + .subscribe_rules.update( + rules: [ + { "type": 'include', "all": true }, + { "type": 'exclude', "publisher": 'Supervisor' } + ] + ) puts 'Subscribe Rules updated successfully' diff --git a/video/rest/rooms/recording-rules-audio-all/recording-rules-audio-all.5.x.rb b/video/rest/rooms/recording-rules-audio-all/recording-rules-audio-all.5.x.rb index e1748a929b..eefd21744e 100644 --- a/video/rest/rooms/recording-rules-audio-all/recording-rules-audio-all.5.x.rb +++ b/video/rest/rooms/recording-rules-audio-all/recording-rules-audio-all.5.x.rb @@ -11,7 +11,6 @@ recording_rules = @client.video .rooms('RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') .recording_rules - .update(rules: [{"type": :"include", "kind": "audio"}]) + .update(rules: [{ "type": :include, "kind": 'audio' }]) puts recording_rules.room_sid - diff --git a/video/rest/rooms/recording-rules-one-participant/recording-rules-one-participant.5.x.rb b/video/rest/rooms/recording-rules-one-participant/recording-rules-one-participant.5.x.rb index a927645d62..02598e3c28 100644 --- a/video/rest/rooms/recording-rules-one-participant/recording-rules-one-participant.5.x.rb +++ b/video/rest/rooms/recording-rules-one-participant/recording-rules-one-participant.5.x.rb @@ -11,7 +11,7 @@ recording_rules = @client.video .rooms('RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') .recording_rules - .update(rules: [{"type": :"include", "publisher": "Alice"}, {"type": :"include", "kind": "audio"}]) + .update(rules: [{ "type": :include, "publisher": 'Alice' }, + { "type": :include, "kind": 'audio' }]) puts recording_rules.room_sid - diff --git a/video/rest/rooms/recording-rules-stop-all/recording-rules-stop-all.5.x.rb b/video/rest/rooms/recording-rules-stop-all/recording-rules-stop-all.5.x.rb index e77e023608..f2d563da4f 100644 --- a/video/rest/rooms/recording-rules-stop-all/recording-rules-stop-all.5.x.rb +++ b/video/rest/rooms/recording-rules-stop-all/recording-rules-stop-all.5.x.rb @@ -11,7 +11,6 @@ recording_rules = @client.video .rooms('RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') .recording_rules - .update(rules: [{"type": :"exclude", "all": true}]) + .update(rules: [{ "type": :exclude, "all": true }]) puts recording_rules.room_sid - diff --git a/video/rest/rooms/retrieve-media-for-room-recording/retrieve-media-for-room-recording.5.x.rb b/video/rest/rooms/retrieve-media-for-room-recording/retrieve-media-for-room-recording.5.x.rb index 2a1d4d9c76..ef2d435177 100644 --- a/video/rest/rooms/retrieve-media-for-room-recording/retrieve-media-for-room-recording.5.x.rb +++ b/video/rest/rooms/retrieve-media-for-room-recording/retrieve-media-for-room-recording.5.x.rb @@ -11,9 +11,9 @@ room_sid = 'RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' recording_sid = 'RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' -uri = 'https://video.twilio.com/v1/' + - "Rooms/#{room_sid}/" + - "Recordings/#{recording_sid}/" + +uri = 'https://video.twilio.com/v1/' \ + "Rooms/#{room_sid}/" \ + "Recordings/#{recording_sid}/" \ 'Media' response = client.request('video.twilio.com', 443, 'GET', uri) media_location = response.body['redirect_to'] diff --git a/video/users/token-generation-server-rooms/token-generation-server.5.x.rb b/video/users/token-generation-server-rooms/token-generation-server.5.x.rb index 780ea2b68f..1db7cc6d19 100644 --- a/video/users/token-generation-server-rooms/token-generation-server.5.x.rb +++ b/video/users/token-generation-server-rooms/token-generation-server.5.x.rb @@ -19,7 +19,7 @@ # Create an Access Token for Video 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'], diff --git a/video/users/token-generation-server/token-generation-server.5.x.rb b/video/users/token-generation-server/token-generation-server.5.x.rb index 57b242560f..bc01d785e5 100644 --- a/video/users/token-generation-server/token-generation-server.5.x.rb +++ b/video/users/token-generation-server/token-generation-server.5.x.rb @@ -19,7 +19,7 @@ # Create an Access Token for Video 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'], From c43395352af522cc38a839d503cef37ba4791c77 Mon Sep 17 00:00:00 2001 From: Alexis Crespo Date: Thu, 9 Dec 2021 13:58:38 -0500 Subject: [PATCH 3/7] Fix several ruby styling issues --- .../get-voice-number-with-origination-number.5.x.rb | 2 +- pricing/get-voice-number/get-voice-number.5.x.rb | 2 +- .../ruby/sms/example-2/send_notifications.5.x.rb | 7 +++---- rest/taskrouter/jwts/worker/example-1/example-1.5.x.rb | 8 ++++---- .../jwts/workspace/example-1/example-1.5.x.rb | 2 +- .../tasks/instance/post/example-1/example-1.5.x.rb | 4 ++-- .../instance/get/example-1/example-1.5.x.rb | 2 +- super-sim/sims/update-account/update-account.5.x.rb | 6 +++--- .../delete-permission/delete-permission.5.x.rb | 4 ++-- .../list-permissions/list-permissions.5.x.rb | 4 ++-- .../retrieve-permission/retrieve-permission.5.x.rb | 4 ++-- .../update-permission/update-permission.5.x.rb | 4 ++-- .../documents/create-document/create-document.5.x.rb | 2 +- .../delete-permission/delete-permission.5.x.rb | 4 ++-- .../list-permissions/list-permissions.5.x.rb | 4 ++-- .../retrieve-permission/retrieve-permission.5.x.rb | 4 ++-- .../update-permission/update-permission.5.x.rb | 4 ++-- .../lists/create-list-item/create-list-item.5.x.rb | 2 +- sync/rest/lists/create-list/create-list.5.x.rb | 2 +- sync/rest/lists/query-list/query-list.5.x.rb | 2 +- sync/rest/lists/update-list/update-list.5.x.rb | 2 +- .../delete-permission/delete-permission.5.x.rb | 4 ++-- .../list-permissions/list-permissions.5.x.rb | 4 ++-- .../retrieve-permission/retrieve-permission.5.x.rb | 4 ++-- .../update-permission/update-permission.5.x.rb | 4 ++-- sync/rest/maps/create-map-item/create-map-item.5.x.rb | 4 ++-- sync/rest/maps/create-map/create-map.5.x.rb | 2 +- sync/rest/maps/query-map/query-map.5.x.rb | 2 +- sync/rest/maps/update-map/update-map.5.x.rb | 2 +- .../create-service-webhook.5.x.rb | 2 +- sync/rest/streams/update-stream/update-stream.5.x.rb | 2 +- twiml/voice/connect/autopilot/connect-1.5.x.rb | 2 +- twiml/voice/connect/connect-1/connect-1.5.x.rb | 2 +- twiml/voice/connect/stream/connect_stream.5.x.rb | 2 +- .../voice/connect/virtualagent-1/virtualagent-1.5.x.rb | 2 +- .../voice/connect/virtualagent-2/virtualagent-2.5.x.rb | 2 +- .../voice/connect/virtualagent-3/virtualagent-3.5.x.rb | 2 +- .../voice/connect/virtualagent-4/virtualagent-4.5.x.rb | 2 +- twiml/voice/dial/dial-7/dial-7.5.x.rb | 5 +++-- twiml/voice/dial/dial-8/dial-8.5.x.rb | 2 +- twiml/voice/dial/dial-9/dial-9.5.x.rb | 2 +- twiml/voice/number/number-5/number-5.5.x.rb | 2 +- twiml/voice/parameter/parameter-1/parameter-5.x.rb | 10 +++++----- twiml/voice/pay/pay-7/pay-7.5.x.rb | 3 ++- twiml/voice/refer/refer-1/refer-1.5.x.rb | 2 +- twiml/voice/refer/refer-2/refer-2.5.x.rb | 2 +- twiml/voice/refer/refer-3/refer-3.5.x.rb | 2 +- twiml/voice/refer/refer-4/refer-4.5.x.rb | 2 +- twiml/voice/sip/sip-11/sip-11.5.x.rb | 8 ++++---- twiml/voice/sip/sip-9/sip-9.5.x.rb | 2 +- twiml/voice/siprec/siprec-1/siprec-1.5.x.rb | 2 +- twiml/voice/stream/stream-1/stream-1.5.x.rb | 2 +- twiml/voice/stream/stream-2/stream-2.5.x.rb | 8 ++++---- .../verify-webhook/verify-webhook.5.x.rb | 5 +++-- .../approve-verification/approve-verification.5.x.rb | 2 +- .../audio-mixing-hook/audio-mixing-hook.5.x.rb | 4 ++-- .../complex-layout-hook/complex-layout-hook.5.x.rb | 6 +++--- .../compositionhooks/delete-hook/delete-hook.5.x.rb | 2 +- video/rest/compositionhooks/get-hook/get-hook.5.x.rb | 8 ++++---- .../grid-mixing-hook/grid-mixing-hook.5.x.rb | 4 ++-- .../rest/compositionhooks/list-hooks/list-hooks.5.x.rb | 6 +++--- .../compositionhooks/update-hook/update-hook.5.x.rb | 4 ++-- .../compositions/compose-chess/compose-chess.5.x.rb | 2 +- .../compose-main-with-row/compose-main-with-row.5.x.rb | 2 +- video/rest/compositions/compose-pip/compose-pip.5.x.rb | 2 +- .../compose-set-as-row/compose-set-as-row.5.x.rb | 8 ++++---- .../delete-composition/delete-composition.5.x.rb | 2 +- 67 files changed, 116 insertions(+), 114 deletions(-) diff --git a/pricing/get-voice-number-with-origination-number/get-voice-number-with-origination-number.5.x.rb b/pricing/get-voice-number-with-origination-number/get-voice-number-with-origination-number.5.x.rb index 1c71010c84..ba8275747a 100644 --- a/pricing/get-voice-number-with-origination-number/get-voice-number-with-origination-number.5.x.rb +++ b/pricing/get-voice-number-with-origination-number/get-voice-number-with-origination-number.5.x.rb @@ -7,6 +7,6 @@ auth_token = ENV['TWILIO_AUTH_TOKEN'] @client = Twilio::REST::Client.new(account_sid, auth_token) -numbers = @client.pricing.voice.numbers('+15108675310') +number = @client.pricing.voice.numbers('+15108675310') puts number.fetch(origination_number: '+12421234567') .outbound_call_price['current_price'] diff --git a/pricing/get-voice-number/get-voice-number.5.x.rb b/pricing/get-voice-number/get-voice-number.5.x.rb index 6b628ce94c..381775e948 100644 --- a/pricing/get-voice-number/get-voice-number.5.x.rb +++ b/pricing/get-voice-number/get-voice-number.5.x.rb @@ -7,5 +7,5 @@ auth_token = ENV['TWILIO_AUTH_TOKEN'] @client = Twilio::REST::Client.new(account_sid, auth_token) -numbers = @client.pricing.voice.numbers('+15108675310') +number = @client.pricing.voice.numbers('+15108675310') puts number.fetch.outbound_call_price['current_price'] diff --git a/quickstart/ruby/sms/example-2/send_notifications.5.x.rb b/quickstart/ruby/sms/example-2/send_notifications.5.x.rb index 7457405b88..c34f5f174b 100644 --- a/quickstart/ruby/sms/example-2/send_notifications.5.x.rb +++ b/quickstart/ruby/sms/example-2/send_notifications.5.x.rb @@ -10,8 +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!' ) - diff --git a/rest/taskrouter/jwts/worker/example-1/example-1.5.x.rb b/rest/taskrouter/jwts/worker/example-1/example-1.5.x.rb index dd5adbf68c..bd1b438842 100644 --- a/rest/taskrouter/jwts/worker/example-1/example-1.5.x.rb +++ b/rest/taskrouter/jwts/worker/example-1/example-1.5.x.rb @@ -9,7 +9,7 @@ worker_sid = 'WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' capability = Twilio::JWT::TaskRouterCapability.new( - (account_sid, auth_token), + account_sid, auth_token, workspace_sid, worker_sid ) @@ -32,8 +32,8 @@ capability.add_policy(allow_reservation_updates) Twilio::JWT::TaskRouterCapability::TaskRouterUtils -.worker_policies(workspace_sid, worker_sid).each { |worker_policy| - capability.add_policy(worker_policy) -} + .worker_policies(workspace_sid, worker_sid).each do |worker_policy| + capability.add_policy(worker_policy) +end puts capability.to_s diff --git a/rest/taskrouter/jwts/workspace/example-1/example-1.5.x.rb b/rest/taskrouter/jwts/workspace/example-1/example-1.5.x.rb index 02a490007c..eb7ef209da 100644 --- a/rest/taskrouter/jwts/workspace/example-1/example-1.5.x.rb +++ b/rest/taskrouter/jwts/workspace/example-1/example-1.5.x.rb @@ -8,7 +8,7 @@ workspace_sid = 'WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' capability = Twilio::JWT::TaskRouterCapability.new( - (account_sid, auth_token), workspace_sid, workspace_sid + account_sid, auth_token, workspace_sid, workspace_sid ) allow_fetch_subresources = Twilio::JWT::TaskRouterCapability::Policy.new( diff --git a/rest/taskrouter/tasks/instance/post/example-1/example-1.5.x.rb b/rest/taskrouter/tasks/instance/post/example-1/example-1.5.x.rb index 53206ab30c..31571d3564 100644 --- a/rest/taskrouter/tasks/instance/post/example-1/example-1.5.x.rb +++ b/rest/taskrouter/tasks/instance/post/example-1/example-1.5.x.rb @@ -13,14 +13,14 @@ # update a task's attributes task = client.taskrouter.v1.workspaces(workspace_sid).tasks(task_sid) -task = task.update(attributes: '{"type":"support"}') +task.update(attributes: '{"type":"support"}') puts task.attributes # cancel a task task = client.taskrouter.v1.workspaces(workspace_sid).tasks(task_sid) -task = task.update(assignment_status: 'canceled', reason: 'waiting too long') +task.update(assignment_status: 'canceled', reason: 'waiting too long') puts task.assignment_status diff --git a/rest/taskrouter/worker-channels/instance/get/example-1/example-1.5.x.rb b/rest/taskrouter/worker-channels/instance/get/example-1/example-1.5.x.rb index ca6668a48c..ad8051ca99 100644 --- a/rest/taskrouter/worker-channels/instance/get/example-1/example-1.5.x.rb +++ b/rest/taskrouter/worker-channels/instance/get/example-1/example-1.5.x.rb @@ -11,6 +11,6 @@ client = Twilio::REST::Client.new(account_sid, auth_token) worker_channel = client.taskrouter.v1.workspaces(workspace_sid) - .workers(worker_sid).worker_channels('voice').fetch + .workers(worker_sid).worker_channels('voice').fetch puts worker_channel.task_channel_unique_name diff --git a/super-sim/sims/update-account/update-account.5.x.rb b/super-sim/sims/update-account/update-account.5.x.rb index e090a2e303..ab2caca227 100644 --- a/super-sim/sims/update-account/update-account.5.x.rb +++ b/super-sim/sims/update-account/update-account.5.x.rb @@ -9,8 +9,8 @@ @client = Twilio::REST::Client.new(account_sid, auth_token) sim = @client.supersim.sims('HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .update( - account_sid: 'ACbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' - ) + .update( + account_sid: 'ACbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' + ) puts sim.account_sid diff --git a/sync/rest/document-permissions/delete-permission/delete-permission.5.x.rb b/sync/rest/document-permissions/delete-permission/delete-permission.5.x.rb index 46400a82d3..3df68b8c3f 100644 --- a/sync/rest/document-permissions/delete-permission/delete-permission.5.x.rb +++ b/sync/rest/document-permissions/delete-permission/delete-permission.5.x.rb @@ -11,6 +11,6 @@ response = service.documents('MyFirstDocument') .document_permissions('bob').delete puts response -rescue Twilio::REST::TwilioError => err - puts err +rescue Twilio::REST::TwilioError => e + puts e end diff --git a/sync/rest/document-permissions/list-permissions/list-permissions.5.x.rb b/sync/rest/document-permissions/list-permissions/list-permissions.5.x.rb index da609a9fc6..119909ccea 100644 --- a/sync/rest/document-permissions/list-permissions/list-permissions.5.x.rb +++ b/sync/rest/document-permissions/list-permissions/list-permissions.5.x.rb @@ -11,6 +11,6 @@ response = service.documents('MyFirstDocument') .document_permissions.list puts response -rescue Twilio::REST::TwilioError => err - puts err +rescue Twilio::REST::TwilioError => e + puts e end diff --git a/sync/rest/document-permissions/retrieve-permission/retrieve-permission.5.x.rb b/sync/rest/document-permissions/retrieve-permission/retrieve-permission.5.x.rb index 2577bc7e1f..9f1d619bd9 100644 --- a/sync/rest/document-permissions/retrieve-permission/retrieve-permission.5.x.rb +++ b/sync/rest/document-permissions/retrieve-permission/retrieve-permission.5.x.rb @@ -11,6 +11,6 @@ response = service.documents('MyFirstDocument') .document_permissions('bob').fetch puts response -rescue Twilio::REST::TwilioError => err - puts err +rescue Twilio::REST::TwilioError => e + puts e end diff --git a/sync/rest/document-permissions/update-permission/update-permission.5.x.rb b/sync/rest/document-permissions/update-permission/update-permission.5.x.rb index e128b0a06e..fed31dbf5a 100644 --- a/sync/rest/document-permissions/update-permission/update-permission.5.x.rb +++ b/sync/rest/document-permissions/update-permission/update-permission.5.x.rb @@ -12,6 +12,6 @@ .document_permissions('bob') .update(read: true, write: true, manage: false) puts response -rescue Twilio::REST::TwilioError => err - puts err +rescue Twilio::REST::TwilioError => e + puts e end diff --git a/sync/rest/documents/create-document/create-document.5.x.rb b/sync/rest/documents/create-document/create-document.5.x.rb index 1ae8afd8b9..3114ded86c 100644 --- a/sync/rest/documents/create-document/create-document.5.x.rb +++ b/sync/rest/documents/create-document/create-document.5.x.rb @@ -22,7 +22,7 @@ response = service.documents.create( unique_name: 'MyFirstDocument', data: "{#{data.join(',')}}", - ttl: 1814400 # expires in 21 days + ttl: 1_814_400 # expires in 21 days ) puts response diff --git a/sync/rest/list-permissions/delete-permission/delete-permission.5.x.rb b/sync/rest/list-permissions/delete-permission/delete-permission.5.x.rb index beb879b9e0..a4af35d794 100644 --- a/sync/rest/list-permissions/delete-permission/delete-permission.5.x.rb +++ b/sync/rest/list-permissions/delete-permission/delete-permission.5.x.rb @@ -11,6 +11,6 @@ response = service.sync_lists('MyFirstList') .sync_list_permissions('bob').delete puts response -rescue Twilio::REST::TwilioError => err - puts err +rescue Twilio::REST::TwilioError => e + puts e end diff --git a/sync/rest/list-permissions/list-permissions/list-permissions.5.x.rb b/sync/rest/list-permissions/list-permissions/list-permissions.5.x.rb index c3c7113be9..e620bbc3fa 100644 --- a/sync/rest/list-permissions/list-permissions/list-permissions.5.x.rb +++ b/sync/rest/list-permissions/list-permissions/list-permissions.5.x.rb @@ -11,6 +11,6 @@ response = service.sync_lists('MyFirstList') .sync_list_permissions.list puts response -rescue Twilio::REST::TwilioError => err - puts err +rescue Twilio::REST::TwilioError => e + puts e end diff --git a/sync/rest/list-permissions/retrieve-permission/retrieve-permission.5.x.rb b/sync/rest/list-permissions/retrieve-permission/retrieve-permission.5.x.rb index 67296119d5..ca3d079dc4 100644 --- a/sync/rest/list-permissions/retrieve-permission/retrieve-permission.5.x.rb +++ b/sync/rest/list-permissions/retrieve-permission/retrieve-permission.5.x.rb @@ -11,6 +11,6 @@ response = service.sync_lists('MyFirstList') .sync_list_permissions('bob').fetch puts response -rescue Twilio::REST::TwilioError => err - puts err +rescue Twilio::REST::TwilioError => e + puts e end diff --git a/sync/rest/list-permissions/update-permission/update-permission.5.x.rb b/sync/rest/list-permissions/update-permission/update-permission.5.x.rb index 4815d6b6a7..97295f0741 100644 --- a/sync/rest/list-permissions/update-permission/update-permission.5.x.rb +++ b/sync/rest/list-permissions/update-permission/update-permission.5.x.rb @@ -12,6 +12,6 @@ .sync_list_permissions('bob') .update(read: true, write: true, manage: true) puts response -rescue Twilio::REST::TwilioError => err - puts err +rescue Twilio::REST::TwilioError => e + puts e end diff --git a/sync/rest/lists/create-list-item/create-list-item.5.x.rb b/sync/rest/lists/create-list-item/create-list-item.5.x.rb index 13405f9639..8ff19ceb2a 100644 --- a/sync/rest/lists/create-list-item/create-list-item.5.x.rb +++ b/sync/rest/lists/create-list-item/create-list-item.5.x.rb @@ -12,7 +12,7 @@ # Create a Sync List Item response = service.sync_lists('MyCollection').sync_list_items.create( data: "{ 'number': '001', 'name': 'Bulbasaur', 'attack':'49'}", - ttl: 864000 # expires in 10 days + ttl: 864_000 # expires in 10 days ) puts response diff --git a/sync/rest/lists/create-list/create-list.5.x.rb b/sync/rest/lists/create-list/create-list.5.x.rb index e89462c4dd..889af4fd6f 100644 --- a/sync/rest/lists/create-list/create-list.5.x.rb +++ b/sync/rest/lists/create-list/create-list.5.x.rb @@ -11,6 +11,6 @@ # Create a List response = service.sync_lists.create(unique_name: 'MyCollection', - ttl: 1814400) + ttl: 1_814_400) puts response diff --git a/sync/rest/lists/query-list/query-list.5.x.rb b/sync/rest/lists/query-list/query-list.5.x.rb index df43e20ced..8c29133146 100644 --- a/sync/rest/lists/query-list/query-list.5.x.rb +++ b/sync/rest/lists/query-list/query-list.5.x.rb @@ -11,7 +11,7 @@ # Query Sync List items = service.sync_lists('MyCollection').sync_list_items.stream( - from: '10', + from: '10', order: 'asc' ) diff --git a/sync/rest/lists/update-list/update-list.5.x.rb b/sync/rest/lists/update-list/update-list.5.x.rb index 759b503ac2..0c49b4bb7b 100644 --- a/sync/rest/lists/update-list/update-list.5.x.rb +++ b/sync/rest/lists/update-list/update-list.5.x.rb @@ -10,6 +10,6 @@ service = client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') # Update a List TTL, set to expires in 10 days -list = service.sync_lists('MyFirstList').update(ttl: 864000) +list = service.sync_lists('MyFirstList').update(ttl: 864_000) puts puts "SID: #{list.sid}, expires: #{list.date_expires}" diff --git a/sync/rest/map-permissions/delete-permission/delete-permission.5.x.rb b/sync/rest/map-permissions/delete-permission/delete-permission.5.x.rb index e4d65462a1..362e1d8b17 100644 --- a/sync/rest/map-permissions/delete-permission/delete-permission.5.x.rb +++ b/sync/rest/map-permissions/delete-permission/delete-permission.5.x.rb @@ -11,6 +11,6 @@ response = service.sync_maps('Players') .sync_map_permissions('bob').delete puts response -rescue Twilio::REST::TwilioError => err - puts err +rescue Twilio::REST::TwilioError => e + puts e end diff --git a/sync/rest/map-permissions/list-permissions/list-permissions.5.x.rb b/sync/rest/map-permissions/list-permissions/list-permissions.5.x.rb index cd0dd6a8c1..dfb10afa67 100644 --- a/sync/rest/map-permissions/list-permissions/list-permissions.5.x.rb +++ b/sync/rest/map-permissions/list-permissions/list-permissions.5.x.rb @@ -11,6 +11,6 @@ response = service.sync_maps('Players') .sync_map_permissions.list puts response -rescue Twilio::REST::TwilioError => err - puts err +rescue Twilio::REST::TwilioError => e + puts e end diff --git a/sync/rest/map-permissions/retrieve-permission/retrieve-permission.5.x.rb b/sync/rest/map-permissions/retrieve-permission/retrieve-permission.5.x.rb index 71c92df451..b1c5b0d87e 100644 --- a/sync/rest/map-permissions/retrieve-permission/retrieve-permission.5.x.rb +++ b/sync/rest/map-permissions/retrieve-permission/retrieve-permission.5.x.rb @@ -11,6 +11,6 @@ response = service.sync_maps('Players') .sync_map_permissions('bob').fetch puts response -rescue Twilio::REST::TwilioError => err - puts err +rescue Twilio::REST::TwilioError => e + puts e end diff --git a/sync/rest/map-permissions/update-permission/update-permission.5.x.rb b/sync/rest/map-permissions/update-permission/update-permission.5.x.rb index 946eb8b179..4034a28341 100644 --- a/sync/rest/map-permissions/update-permission/update-permission.5.x.rb +++ b/sync/rest/map-permissions/update-permission/update-permission.5.x.rb @@ -12,6 +12,6 @@ .sync_map_permissions('bob') .update(read: true, write: true, manage: true) puts response -rescue Twilio::REST::TwilioError => err - puts err +rescue Twilio::REST::TwilioError => e + puts e end diff --git a/sync/rest/maps/create-map-item/create-map-item.5.x.rb b/sync/rest/maps/create-map-item/create-map-item.5.x.rb index 3aaf127149..3f4c7beb66 100644 --- a/sync/rest/maps/create-map-item/create-map-item.5.x.rb +++ b/sync/rest/maps/create-map-item/create-map-item.5.x.rb @@ -11,9 +11,9 @@ # Create a Map Item response = service.sync_maps('Players').sync_map_items.create( - key: 'steph_curry', + key: 'steph_curry', data: "{ 'name': 'Stephen Curry', 'level': '30', 'username':'spicy_curry'}", - ttl: 864000 # expires in 10 days + ttl: 864_000 # expires in 10 days ) puts response diff --git a/sync/rest/maps/create-map/create-map.5.x.rb b/sync/rest/maps/create-map/create-map.5.x.rb index 094a288592..7e3cf16588 100644 --- a/sync/rest/maps/create-map/create-map.5.x.rb +++ b/sync/rest/maps/create-map/create-map.5.x.rb @@ -11,5 +11,5 @@ # Create a Maps group response = service.sync_maps.create(unique_name: 'Players', - ttl: 1814400) + ttl: 1_814_400) puts response diff --git a/sync/rest/maps/query-map/query-map.5.x.rb b/sync/rest/maps/query-map/query-map.5.x.rb index 967151b65d..c2c44dfcb2 100644 --- a/sync/rest/maps/query-map/query-map.5.x.rb +++ b/sync/rest/maps/query-map/query-map.5.x.rb @@ -11,7 +11,7 @@ # Query for a map item items = service.sync_maps('Players').sync_map_items.stream( - from: 'steph_curry', + from: 'steph_curry', order: 'asc' ) items.each do |map_item| diff --git a/sync/rest/maps/update-map/update-map.5.x.rb b/sync/rest/maps/update-map/update-map.5.x.rb index 13ed1f8685..11cf0ca516 100644 --- a/sync/rest/maps/update-map/update-map.5.x.rb +++ b/sync/rest/maps/update-map/update-map.5.x.rb @@ -10,6 +10,6 @@ service = client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') # Update a Map TTL, set to expires in 10 days -map = service.sync_maps('MyFirstList').update(ttl: 864000) +map = service.sync_maps('MyFirstList').update(ttl: 864_000) puts "SID: #{map.sid}, expires: #{map.date_expires}" diff --git a/sync/rest/services/create-service-webhook/create-service-webhook.5.x.rb b/sync/rest/services/create-service-webhook/create-service-webhook.5.x.rb index 4a2cf19e90..98a3c0b4f7 100644 --- a/sync/rest/services/create-service-webhook/create-service-webhook.5.x.rb +++ b/sync/rest/services/create-service-webhook/create-service-webhook.5.x.rb @@ -9,6 +9,6 @@ # Create the service service = client.sync.v1.services.create( friendly_name: 'MySyncServiceInstance', - webhook_url: 'https://example.com/sync' + webhook_url: 'https://example.com/sync' ) puts service diff --git a/sync/rest/streams/update-stream/update-stream.5.x.rb b/sync/rest/streams/update-stream/update-stream.5.x.rb index b8c9187d40..69b462b508 100644 --- a/sync/rest/streams/update-stream/update-stream.5.x.rb +++ b/sync/rest/streams/update-stream/update-stream.5.x.rb @@ -10,6 +10,6 @@ service = client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') # Update a Map TTL, set to expires in 10 days -stream = service.sync_streams('MyStream').update(ttl: 864000) +stream = service.sync_streams('MyStream').update(ttl: 864_000) puts "SID: #{stream.sid}, expires: #{stream.date_expires}" diff --git a/twiml/voice/connect/autopilot/connect-1.5.x.rb b/twiml/voice/connect/autopilot/connect-1.5.x.rb index ca4f30df15..08a16cf66e 100644 --- a/twiml/voice/connect/autopilot/connect-1.5.x.rb +++ b/twiml/voice/connect/autopilot/connect-1.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.connect do |connect| - connect.autopilot('UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') + connect.autopilot('UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') end puts response diff --git a/twiml/voice/connect/connect-1/connect-1.5.x.rb b/twiml/voice/connect/connect-1/connect-1.5.x.rb index aab58a1044..cb4ff727b8 100644 --- a/twiml/voice/connect/connect-1/connect-1.5.x.rb +++ b/twiml/voice/connect/connect-1/connect-1.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.connect do |connect| - connect.room('DailyStandup') + connect.room('DailyStandup') end puts response diff --git a/twiml/voice/connect/stream/connect_stream.5.x.rb b/twiml/voice/connect/stream/connect_stream.5.x.rb index 661ffc3143..f6c6b7bfcd 100644 --- a/twiml/voice/connect/stream/connect_stream.5.x.rb +++ b/twiml/voice/connect/stream/connect_stream.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.connect do |connect| - connect.stream(url: 'wss://mystream.ngrok.io/audiostream') + connect.stream(url: 'wss://mystream.ngrok.io/audiostream') end puts response diff --git a/twiml/voice/connect/virtualagent-1/virtualagent-1.5.x.rb b/twiml/voice/connect/virtualagent-1/virtualagent-1.5.x.rb index 4e7786e2d0..a9c1c0b25f 100644 --- a/twiml/voice/connect/virtualagent-1/virtualagent-1.5.x.rb +++ b/twiml/voice/connect/virtualagent-1/virtualagent-1.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.connect(action: 'https://myactionurl.com/twiml') do |connect| - connect.virtual_agent(connector_name: 'project', status_callback: 'https://mycallbackurl.com') + connect.virtual_agent(connector_name: 'project', status_callback: 'https://mycallbackurl.com') end puts response diff --git a/twiml/voice/connect/virtualagent-2/virtualagent-2.5.x.rb b/twiml/voice/connect/virtualagent-2/virtualagent-2.5.x.rb index b8f0b914f1..9b0d60394d 100644 --- a/twiml/voice/connect/virtualagent-2/virtualagent-2.5.x.rb +++ b/twiml/voice/connect/virtualagent-2/virtualagent-2.5.x.rb @@ -3,7 +3,7 @@ response = Twilio::TwiML::VoiceResponse.new response.say(message: 'Hello! You will be now be connected to a virtual agent.') response.connect(action: 'https://myactionurl.com/virtualagent_ended') do |connect| - connect.virtual_agent(connector_name: 'project', status_callback: 'https://mycallbackurl.com') + connect.virtual_agent(connector_name: 'project', status_callback: 'https://mycallbackurl.com') end puts response diff --git a/twiml/voice/connect/virtualagent-3/virtualagent-3.5.x.rb b/twiml/voice/connect/virtualagent-3/virtualagent-3.5.x.rb index e4d1dbee9c..79c915972e 100644 --- a/twiml/voice/connect/virtualagent-3/virtualagent-3.5.x.rb +++ b/twiml/voice/connect/virtualagent-3/virtualagent-3.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.connect do |connect| - connect.virtual_agent(connector_name: 'project', language: 'fr') + connect.virtual_agent(connector_name: 'project', language: 'fr') end puts response diff --git a/twiml/voice/connect/virtualagent-4/virtualagent-4.5.x.rb b/twiml/voice/connect/virtualagent-4/virtualagent-4.5.x.rb index a03ca62332..c36eb9a941 100644 --- a/twiml/voice/connect/virtualagent-4/virtualagent-4.5.x.rb +++ b/twiml/voice/connect/virtualagent-4/virtualagent-4.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.connect do |connect| - connect.virtual_agent(connector_name: 'project', sentiment_analysis: true) + connect.virtual_agent(connector_name: 'project', sentiment_analysis: true) end puts response diff --git a/twiml/voice/dial/dial-7/dial-7.5.x.rb b/twiml/voice/dial/dial-7/dial-7.5.x.rb index f7b42db9d8..7176b6f4e5 100644 --- a/twiml/voice/dial/dial-7/dial-7.5.x.rb +++ b/twiml/voice/dial/dial-7/dial-7.5.x.rb @@ -1,8 +1,9 @@ require 'twilio-ruby' response = Twilio::TwiML::VoiceResponse.new -response.dial(record: 'record-from-answer', recording_track: 'inbound', recording_status_callback: 'https://www.myexample.com/recording-handler') do |dial| - dial.number('+15551239876') +response.dial(record: 'record-from-answer', recording_track: 'inbound', + recording_status_callback: 'https://www.myexample.com/recording-handler') do |dial| + dial.number('+15551239876') end puts response diff --git a/twiml/voice/dial/dial-8/dial-8.5.x.rb b/twiml/voice/dial/dial-8/dial-8.5.x.rb index 61118c45ab..1463cd80a9 100644 --- a/twiml/voice/dial/dial-8/dial-8.5.x.rb +++ b/twiml/voice/dial/dial-8/dial-8.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.dial(refer_url: 'https://example.com/handler') do |dial| - dial.sip('sip:AgentA@xyz.sip.us1.twilio.com?User-to-User=123456789%3Bencoding%3Dhex&X-Name=Agent%2C+A') + dial.sip('sip:AgentA@xyz.sip.us1.twilio.com?User-to-User=123456789%3Bencoding%3Dhex&X-Name=Agent%2C+A') end puts response diff --git a/twiml/voice/dial/dial-9/dial-9.5.x.rb b/twiml/voice/dial/dial-9/dial-9.5.x.rb index e3f7197e2f..02d90a96fe 100644 --- a/twiml/voice/dial/dial-9/dial-9.5.x.rb +++ b/twiml/voice/dial/dial-9/dial-9.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.dial(answer_on_bridge: true, refer_url: 'https://example.com/handler') do |dial| - dial.sip('sip:AgentA@xyz.sip.us1.twilio.com?User-to-User=123456789%3Bencoding%3Dhex&X-Name=Agent%2C+A') + dial.sip('sip:AgentA@xyz.sip.us1.twilio.com?User-to-User=123456789%3Bencoding%3Dhex&X-Name=Agent%2C+A') end puts response diff --git a/twiml/voice/number/number-5/number-5.5.x.rb b/twiml/voice/number/number-5/number-5.5.x.rb index f6fa7b41e4..ef3ca6aa0b 100644 --- a/twiml/voice/number/number-5/number-5.5.x.rb +++ b/twiml/voice/number/number-5/number-5.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.dial do |dial| - dial.number('415-123-4567', url: 'http://example.com/agent_screen_call') + dial.number('415-123-4567', url: 'http://example.com/agent_screen_call') end puts response diff --git a/twiml/voice/parameter/parameter-1/parameter-5.x.rb b/twiml/voice/parameter/parameter-1/parameter-5.x.rb index 019362099f..e3cf1df9d4 100644 --- a/twiml/voice/parameter/parameter-1/parameter-5.x.rb +++ b/twiml/voice/parameter/parameter-1/parameter-5.x.rb @@ -2,11 +2,11 @@ response = Twilio::TwiML::VoiceResponse.new response.dial do |dial| - dial.client do |client| - client.identity('user_jane') - client.parameter(name: 'FirstName', value: 'Jane') - client.parameter(name: 'LastName', value: 'Doe') -end + dial.client do |client| + client.identity('user_jane') + client.parameter(name: 'FirstName', value: 'Jane') + client.parameter(name: 'LastName', value: 'Doe') + end end puts response diff --git a/twiml/voice/pay/pay-7/pay-7.5.x.rb b/twiml/voice/pay/pay-7/pay-7.5.x.rb index 6bae008ec0..189c1a055e 100644 --- a/twiml/voice/pay/pay-7/pay-7.5.x.rb +++ b/twiml/voice/pay/pay-7/pay-7.5.x.rb @@ -4,7 +4,8 @@ response.pay do |pay| pay.prompt(for: 'security-code', card_type: 'amex') do |prompt| prompt - .say(message: 'Please enter security code for your American Express card. It’s the 4 digits located on the front of your card') + .say(message: 'Please enter security code for your American Express card. '\ + 'It’s the 4 digits located on the front of your card') end end diff --git a/twiml/voice/refer/refer-1/refer-1.5.x.rb b/twiml/voice/refer/refer-1/refer-1.5.x.rb index 2d8ed283d1..d306093595 100644 --- a/twiml/voice/refer/refer-1/refer-1.5.x.rb +++ b/twiml/voice/refer/refer-1/refer-1.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.refer do |refer| - refer.sip('sip:alice@example.com') + refer.sip('sip:alice@example.com') end puts response diff --git a/twiml/voice/refer/refer-2/refer-2.5.x.rb b/twiml/voice/refer/refer-2/refer-2.5.x.rb index 4285dae60d..0c1c4ee941 100644 --- a/twiml/voice/refer/refer-2/refer-2.5.x.rb +++ b/twiml/voice/refer/refer-2/refer-2.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.refer do |refer| - refer.sip('sip:alice@example.com?X-AcctNumber=123456&X-ReasonForCalling=billing-question') + refer.sip('sip:alice@example.com?X-AcctNumber=123456&X-ReasonForCalling=billing-question') end puts response diff --git a/twiml/voice/refer/refer-3/refer-3.5.x.rb b/twiml/voice/refer/refer-3/refer-3.5.x.rb index 506f197e79..ba5582ba4f 100644 --- a/twiml/voice/refer/refer-3/refer-3.5.x.rb +++ b/twiml/voice/refer/refer-3/refer-3.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.refer do |refer| - refer.sip('sip:alice@example.com?User-to-User=123456789%3Bencoding%3Dhex') + refer.sip('sip:alice@example.com?User-to-User=123456789%3Bencoding%3Dhex') end puts response diff --git a/twiml/voice/refer/refer-4/refer-4.5.x.rb b/twiml/voice/refer/refer-4/refer-4.5.x.rb index 47aff6130f..b9d4504b8e 100644 --- a/twiml/voice/refer/refer-4/refer-4.5.x.rb +++ b/twiml/voice/refer/refer-4/refer-4.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.refer(action: '/handleRefer', method: 'POST') do |refer| - refer.sip('sip:alice@example.com') + refer.sip('sip:alice@example.com') end puts response diff --git a/twiml/voice/sip/sip-11/sip-11.5.x.rb b/twiml/voice/sip/sip-11/sip-11.5.x.rb index ca2e7ff352..db25e9a0ca 100644 --- a/twiml/voice/sip/sip-11/sip-11.5.x.rb +++ b/twiml/voice/sip/sip-11/sip-11.5.x.rb @@ -2,10 +2,10 @@ response = Twilio::TwiML::VoiceResponse.new response.dial do |dial| - dial.number('+12143211432') - dial.sip('sip:alice-soft-phone@example.com') - dial.sip('sip:alice-desk-phone@example.com') - dial.sip('sip:alice-mobile-client@example.com') + dial.number('+12143211432') + dial.sip('sip:alice-soft-phone@example.com') + dial.sip('sip:alice-desk-phone@example.com') + dial.sip('sip:alice-mobile-client@example.com') end puts response diff --git a/twiml/voice/sip/sip-9/sip-9.5.x.rb b/twiml/voice/sip/sip-9/sip-9.5.x.rb index b77f28acd7..c073c5520e 100644 --- a/twiml/voice/sip/sip-9/sip-9.5.x.rb +++ b/twiml/voice/sip/sip-9/sip-9.5.x.rb @@ -4,7 +4,7 @@ response.dial(record: 'record-from-answer', timeout: 10, hangup_on_star: true, caller_id: 'bob', method: 'POST', action: '/handle_post_dial') do |dial| dial.sip('sip:kate@example.com?x-customheader=foo', method: 'POST', - url: '/handle_screening_on_answer') + url: '/handle_screening_on_answer') end puts response diff --git a/twiml/voice/siprec/siprec-1/siprec-1.5.x.rb b/twiml/voice/siprec/siprec-1/siprec-1.5.x.rb index ef0667c794..ac0199daae 100644 --- a/twiml/voice/siprec/siprec-1/siprec-1.5.x.rb +++ b/twiml/voice/siprec/siprec-1/siprec-1.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.start do |start| - start.siprec(name: 'My SIPREC Stream', connector_name: 'Gridspace_1') + start.siprec(name: 'My SIPREC Stream', connector_name: 'Gridspace_1') end puts response diff --git a/twiml/voice/stream/stream-1/stream-1.5.x.rb b/twiml/voice/stream/stream-1/stream-1.5.x.rb index 0ab60531b2..99a33d2a9f 100644 --- a/twiml/voice/stream/stream-1/stream-1.5.x.rb +++ b/twiml/voice/stream/stream-1/stream-1.5.x.rb @@ -2,7 +2,7 @@ response = Twilio::TwiML::VoiceResponse.new response.start do |start| - start.stream(name: 'Example Audio Stream', url: 'wss://mystream.ngrok.io/audiostream') + start.stream(name: 'Example Audio Stream', url: 'wss://mystream.ngrok.io/audiostream') end puts response diff --git a/twiml/voice/stream/stream-2/stream-2.5.x.rb b/twiml/voice/stream/stream-2/stream-2.5.x.rb index 5f0d823f00..346e19acef 100644 --- a/twiml/voice/stream/stream-2/stream-2.5.x.rb +++ b/twiml/voice/stream/stream-2/stream-2.5.x.rb @@ -2,10 +2,10 @@ response = Twilio::TwiML::VoiceResponse.new response.start do |start| - start.stream(url: 'wss://mystream.ngrok.io/example') do |stream| - stream.parameter(name: 'FirstName', value: 'Jane') - stream.parameter(name: 'LastName', value: 'Doe') -end + start.stream(url: 'wss://mystream.ngrok.io/example') do |stream| + stream.parameter(name: 'FirstName', value: 'Jane') + stream.parameter(name: 'LastName', value: 'Doe') + end end puts response diff --git a/two-factor-authentication/verify-webhook/verify-webhook.5.x.rb b/two-factor-authentication/verify-webhook/verify-webhook.5.x.rb index aa7037adaf..5f23154ad6 100644 --- a/two-factor-authentication/verify-webhook/verify-webhook.5.x.rb +++ b/two-factor-authentication/verify-webhook/verify-webhook.5.x.rb @@ -1,12 +1,12 @@ require 'uri' +# rubocop:disable Style/Documentation class CallbackVerifier - # @param [request] A Rails request object # @param [api_key] The API key used to sign the request # @return [boolean] True if verified def verify_callback(request, api_key) - url = url_for(:only_path => false, :overwrite_params=>nil) + url = url_for(only_path: false, overwrite_params: nil) # Sort and join the parameters on Rails json_params = JSON.parse(request.body.read) @@ -30,3 +30,4 @@ def verify_callback(request, api_key) hash == signature end end +# rubocop:enable Style/Documentation diff --git a/verify/verifications/approve-verification/approve-verification.5.x.rb b/verify/verifications/approve-verification/approve-verification.5.x.rb index b12931f0ac..6fbdaf8646 100644 --- a/verify/verifications/approve-verification/approve-verification.5.x.rb +++ b/verify/verifications/approve-verification/approve-verification.5.x.rb @@ -14,4 +14,4 @@ .verifications('+15017122661') .update(status: 'approved') -puts verification.to \ No newline at end of file +puts verification.to diff --git a/video/rest/compositionhooks/audio-mixing-hook/audio-mixing-hook.5.x.rb b/video/rest/compositionhooks/audio-mixing-hook/audio-mixing-hook.5.x.rb index e1d2751921..750478904c 100644 --- a/video/rest/compositionhooks/audio-mixing-hook/audio-mixing-hook.5.x.rb +++ b/video/rest/compositionhooks/audio-mixing-hook/audio-mixing-hook.5.x.rb @@ -9,11 +9,11 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) -compositionHook = @client.video.compositionHooks.create( +composition_hook = @client.video.compositionHooks.create( friendlyName: 'MixingAllRoomAudiosHook', audio_sources: '*', status_callback: 'http://my.server.org/callbacks', format: 'mp4' ) -puts compositionHook.sid +puts composition_hook.sid diff --git a/video/rest/compositionhooks/complex-layout-hook/complex-layout-hook.5.x.rb b/video/rest/compositionhooks/complex-layout-hook/complex-layout-hook.5.x.rb index 7bba0dd88e..4ce26fca44 100644 --- a/video/rest/compositionhooks/complex-layout-hook/complex-layout-hook.5.x.rb +++ b/video/rest/compositionhooks/complex-layout-hook/complex-layout-hook.5.x.rb @@ -9,9 +9,9 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) -compositionHook = @client.video.compositionHooks.create( +composition_hook = @client.video.compositionHooks.create( friendlyName: 'MyHookWithComplexVideoLayout', - audio_sources: ['listener-audio','presenter-audio'], + audio_sources: %w[listener-audio presenter-audio], video_layout: { main: { z_pos: 1, @@ -31,4 +31,4 @@ format: 'mp4' ) -puts compositionHook.sid +puts composition_hook.sid diff --git a/video/rest/compositionhooks/delete-hook/delete-hook.5.x.rb b/video/rest/compositionhooks/delete-hook/delete-hook.5.x.rb index 7bff58d855..5541f0c2c7 100644 --- a/video/rest/compositionhooks/delete-hook/delete-hook.5.x.rb +++ b/video/rest/compositionhooks/delete-hook/delete-hook.5.x.rb @@ -10,6 +10,6 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) deleted = @client.video.compositionHooks(HKXXXX) - .delete() + .delete puts deleted diff --git a/video/rest/compositionhooks/get-hook/get-hook.5.x.rb b/video/rest/compositionhooks/get-hook/get-hook.5.x.rb index 80e6dccfcf..b9a12e0c36 100644 --- a/video/rest/compositionhooks/get-hook/get-hook.5.x.rb +++ b/video/rest/compositionhooks/get-hook/get-hook.5.x.rb @@ -1,4 +1,4 @@ -#Download the helper library from https://www.twilio.com/docs/ruby/install +# Download the helper library from https://www.twilio.com/docs/ruby/install require 'rubygems' require 'twilio-ruby' @@ -9,7 +9,7 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) -compositionHook = @client.video.compositionHooks(HKXXXX) - .fetch() +composition_hook = @client.video.compositionHooks(HKXXXX) + .fetch -puts compositionHook.sid +puts composition_hook.sid diff --git a/video/rest/compositionhooks/grid-mixing-hook/grid-mixing-hook.5.x.rb b/video/rest/compositionhooks/grid-mixing-hook/grid-mixing-hook.5.x.rb index 11272a182b..6e2db17dc7 100644 --- a/video/rest/compositionhooks/grid-mixing-hook/grid-mixing-hook.5.x.rb +++ b/video/rest/compositionhooks/grid-mixing-hook/grid-mixing-hook.5.x.rb @@ -9,7 +9,7 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) -compositionHook = @client.video.compositionHooks.create( +composition_hook = @client.video.compositionHooks.create( friendlyName: 'MyFirstCompositionHook', audio_sources: '*', video_layout: { @@ -21,4 +21,4 @@ format: 'mp4' ) -puts compositionHook.sid +puts composition_hook.sid diff --git a/video/rest/compositionhooks/list-hooks/list-hooks.5.x.rb b/video/rest/compositionhooks/list-hooks/list-hooks.5.x.rb index 9ab80d2d63..a3c0fc10e4 100644 --- a/video/rest/compositionhooks/list-hooks/list-hooks.5.x.rb +++ b/video/rest/compositionhooks/list-hooks/list-hooks.5.x.rb @@ -10,9 +10,9 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) hooks = @client.video.compositionHooks - .list( - enabled: true - ) + .list( + enabled: true + ) hooks.each do |hook| puts hook.sid diff --git a/video/rest/compositionhooks/update-hook/update-hook.5.x.rb b/video/rest/compositionhooks/update-hook/update-hook.5.x.rb index cd82ba2958..98b7e1cbb4 100644 --- a/video/rest/compositionhooks/update-hook/update-hook.5.x.rb +++ b/video/rest/compositionhooks/update-hook/update-hook.5.x.rb @@ -9,7 +9,7 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) -compositionHook = @client.video.compositionHooks('HKXXXX').update( +composition_hook = @client.video.compositionHooks('HKXXXX').update( friendlyName: 'MyFirstCompositionHook', enabled: false, audio_sources: '*', @@ -22,4 +22,4 @@ format: 'mp4' ) -puts compositionHook.sid +puts composition_hook.sid diff --git a/video/rest/compositions/compose-chess/compose-chess.5.x.rb b/video/rest/compositions/compose-chess/compose-chess.5.x.rb index f3f9f701c5..7aa5ed95b1 100644 --- a/video/rest/compositions/compose-chess/compose-chess.5.x.rb +++ b/video/rest/compositions/compose-chess/compose-chess.5.x.rb @@ -21,7 +21,7 @@ max_rows: 3, max_columns: 3, reuse: 'show_newest', - cells_excluded: [1,3,5,7], + cells_excluded: [1, 3, 5, 7], video_sources: ['*'] } }, diff --git a/video/rest/compositions/compose-main-with-row/compose-main-with-row.5.x.rb b/video/rest/compositions/compose-main-with-row/compose-main-with-row.5.x.rb index 3d572f2b4a..881a4a9402 100644 --- a/video/rest/compositions/compose-main-with-row/compose-main-with-row.5.x.rb +++ b/video/rest/compositions/compose-main-with-row/compose-main-with-row.5.x.rb @@ -24,7 +24,7 @@ width: 1260, height: 160, max_rows: 1, - video_sources: ['*'] + video_sources: ['*'], video_sources_excluded: ['teacher-screen-video'] } }, diff --git a/video/rest/compositions/compose-pip/compose-pip.5.x.rb b/video/rest/compositions/compose-pip/compose-pip.5.x.rb index 076b1ffa0f..bba4ab9267 100644 --- a/video/rest/compositions/compose-pip/compose-pip.5.x.rb +++ b/video/rest/compositions/compose-pip/compose-pip.5.x.rb @@ -11,7 +11,7 @@ composition = @client.video.compositions.create( room_sid: 'RMXXXX', - audio_sources: ['MTAAAA','soundtrack'], + audio_sources: %w[MTAAAA soundtrack], video_layout: { main: { z_pos: 1, diff --git a/video/rest/compositions/compose-set-as-row/compose-set-as-row.5.x.rb b/video/rest/compositions/compose-set-as-row/compose-set-as-row.5.x.rb index df20ac86ba..df6d2a871c 100644 --- a/video/rest/compositions/compose-set-as-row/compose-set-as-row.5.x.rb +++ b/video/rest/compositions/compose-set-as-row/compose-set-as-row.5.x.rb @@ -13,10 +13,10 @@ room_sid: 'RMXXXX', video_layout: { grid: { - video_sources: [ - "RTAAAA", - "MTBBBB", - "teacher-webcast" + video_sources: %w[ + RTAAAA + MTBBBB + teacher-webcast ] } }, diff --git a/video/rest/compositions/delete-composition/delete-composition.5.x.rb b/video/rest/compositions/delete-composition/delete-composition.5.x.rb index f877e931d9..dbfff19651 100644 --- a/video/rest/compositions/delete-composition/delete-composition.5.x.rb +++ b/video/rest/compositions/delete-composition/delete-composition.5.x.rb @@ -10,6 +10,6 @@ @client = Twilio::REST::Client.new(api_key_sid, api_key_secret) deleted = @client.video.compositions(CJXXXX) - .delete() + .delete puts deleted From 36abf8872d368e9f900a43f9a7ba75a75c5cc7b3 Mon Sep 17 00:00:00 2001 From: Alexis Crespo Date: Thu, 9 Dec 2021 14:08:32 -0500 Subject: [PATCH 4/7] Fix several ruby styling issues --- .../lookup-get-basic-example-1.5.x.rb | 2 +- .../twiml-gather-record.5.x.rb | 5 ++- .../signature_validation_tests.5.x.rb | 38 ++++++++++--------- twiml/voice/pay/pay-9/pay-9.5.x.rb | 3 +- .../retrieve-participants-connected.rb | 8 ++-- .../recording-rules-start-all.5.x.rb | 3 +- 6 files changed, 31 insertions(+), 28 deletions(-) diff --git a/lookups/lookup-get-basic-example-1/lookup-get-basic-example-1.5.x.rb b/lookups/lookup-get-basic-example-1/lookup-get-basic-example-1.5.x.rb index 2c73f3a0d3..2f23617e61 100644 --- a/lookups/lookup-get-basic-example-1/lookup-get-basic-example-1.5.x.rb +++ b/lookups/lookup-get-basic-example-1/lookup-get-basic-example-1.5.x.rb @@ -13,7 +13,7 @@ puts number.carrier['type'] puts number.carrier['name'] rescue Twilio::REST::RestError => e - if e.status_code === 404 + if e.status_code === 404 # rubocop:disable Style/CaseEquality puts 'No carrier information' else puts e.message diff --git a/rest/voice/generate-twiml-gather-input/twiml-gather-record.5.x.rb b/rest/voice/generate-twiml-gather-input/twiml-gather-record.5.x.rb index 9bbe7d9560..229cfa8323 100644 --- a/rest/voice/generate-twiml-gather-input/twiml-gather-record.5.x.rb +++ b/rest/voice/generate-twiml-gather-input/twiml-gather-record.5.x.rb @@ -4,12 +4,13 @@ get '/voice/handle-gather' do redirect '/voice' unless %w[1 2].include?(params['Digits']) - if params['Digits'] == '1' + case params['Digits'] + when '1' response = Twilio::TwiML::Response.new do |r| r.Dial '+13105551212' r.Say 'The call failed or the remote party hung up. Goodbye.' end - elsif params['Digits'] == '2' + when '2' response = Twilio::TwiML::Response.new do |r| r.Say 'Record your message after the tone.' r.Record maxLength: '30', action: '/voice/handle-record', method: 'get' diff --git a/security/signature_validation_tests/signature_validation_tests.5.x.rb b/security/signature_validation_tests/signature_validation_tests.5.x.rb index 070d46dae7..a48d9629b7 100644 --- a/security/signature_validation_tests/signature_validation_tests.5.x.rb +++ b/security/signature_validation_tests/signature_validation_tests.5.x.rb @@ -11,30 +11,32 @@ url = 'https://mycompany.com/myapp' params = { 'CallSid' => 'CA1234567890ABCDE', - 'Caller' => '+12349013030', - 'Digits' => '1234', - 'From' => '+12349013030', - 'To' => '+18005551212' + 'Caller' => '+12349013030', + 'Digits' => '1234', + 'From' => '+12349013030', + 'To' => '+18005551212' } +# rubocop:disable Metrics/MethodLength def test_url(method, url, params, valid) - if method == 'GET' - url += '?' + URI.encode_www_form(params) - params = {} - end + if method == 'GET' + url += '?' + URI.encode_www_form(params) + params = {} + end - signature = @validator.build_signature_for(valid ? url : "http://invalid.com", params) - headers = {'X-Twilio-Signature': signature} - if method == 'GET' - response = HTTParty.get(url, headers: headers) - else - response = HTTParty.post(url, body: params, headers: headers) - end - valid_str = valid ? 'valid' : 'invalid' - puts "HTTP #{method} with #{valid_str} signature returned #{response.code}" + signature = @validator.build_signature_for(valid ? url : 'http://invalid.com', params) + headers = { 'X-Twilio-Signature': signature } + response = if method == 'GET' + HTTParty.get(url, headers: headers) + else + HTTParty.post(url, body: params, headers: headers) + end + valid_str = valid ? 'valid' : 'invalid' + puts "HTTP #{method} with #{valid_str} signature returned #{response.code}" end +# rubocop:enable Metrics/MethodLength test_url('GET', url, params, true) test_url('GET', url, params, false) test_url('POST', url, params, true) -test_url('POST', url, params, false) \ No newline at end of file +test_url('POST', url, params, false) diff --git a/twiml/voice/pay/pay-9/pay-9.5.x.rb b/twiml/voice/pay/pay-9/pay-9.5.x.rb index 0635fd4a17..fad816e699 100644 --- a/twiml/voice/pay/pay-9/pay-9.5.x.rb +++ b/twiml/voice/pay/pay-9/pay-9.5.x.rb @@ -8,7 +8,8 @@ end pay.prompt(for: 'expiration-date', attempt: '2 3') do |prompt2| prompt2 - .say(message: 'Please enter your expiration date, two digits for the month and two digits for the year. For example, if your expiration date is March 2022, then please enter 0 3 2 2') + .say(message: 'Please enter your expiration date, two digits for the month and two digits for the year. '\ + 'For example, if your expiration date is March 2022, then please enter 0 3 2 2') end end diff --git a/video/rest/rooms/participants/retrieve-participant-list-connected/retrieve-participants-connected.rb b/video/rest/rooms/participants/retrieve-participant-list-connected/retrieve-participants-connected.rb index f3abae9a19..0a0c6a3f4c 100644 --- a/video/rest/rooms/participants/retrieve-participant-list-connected/retrieve-participants-connected.rb +++ b/video/rest/rooms/participants/retrieve-participant-list-connected/retrieve-participants-connected.rb @@ -8,7 +8,7 @@ client = Twilio::REST::Client.new api_key_sid, api_key_secret -participants = client.video.rooms('RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .participants.list(status: 'connected').each do |participant| - puts participant.sid - end +client.video.rooms('RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') + .participants.list(status: 'connected').each do |participant| + puts participant.sid +end diff --git a/video/rest/rooms/recording-rules-start-all/recording-rules-start-all.5.x.rb b/video/rest/rooms/recording-rules-start-all/recording-rules-start-all.5.x.rb index e7e908cead..49aa1bd02f 100644 --- a/video/rest/rooms/recording-rules-start-all/recording-rules-start-all.5.x.rb +++ b/video/rest/rooms/recording-rules-start-all/recording-rules-start-all.5.x.rb @@ -11,7 +11,6 @@ recording_rules = @client.video .rooms('RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') .recording_rules - .update(rules: [{"type": :"include", "all": true}]) + .update(rules: [{ "type": :include, "all": true }]) puts recording_rules.room_sid - From 6bdef25507cfbba779ba2b015c00830bb50d948d Mon Sep 17 00:00:00 2001 From: Alexis Crespo Date: Thu, 9 Dec 2021 14:48:55 -0500 Subject: [PATCH 5/7] Fix several ruby styling issues --- rest/voice/generate-twiml-record/twiml-record.5.x.rb | 5 +++-- .../signature_validation_tests.5.x.rb | 2 +- .../get-composition-media-file.5.x.rb | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/rest/voice/generate-twiml-record/twiml-record.5.x.rb b/rest/voice/generate-twiml-record/twiml-record.5.x.rb index d960077ec6..70229093f9 100644 --- a/rest/voice/generate-twiml-record/twiml-record.5.x.rb +++ b/rest/voice/generate-twiml-record/twiml-record.5.x.rb @@ -20,12 +20,13 @@ get voice_gather do redirect voice_endpoint unless %w[1 2].include?(params['Digits']) - if params['Digits'] == '1' + case params['Digits'] + when '1' response = Twilio::TwiML::Response.new do |r| r.Dial '+13105551212' r.Say 'The call failed or the remote party hung up. Goodbye.' end - elsif params['Digits'] == '2' + when '2' response = Twilio::TwiML::Response.new do |r| r.Say 'Record your message after the tone.' r.Record maxLength: '30', action: voice_record, method: 'get' diff --git a/security/signature_validation_tests/signature_validation_tests.5.x.rb b/security/signature_validation_tests/signature_validation_tests.5.x.rb index a48d9629b7..620e82fceb 100644 --- a/security/signature_validation_tests/signature_validation_tests.5.x.rb +++ b/security/signature_validation_tests/signature_validation_tests.5.x.rb @@ -20,7 +20,7 @@ # rubocop:disable Metrics/MethodLength def test_url(method, url, params, valid) if method == 'GET' - url += '?' + URI.encode_www_form(params) + url += "?#{URI.encode_www_form(params)}" params = {} end diff --git a/video/rest/compositions/get-composition-media-file/get-composition-media-file.5.x.rb b/video/rest/compositions/get-composition-media-file/get-composition-media-file.5.x.rb index 0369d6b995..5b7bd7fd45 100644 --- a/video/rest/compositions/get-composition-media-file/get-composition-media-file.5.x.rb +++ b/video/rest/compositions/get-composition-media-file/get-composition-media-file.5.x.rb @@ -19,5 +19,5 @@ media_location = response.body['redirect_to'] # For example, write the composition media to a local file open('myFile.mp4', 'wb') do |file| - file << open(media_location).read + file << File.open(media_location).read end From 523e1698e3bd45ace838115a92a228738c3fcafa Mon Sep 17 00:00:00 2001 From: Alexis Crespo Date: Mon, 13 Dec 2021 15:36:16 -0500 Subject: [PATCH 6/7] Change download file example code --- .../get-composition-media-file.5.x.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/video/rest/compositions/get-composition-media-file/get-composition-media-file.5.x.rb b/video/rest/compositions/get-composition-media-file/get-composition-media-file.5.x.rb index 5b7bd7fd45..62b2839f94 100644 --- a/video/rest/compositions/get-composition-media-file/get-composition-media-file.5.x.rb +++ b/video/rest/compositions/get-composition-media-file/get-composition-media-file.5.x.rb @@ -1,7 +1,6 @@ # Download the helper library from https://www.twilio.com/docs/ruby/install require 'twilio-ruby' require 'net/http' -require 'open-uri' # Find your credentials at twilio.com/console # To set up environmental variables, see http://twil.io/secure @@ -18,6 +17,8 @@ media_location = response.body['redirect_to'] # For example, write the composition media to a local file +response = Net::HTTP.get_response(URI.parse(media_location)) + open('myFile.mp4', 'wb') do |file| - file << File.open(media_location).read + file.write(response.body) end From 4ed1f787818408e5de0030d485c229aa446d444b Mon Sep 17 00:00:00 2001 From: Alexis Crespo Date: Wed, 5 Jan 2022 16:45:55 -0500 Subject: [PATCH 7/7] Remove rubocop method length verification --- .rubocop.yml | 2 ++ .../lookup-get-basic-example-1.5.x.rb | 2 +- .../signature_validation_tests.5.x.rb | 2 -- two-factor-authentication/verify-webhook/verify-webhook.5.x.rb | 3 +-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 3b861fb0df..fa5a50650e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -11,3 +11,5 @@ Style/FrozenStringLiteralComment: Enabled: false Metrics/BlockLength: Enabled: false +Metrics/MethodLength: + Enabled: false diff --git a/lookups/lookup-get-basic-example-1/lookup-get-basic-example-1.5.x.rb b/lookups/lookup-get-basic-example-1/lookup-get-basic-example-1.5.x.rb index 2f23617e61..2144d7eb7d 100644 --- a/lookups/lookup-get-basic-example-1/lookup-get-basic-example-1.5.x.rb +++ b/lookups/lookup-get-basic-example-1/lookup-get-basic-example-1.5.x.rb @@ -13,7 +13,7 @@ puts number.carrier['type'] puts number.carrier['name'] rescue Twilio::REST::RestError => e - if e.status_code === 404 # rubocop:disable Style/CaseEquality + if e.status_code == 404 puts 'No carrier information' else puts e.message diff --git a/security/signature_validation_tests/signature_validation_tests.5.x.rb b/security/signature_validation_tests/signature_validation_tests.5.x.rb index 620e82fceb..59e321ed1e 100644 --- a/security/signature_validation_tests/signature_validation_tests.5.x.rb +++ b/security/signature_validation_tests/signature_validation_tests.5.x.rb @@ -17,7 +17,6 @@ 'To' => '+18005551212' } -# rubocop:disable Metrics/MethodLength def test_url(method, url, params, valid) if method == 'GET' url += "?#{URI.encode_www_form(params)}" @@ -34,7 +33,6 @@ def test_url(method, url, params, valid) valid_str = valid ? 'valid' : 'invalid' puts "HTTP #{method} with #{valid_str} signature returned #{response.code}" end -# rubocop:enable Metrics/MethodLength test_url('GET', url, params, true) test_url('GET', url, params, false) diff --git a/two-factor-authentication/verify-webhook/verify-webhook.5.x.rb b/two-factor-authentication/verify-webhook/verify-webhook.5.x.rb index 5f23154ad6..11f8017949 100644 --- a/two-factor-authentication/verify-webhook/verify-webhook.5.x.rb +++ b/two-factor-authentication/verify-webhook/verify-webhook.5.x.rb @@ -1,6 +1,6 @@ require 'uri' -# rubocop:disable Style/Documentation +# Class to verify an Incoming Two-factor Authentication Webhook class CallbackVerifier # @param [request] A Rails request object # @param [api_key] The API key used to sign the request @@ -30,4 +30,3 @@ def verify_callback(request, api_key) hash == signature end end -# rubocop:enable Style/Documentation