Class: TatangoSMS::MO::Handler
- Inherits:
-
Mongrel::HttpHandler
- Object
- Mongrel::HttpHandler
- TatangoSMS::MO::Handler
- Defined in:
- lib/tatango_sms/mo.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(&blk) ⇒ Handler
constructor
A new instance of Handler.
- #process(request, response) ⇒ Object
Constructor Details
#initialize(&blk) ⇒ Handler
Returns a new instance of Handler.
79 80 81 |
# File 'lib/tatango_sms/mo.rb', line 79 def initialize(&blk) @processor = blk end |
Instance Method Details
#process(request, response) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/tatango_sms/mo.rb', line 83 def process(request, response) params = Hash.from_xml(request.body.read) phone_number = params['message']['sender'] content = params['message']['content'] # puts "Processing request from: #{request.params['REMOTE_ADDR']} phone: #{phone_number}" @processor.call(phone_number, content) response.start(202) do |head,out| head["Content-Type"] = 'text/plain' end end |