Class: BabySMS::Adapters::PlivoAdapter
- Inherits:
-
BabySMS::Adapter
- Object
- BabySMS::Adapter
- BabySMS::Adapters::PlivoAdapter
- Defined in:
- lib/babysms/adapters/plivo_adapter.rb
Defined Under Namespace
Classes: WebHook
Instance Attribute Summary
Attributes inherited from BabySMS::Adapter
Instance Method Summary collapse
- #deliver(message) ⇒ Object
-
#initialize(auth_id:, auth_token:, from:) ⇒ PlivoAdapter
constructor
A new instance of PlivoAdapter.
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(auth_id:, auth_token:, from:) ⇒ PlivoAdapter
Returns a new instance of PlivoAdapter.
8 9 10 11 12 |
# File 'lib/babysms/adapters/plivo_adapter.rb', line 8 def initialize(auth_id:, auth_token:, from:) super(from: from) self.client = Plivo::RestClient.new(auth_id, auth_token) end |
Instance Method Details
#deliver(message) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/babysms/adapters/plivo_adapter.rb', line 14 def deliver() response = client..create(from, [.to], .contents) response. rescue PlivoRESTError => e raise BabySMS::FailedDelivery.new(e., adapter: self) end |