Class: BabySMS::Adapters::BandwidthAdapter::WebHook

Inherits:
WebHook
  • Object
show all
Defined in:
lib/babysms/adapters/bandwidth_adapter.rb

Instance Attribute Summary

Attributes inherited from WebHook

#adapter

Instance Method Summary collapse

Methods inherited from WebHook

#end_point, #initialize, #mount_point

Constructor Details

This class inherits a constructor from BabySMS::WebHook

Instance Method Details

#process(app:, report:) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/babysms/adapters/bandwidth_adapter.rb', line 29

def process(app:, report:)
  validate!(app.request)
  message = BabySMS::Message.new(from: app.params['from'],
                                 to: app.params['to'],
                                 contents: app.params['text'],
                                 uuid: app.params['id'])
  report.incoming_message(message)
  [200, { 'Content-Type' => 'text/plain' }, 'ok']
end