Module: SmsghSms
- Defined in:
- lib/smsgh_sms.rb,
lib/smsgh_sms/version.rb
Constant Summary collapse
- VERSION =
"1.0.6"
- @@api_username =
nil
- @@api_password =
nil
- @@api_client_id =
nil
- @@api_client_secret =
nil
- @@api_senderid =
"SMSGHAPI"
Class Method Summary collapse
- .api_client_id ⇒ Object
- .api_client_id=(api_client_id) ⇒ Object
- .api_client_secret ⇒ Object
- .api_client_secret=(api_client_secret) ⇒ 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_client_id ⇒ Object
45 |
# File 'lib/smsgh_sms.rb', line 45 def self.api_client_id; @@api_client_id; end |
.api_client_id=(api_client_id) ⇒ Object
44 |
# File 'lib/smsgh_sms.rb', line 44 def self.api_client_id=(api_client_id); @@api_client_id = api_client_id; end |
.api_client_secret ⇒ Object
48 |
# File 'lib/smsgh_sms.rb', line 48 def self.api_client_secret; @@api_client_secret; end |
.api_client_secret=(api_client_secret) ⇒ Object
47 |
# File 'lib/smsgh_sms.rb', line 47 def self.api_client_secret=(api_client_secret); @@api_client_secret = api_client_secret; end |
.api_password ⇒ Object
42 |
# File 'lib/smsgh_sms.rb', line 42 def self.api_password; @@api_password; end |
.api_password=(api_password) ⇒ Object
41 |
# File 'lib/smsgh_sms.rb', line 41 def self.api_password=(api_password); @@api_password = api_password; end |
.api_senderid ⇒ Object
51 |
# File 'lib/smsgh_sms.rb', line 51 def self.api_senderid; @@api_senderid; end |
.api_senderid=(api_senderid) ⇒ Object
50 |
# File 'lib/smsgh_sms.rb', line 50 def self.api_senderid=(api_senderid); @@api_senderid = api_senderid; end |
.api_username ⇒ Object
39 |
# File 'lib/smsgh_sms.rb', line 39 def self.api_username; @@api_username; end |
.api_username=(api_username) ⇒ Object
38 |
# File 'lib/smsgh_sms.rb', line 38 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 |
# File 'lib/smsgh_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 if @@api_username != nil && @@api_password != nil response = CurbFu.get({:host => 'api.smsgh.com', :path => '/v2/messages/send'}, { :from => sender_id, :to => [:to], :text => , :username => @@api_username, :password => @@api_password }) end if @@api_client_id != nil && @@api_client_secret != nil response = CurbFu.get({:host => 'api.smsgh.com', :path => '/v3/messages/send', :protocol => 'http'}, { :From => sender_id, :To => [:to], :Content => , :ClientId => @@api_client_id, :ClientSecret => @@api_client_secret }) end {:status => response.status, :notice => response.body} end |