Class: SMSify
- Inherits:
-
Object
- Object
- SMSify
- Defined in:
- lib/smsify.rb
Constant Summary collapse
- @@endpoint =
"https://www.smsify.com.au/transport/"- @@api_key =
""
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(key) ⇒ SMSify
constructor
A new instance of SMSify.
- #sendSMS(message, mobile) ⇒ Object
- #sendTestSMS(message, mobile) ⇒ Object
Constructor Details
#initialize(key) ⇒ SMSify
Returns a new instance of SMSify.
15 16 17 |
# File 'lib/smsify.rb', line 15 def initialize(key) @@api_key=key end |
Class Method Details
.api_key ⇒ Object
11 12 13 |
# File 'lib/smsify.rb', line 11 def self.api_key @@api_key end |
.endpoint ⇒ Object
6 7 8 |
# File 'lib/smsify.rb', line 6 def self.endpoint @@endpoint end |
Instance Method Details
#sendSMS(message, mobile) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/smsify.rb', line 19 def sendSMS(, mobile) uri = URI.parse(@@endpoint) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Post.new(uri.request_uri) request.set_form_data({'method' => 'sendSMS', 'key' => @@api_key, 'send_to' => mobile, 'message' => }) response = http.request(request) #puts response.body #puts response.code return response end |
#sendTestSMS(message, mobile) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/smsify.rb', line 34 def sendTestSMS(, mobile) uri = URI.parse(@@endpoint) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Post.new(uri.request_uri) request.set_form_data({'method' => 'sendTestSMS', 'key' => @@api_key, 'send_to' => mobile, 'message' => }) response = http.request(request) #puts response.body #puts response.code return response end |