module BabySMS
WebApplication
is a Sinatra app that handles all incoming web hook HTTP requests. It multiplexes to all adapters that are enabled.
Constants
- VERSION
Public Class Methods
adapter()
click to toggle source
# File lib/babysms.rb, line 28 def self.adapter fail "can't use #adapters= with multiple adapters" unless adapters.size == 1 adapters.first end
adapter=(adapter)
click to toggle source
Shorthand to set a list of one adapter in the simple case
# File lib/babysms.rb, line 24 def self.adapter=(adapter) self.adapters = [adapter] end
available_adapters(test: false, cache: true)
click to toggle source
# File lib/babysms.rb, line 33 def self.available_adapters(test: false, cache: true) # Allow cache-busting @found_adapters = nil if !cache @found_adapters ||= begin BabySMS::Adapters.constants.map do |constant| cls = BabySMS::Adapters.const_get(constant) if cls.is_a?(Class) && cls.ancestors.include?(BabySMS::Adapter) cls end end.compact end if test @found_adapters else @found_adapters - [BabySMS::Adapters::TestAdapter] end end