Class: SmsMisr::Handler
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(phone_number) ⇒ Handler
constructor
A new instance of Handler.
- #send_message(message, sender, language = 1) ⇒ Object
- #send_otp(otp) ⇒ Object
Constructor Details
#initialize(phone_number) ⇒ Handler
Returns a new instance of Handler.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sms_misr.rb', line 16 def initialize(phone_number) @options = { query: { username: username, password: password, mobile: phone_number, }, } end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
14 15 16 |
# File 'lib/sms_misr.rb', line 14 def @options end |
Instance Method Details
#send_message(message, sender, language = 1) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/sms_misr.rb', line 27 def (, sender, language = 1) return unless send_sms_enabled? @options[:query].merge!((, sender, language)) result = self.class.post('/webapi', @options) result.parsed_response end |
#send_otp(otp) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/sms_misr.rb', line 35 def send_otp(otp) return unless send_sms_enabled? @options[:query].merge!(otp_params(otp)) result = self.class.post('/vSMS', @options) result.parsed_response end |