Class: SmsSafe::Interceptors::Nexmo
- Inherits:
-
SmsSafe::Interceptor
- Object
- SmsSafe::Interceptor
- SmsSafe::Interceptors::Nexmo
- Defined in:
- lib/sms_safe/interceptors/nexmo.rb
Overview
Interceptor class for Nexmo Gem. Maps Hash params into SmsSafe::Message and back.
Instance Method Summary collapse
-
#convert_message(message) ⇒ Message
Converts a hash of params (Nexmo doesn’t use a class to represent their messages) into Message.
-
#redirect(message) ⇒ Hash
Returns a modified version of the original message with new recipient and text, to give back to the texter gem to send.
Methods inherited from SmsSafe::Interceptor
#deliver_email, #discard, #email, #email_body, #email_recipient, #intercept_message!, #intercept_message?, #process_message, #redirect_phone_number, #redirect_text
Instance Method Details
#convert_message(message) ⇒ Message
Converts a hash of params (Nexmo doesn’t use a class to represent their messages) into Message
15 16 17 |
# File 'lib/sms_safe/interceptors/nexmo.rb', line 15 def () SmsSafe::Message.new(from: [:from], to: [:to], text: [:text], original_message: ) end |
#redirect(message) ⇒ Hash
Returns a modified version of the original message with new recipient and text,
to give back to the texter gem to send.
24 25 26 27 28 29 |
# File 'lib/sms_safe/interceptors/nexmo.rb', line 24 def redirect() = . [:to] = redirect_phone_number() [:text] = redirect_text() end |