Class: BabySMS::Adapters::SignalwireAdapter
- Inherits:
-
BabySMS::Adapter
- Object
- BabySMS::Adapter
- BabySMS::Adapters::SignalwireAdapter
- Defined in:
- lib/babysms/adapters/signalwire_adapter.rb
Defined Under Namespace
Classes: WebHook
Instance Attribute Summary
Attributes inherited from BabySMS::Adapter
Instance Method Summary collapse
- #deliver(message) ⇒ Object
-
#initialize(from:, project:, token:, space_url:) ⇒ SignalwireAdapter
constructor
A new instance of SignalwireAdapter.
Methods inherited from BabySMS::Adapter
#adapter_id, adapter_name, #adapter_name, for_adapter_id, for_number, #web_hook, #web_hook?, #web_hook_class
Constructor Details
#initialize(from:, project:, token:, space_url:) ⇒ SignalwireAdapter
Returns a new instance of SignalwireAdapter.
10 11 12 13 |
# File 'lib/babysms/adapters/signalwire_adapter.rb', line 10 def initialize(from:, project:, token:, space_url:) super(from: from) self.client = Signalwire::REST::Client.new(project, token, signalwire_space_url: space_url) end |
Instance Method Details
#deliver(message) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/babysms/adapters/signalwire_adapter.rb', line 15 def deliver() result = client..create(from: from, to: .to, body: .contents, status_callback: web_hook.end_point) result.sid rescue Signalwire::REST::SignalwireError => e raise BabySMS::FailedDelivery.new(e., adapter: self) end |