Module: SmsSafe
- Defined in:
- lib/sms_safe/hooks.rb,
lib/sms_safe/config.rb,
lib/sms_safe/message.rb,
lib/sms_safe/version.rb,
lib/sms_safe/interceptor.rb,
lib/sms_safe/interceptors/nexmo.rb,
lib/sms_safe/interceptors/twilio.rb,
lib/sms_safe/interceptors/action_texter.rb
Defined Under Namespace
Modules: Interceptors Classes: Configuration, Interceptor, InvalidConfigSettingError, Message
Constant Summary collapse
- VERSION =
"1.0.2"
Class Method Summary collapse
-
.configuration ⇒ Object
Returns the current configuration.
-
.configure {|configuration| ... } ⇒ Object
Yields the current configuration, allowing the caller to modify it in a block.
-
.hook!(texter_gem) ⇒ Object
Hooks into the specified texter gem to be able to analyze and modify / discard messages before they are sent.
Class Method Details
.configuration ⇒ Object
Returns the current configuration
7 8 9 |
# File 'lib/sms_safe/config.rb', line 7 def self.configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
Yields the current configuration, allowing the caller to modify it in a block
12 13 14 |
# File 'lib/sms_safe/config.rb', line 12 def self.configure yield(configuration) if block_given? end |
.hook!(texter_gem) ⇒ Object
Hooks into the specified texter gem to be able to analyze and modify / discard messages before they are sent.
Uses a civilized method for :action_texter, and monkey_patching for the rest, unfortunately
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sms_safe/hooks.rb', line 9 def self.hook!(texter_gem) case texter_gem when :action_texter ActionTexter.register_interceptor(SmsSafe::Interceptors::ActionTexter.new) when :twilio hook_twilio! when :nexmo hook_nexmo! else raise InvalidConfigSettingError.new("Ensure texter_gem is either :action_texter, :twilio or :nexmo") end end |