module ActiveSMS
Constants
- VERSION
Public Class Methods
config()
click to toggle source
@return [ActiveSMS::Configuration] object with configuration options
# File lib/active_sms/configuration.rb, line 4 def self.config @@config ||= Configuration.new end
configure() { |config| ... }
click to toggle source
Allows to configure ActiveSMS
options and register backends
# File lib/active_sms/configuration.rb, line 9 def self.configure yield(config) end
reset!()
click to toggle source
resets ActiveSMS
configuration to default
# File lib/active_sms/configuration.rb, line 14 def self.reset! @@config = nil end
send_sms(phone, text, args = {})
click to toggle source
Core of the gem, method responsible for sending sms
@param phone [String] Phone number for sms @param text [String] Text for sms @param args [Hash] Additional options for delivery. Currently only :backend
# File lib/active_sms/sending.rb, line 9 def send_sms(phone, text, args = {}) backend_name = args.delete(:backend) backend_class(backend_name).new(backend_params(backend_name)) .send_sms(phone, text) end
Private Class Methods
backend_class(name)
click to toggle source
# File lib/active_sms/sending.rb, line 17 def backend_class(name) return default_backend_class if name.nil? if ActiveSMS.config.backends[name].nil? raise ArgumentError, "#{name} backend is not registered" end ActiveSMS.config.backends[name][:class] end
backend_params(name)
click to toggle source
# File lib/active_sms/sending.rb, line 31 def backend_params(name) return default_backend_params if name.nil? ActiveSMS.config.backends[name][:params] end
default_backend_class()
click to toggle source
# File lib/active_sms/sending.rb, line 27 def default_backend_class ActiveSMS.config.backends[ActiveSMS.config.default_backend][:class] end
default_backend_params()
click to toggle source
# File lib/active_sms/sending.rb, line 36 def default_backend_params ActiveSMS.config.backends[ActiveSMS.config.default_backend][:params] end