Module: BabySMS
- Defined in:
- lib/babysms/web_application.rb,
lib/babysms.rb,
lib/babysms/errors.rb,
lib/babysms/report.rb,
lib/babysms/adapter.rb,
lib/babysms/message.rb,
lib/babysms/receipt.rb,
lib/babysms/version.rb,
lib/babysms/mail_man.rb,
lib/babysms/web_hook.rb,
lib/babysms/adapters/test_adapter.rb,
lib/babysms/adapters/nexmo_adapter.rb,
lib/babysms/adapters/plivo_adapter.rb,
lib/babysms/adapters/twilio_adapter.rb,
lib/babysms/adapters/bandwidth_adapter.rb,
lib/babysms/adapters/signalwire_adapter.rb
Overview
WebApplication is a Sinatra app that handles all incoming web hook HTTP requests. It multiplexes to all adapters that are enabled.
Defined Under Namespace
Modules: Adapters Classes: Adapter, Error, FailedDelivery, InvalidMessage, MailMan, Malformed, Message, Receipt, Report, Unauthorized, WebApplication, WebHook, WebHookError
Constant Summary collapse
- VERSION =
'0.5.1'.freeze
Class Method Summary collapse
- .adapter ⇒ Object
-
.adapter=(adapter) ⇒ Object
Shorthand to set a list of one adapter in the simple case.
- .available_adapters(test: false, cache: true) ⇒ Object
Class Method Details
.adapter ⇒ Object
28 29 30 31 |
# 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) ⇒ Object
Shorthand to set a list of one adapter in the simple case
24 25 26 |
# File 'lib/babysms.rb', line 24 def self.adapter=(adapter) self.adapters = [adapter] end |
.available_adapters(test: false, cache: true) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# 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 |