Module: SmsManager
- Defined in:
- lib/sms_manager.rb,
lib/sms_manager/version.rb,
lib/sms_manager/error/error.rb,
lib/sms_manager/error/sending_error.rb
Defined Under Namespace
Classes: Error, SendingError, Version
Class Attribute Summary collapse
-
.hashed_password ⇒ Object
writeonly
Sets the attribute hashed_password.
-
.username ⇒ Object
writeonly
Sets the attribute username.
Class Method Summary collapse
- .configure {|_self| ... } ⇒ Object
-
.send(options = {}) ⇒ Object
options should be { number: String, message: String }.
- .send_message(options = {}) ⇒ Object
Class Attribute Details
.hashed_password=(value) ⇒ Object (writeonly)
Sets the attribute hashed_password
6 7 8 |
# File 'lib/sms_manager.rb', line 6 def hashed_password=(value) @hashed_password = value end |
.username=(value) ⇒ Object (writeonly)
Sets the attribute username
6 7 8 |
# File 'lib/sms_manager.rb', line 6 def username=(value) @username = value end |
Class Method Details
.configure {|_self| ... } ⇒ Object
8 9 10 |
# File 'lib/sms_manager.rb', line 8 def configure yield self end |
.send(options = {}) ⇒ Object
options should be { number: String, message: String }
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sms_manager.rb', line 13 def send( = {}) = { username: SmsManager.instance_variable_get(:@username), password: SmsManager.instance_variable_get(:@hashed_password), number: [:number], message: [:message] } begin body = HTTPClient.get('http://http-api.smsmanager.cz/Send', ).body rescue StandardError => e raise Error.new(e.) end raise SendingError.new(body) unless body =~ /^OK/ end |
.send_message(options = {}) ⇒ Object
28 29 30 |
# File 'lib/sms_manager.rb', line 28 def ( = {}) send end |