Module: HellioMessaging
- Defined in:
- lib/helliomessaging_sms.rb,
lib/helliomessaging_sms/version.rb
Constant Summary collapse
- VERSION =
"1.1.0"- @@api_username =
nil- @@api_password =
nil- @@api_comsumer_key =
nil- @@api_application_secret =
nil- @@api_senderid =
"HELLIOAPI"
Class Method Summary collapse
- .api_application_secret ⇒ Object
- .api_application_secret=(api_application_secret) ⇒ Object
- .api_consumer_key ⇒ Object
- .api_consumer_key=(api_consumer_key) ⇒ Object
- .api_password ⇒ Object
- .api_password=(api_password) ⇒ Object
- .api_senderid ⇒ Object
- .api_senderid=(api_senderid) ⇒ Object
- .api_username ⇒ Object
- .api_username=(api_username) ⇒ Object
-
.push(options = {}) ⇒ Object
Expects :msg, :to and an optional :from param The :from param defaults to @@api_senderid when its omitted.
Class Method Details
.api_application_secret ⇒ Object
67 |
# File 'lib/helliomessaging_sms.rb', line 67 def self.api_application_secret; @@api_application_secret; end |
.api_application_secret=(api_application_secret) ⇒ Object
66 |
# File 'lib/helliomessaging_sms.rb', line 66 def self.api_application_secret=(api_application_secret); @@api_application_secret = api_application_secret; end |
.api_consumer_key ⇒ Object
64 |
# File 'lib/helliomessaging_sms.rb', line 64 def self.api_consumer_key; @@api_consumer_key; end |
.api_consumer_key=(api_consumer_key) ⇒ Object
63 |
# File 'lib/helliomessaging_sms.rb', line 63 def self.api_consumer_key=(api_consumer_key); @@api_consumer_key = api_consumer_key; end |
.api_password ⇒ Object
61 |
# File 'lib/helliomessaging_sms.rb', line 61 def self.api_password; @@api_password; end |
.api_password=(api_password) ⇒ Object
60 |
# File 'lib/helliomessaging_sms.rb', line 60 def self.api_password=(api_password); @@api_password = api_password; end |
.api_senderid ⇒ Object
70 |
# File 'lib/helliomessaging_sms.rb', line 70 def self.api_senderid; @@api_senderid; end |
.api_senderid=(api_senderid) ⇒ Object
69 |
# File 'lib/helliomessaging_sms.rb', line 69 def self.api_senderid=(api_senderid); @@api_senderid = api_senderid; end |
.api_username ⇒ Object
58 |
# File 'lib/helliomessaging_sms.rb', line 58 def self.api_username; @@api_username; end |
.api_username=(api_username) ⇒ Object
57 |
# File 'lib/helliomessaging_sms.rb', line 57 def self.api_username=(api_username); @@api_username = api_username; end |
.push(options = {}) ⇒ Object
Expects :msg, :to and an optional :from param The :from param defaults to @@api_senderid when its omitted
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 51 52 53 54 |
# File 'lib/helliomessaging_sms.rb', line 15 def self.push(={}) sender_id = [:from].nil? ? @@api_senderid : [:from] response = nil = [:msg] raise ArgumentError, ':msg and :to params expected' if .nil? || [:to].nil? = Nokogiri::HTML.parse().text # Send SMS Using the old form of Authentication [Username and Password] if @@api_username != nil && @@api_password != nil response = CurbFu.get({:host => 'app.helliomessaging.com/api', :path => '/sms?'}, { :from => sender_id, :to => [:to], :text => , :username => @@api_username, :password => @@api_password }) end # Send SMS Using the new form of Authentication [Consumer ID and an Application Serect] if @@api_consumer_key != nil && @@api_application_secret != nil response = CurbFu.get({:host => 'app.helliomessaging.com/api', :path => '/sms?', :protocol => 'http'}, { :From => sender_id, :To => [:to], :Content => , :ConsumerKey => @@api_consumer_key, :ApplicationSecret => @@api_application_secret }) end # Check Your Account Balance (Old Authentication) if @@api_username != nil && @@api_password != nil response = CurbFu.get({:host => 'app.helliomessaging.com/api', :path => '/sms-bal?', :protocol => 'http'}, { :username => @@api_username, :password => @@api_password }) end # Check Your Account Balance (New Authentication: Consumer Key and Application Secret) if @@api_consumer_key != nil && @@api_application_secret != nil response = CurbFu.get({:host => 'app.helliomessaging.com/api', :path => '/sms-bal?', :protocol => 'http'}, { :ConsumerKey => @@api_consumer_key, :ApplicationSecret => @@api_application_secret }) end # Check for DLR's [Consumer ID and an Application Serect or Username and Password] if @@api_consumer_key != nil && @@api_application_secret != nil response = CurbFu.get({:host => 'app.helliomessaging.com/api', :path => '/sms-dlr?', :protocol => 'http'}, { :From => sender_id, :To => [:to], :Content => , :ConsumerKey => @@api_consumer_key, :ApplicationSecret => @@api_application_secret }) end {:status => response.status, :notice => response.body} end |