-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo_sms_mt.rb
50 lines (35 loc) · 1.37 KB
/
demo_sms_mt.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#
# BlueVia is a global iniciative of Telefonica delivered by Movistar and O2.
# Please, check out www.bluevia.com and if you need more information
# contact us at mailto:support@bluevia.com
#
$:.unshift File.join(File.dirname(__FILE__),'..','lib')
require 'bluevia'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
#
# (c) Bluevia (mailto:support@bluevia.com)
#
class DemoSmsMt
include Bluevia
begin
consumer_key= "vw12012654505986"
consumer_secret= "WpOl66570544"
mode= BVMode::SANDBOX
token= "ad3f0f598ffbc660fbad9035122eae74"
token_secret= "4340b28da39ec36acb4a205d3955a853"
# To create Bluevia client
@bc = BVMtSms.new(mode, consumer_key, consumer_secret, token, token_secret)
# Sandbox environment only complains about this param if it's a known short number
short_number = "1234"
sms_special_keyword = "SANDBLUEDEMOS"
sms_content= "The Bluevia APIs make it easy for your application to access our network services."
# Message sending
message_id = @bc.send(short_number, "#{sms_special_keyword} #{sms_content}")
p "Info returned from 'send' command: " + message_id
# To get delivery status of the message
infostatus = @bc.get_delivery_status(message_id)
puts infostatus.inspect
rescue StandardError => e
puts "received Exception: #{e}" #do whatever
end
end