Skip to content

Commit 15215d0

Browse files
committed
Implement Ruby samples for messaging services
1 parent 54c36d6 commit 15215d0

File tree

21 files changed

+297
-3
lines changed

21 files changed

+297
-3
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Get twilio-ruby from twilio.com/docs/libraries/ruby
2+
require 'twilio-ruby'
3+
4+
# Get your Account SID and Auth Token from twilio.com/console
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
8+
# Initialize Twilio Client
9+
@client = Twilio::REST::Client.new(account_sid, auth_token)
10+
11+
@alpha_sender = @client.messaging.v1
12+
.services('MG2172dd2db502e20dd981ef0d67850e1a')
13+
.alpha_senders
14+
.create(alpha_sender: 'My Company')
15+
16+
puts @alpha_sender.sid

messaging/services/service-alpha-delete/service-alpha-delete.5.x.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
$auth_token = 'your_auth_token'
99
$twilio = new Twilio($account_sid, $auth_token);
1010

11-
$alphaSenders = $twilio->messaging->v1->services("MG2172dd2db502e20dd981ef0d67850e1a")
11+
$alpha_senders = $twilio->messaging->v1->services("MG2172dd2db502e20dd981ef0d67850e1a")
1212
->alphaSenders("AIc781610ec0b3400c9e0cab8e757da937")->delete();
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Get twilio-ruby from twilio.com/docs/libraries/ruby
2+
require 'twilio-ruby'
3+
4+
# Get your Account SID and Auth Token from twilio.com/console
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
8+
# Initialize Twilio Client
9+
@client = Twilio::REST::Client.new(account_sid, auth_token)
10+
11+
@deleted = @client.messaging.v1
12+
.services('MG2172dd2db502e20dd981ef0d67850e1a')
13+
.alpha_senders('AIc781610ec0b3400c9e0cab8e757da937')
14+
.delete
15+
16+
puts @deleted
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Get twilio-ruby from twilio.com/docs/libraries/ruby
2+
require 'twilio-ruby'
3+
4+
# Get your Account SID and Auth Token from twilio.com/console
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
8+
# Initialize Twilio Client
9+
@client = Twilio::REST::Client.new(account_sid, auth_token)
10+
11+
@alpha_sender = @client.messaging.v1
12+
.services('MG2172dd2db502e20dd981ef0d67850e1a')
13+
.alpha_senders('AIc781610ec0b3400c9e0cab8e757da937')
14+
.fetch
15+
16+
puts @alpha_sender.url
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Get twilio-ruby from twilio.com/docs/libraries/ruby
2+
require 'twilio-ruby'
3+
4+
# Get your Account SID and Auth Token from twilio.com/console
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
8+
# Initialize Twilio Client
9+
@client = Twilio::REST::Client.new(account_sid, auth_token)
10+
11+
@alpha_senders = @client.messaging.v1
12+
.services('MG2172dd2db502e20dd981ef0d67850e1a')
13+
.alpha_senders.list
14+
15+
@alpha_senders.each do |alpha_sender|
16+
puts alpha_sender.url
17+
end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Get twilio-ruby from twilio.com/docs/libraries/ruby
2+
require 'twilio-ruby'
3+
4+
# Get your Account SID and Auth Token from twilio.com/console
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
8+
# Initialize Twilio Client
9+
@client = Twilio::REST::Client.new(account_sid, auth_token)
10+
11+
@service = @client.messaging.v1
12+
.services
13+
.create(
14+
friendly_name: 'My First Service',
15+
status_callback: 'http://requestb.in/1234abcd')
16+
17+
puts @service.sid
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Get twilio-ruby from twilio.com/docs/libraries/ruby
2+
require 'twilio-ruby'
3+
4+
# Get your Account SID and Auth Token from twilio.com/console
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
8+
# Initialize Twilio Client
9+
@client = Twilio::REST::Client.new(account_sid, auth_token)
10+
11+
@deleted = @client.messaging.v1
12+
.services('MG2172dd2db502e20dd981ef0d67850e1a')
13+
.delete
14+
15+
puts @deleted
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Get twilio-ruby from twilio.com/docs/libraries/ruby
2+
require 'twilio-ruby'
3+
4+
# Get your Account SID and Auth Token from twilio.com/console
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
8+
# Initialize Twilio Client
9+
@client = Twilio::REST::Client.new(account_sid, auth_token)
10+
11+
@service = @client.messaging.v1
12+
.services('MG2172dd2db502e20dd981ef0d67850e1a')
13+
.fetch
14+
15+
puts @service.friendly_name
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Get twilio-ruby from twilio.com/docs/libraries/ruby
2+
require 'twilio-ruby'
3+
4+
# Get your Account SID and Auth Token from twilio.com/console
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
8+
# Initialize Twilio Client
9+
@client = Twilio::REST::Client.new(account_sid, auth_token)
10+
11+
@services = @client.messaging.v1.services.list
12+
13+
@services.each do |service|
14+
puts service.friendly_name
15+
end

messaging/services/service-multiple-number-add/service-multiple-number-add-1.3.x.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const phoneNumbers = ['PN2a0747eba6abf96b7e3c3ff0b4530f6e',
1111
'PN2a0747eba6abf96b7e3c3ff0b4530f6e'];
1212

1313
phoneNumbers.forEach((phoneNumber) => {
14-
service.phoneNumbers.create({phoneNumberSid: 'PN557ce644e5ab84fa21cc21112e22c485'})
14+
service.phoneNumbers.create({phoneNumberSid: phoneNumber})
1515
.then(function(response) {
1616
console.log(response);
1717
}).catch(function(error) {

0 commit comments

Comments
 (0)