module SMSWay
Public Class Methods
active_client()
click to toggle source
# File lib/sms_way.rb, line 24 def self.active_client return @active_client unless @active_client.nil? raise(NoActiveClient.new('active_client was not specified')) if SMSWay::Config.active_client.empty? client = @clients.detect {|k| k.to_s.upcase == SMSWay::Config.active_client.upcase} client.nil? ? raise(NameError.new("#{SMSWay::Config.active_client} was not registered as a SMSWay client")) : @active_client = client.new(SMSWay::Config.auth_options_of) @active_client end
active_client=(client)
click to toggle source
# File lib/sms_way.rb, line 32 def self.active_client=(client) @active_client = client end
add_client(client)
click to toggle source
# File lib/sms_way.rb, line 15 def self.add_client(client) @clients ||= [] @clients << client end
clients()
click to toggle source
# File lib/sms_way.rb, line 10 def self.clients @clients ||= [] @clients end
send_sms(to, text, api_options = {})
click to toggle source
# File lib/sms_way.rb, line 20 def self.send_sms(to, text, api_options = {}) self.active_client.send_sms(to, text, api_options) end
start!()
click to toggle source
# File lib/sms_way.rb, line 36 def self.start! SMSWay::Config.load_configuration Dir.glob(File.join(SMSWay::Config.clients_path, '**', '*.rb')).each {|f| require_relative f} end