class BabySMS::Adapters::SignalwireAdapter
Public Class Methods
new(from:, project:, token:, space_url:)
click to toggle source
Calls superclass method
BabySMS::Adapter::new
# 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
Public Instance Methods
deliver(message)
click to toggle source
# File lib/babysms/adapters/signalwire_adapter.rb, line 15 def deliver(message) result = client.messages.create(from: from, to: message.to, body: message.contents, status_callback: web_hook.end_point) result.sid rescue Signalwire::REST::SignalwireError => e raise BabySMS::FailedDelivery.new(e.message, adapter: self) end