Class: SmsManager::Client
- Inherits:
-
Object
- Object
- SmsManager::Client
- Defined in:
- lib/sms_manager/client.rb
Instance Method Summary collapse
-
#send_message(options = {}) ⇒ Object
options should be { number: String, message: String }.
Instance Method Details
#send_message(options = {}) ⇒ Object
options should be { number: String, message: String }
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sms_manager/client.rb', line 7 def ( = {}) = { username: SmsManager.instance_variable_get(:@username), password: SmsManager.instance_variable_get(:@hashed_password), number: [:number], message: [:message] } body = HTTPClient.get('http://http-api.smsmanager.cz/Send', ).body unless body =~ /^OK/ raise SendingError, "Sending text '#{[:message]}' to phone '#{[:number]}' failed" end nil end |