Class: Twilio::Rails::SMSController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Twilio::Rails::SMSController
- Defined in:
- app/controllers/twilio/rails/sms_controller.rb
Instance Method Summary collapse
Instance Method Details
#message ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/twilio/rails/sms_controller.rb', line 9 def respond_to do |format| format.xml do if spam? render xml: Twilio::Rails::SMS::Twiml::ErrorOperation.call() else if session[:sms_conversation_id].present? conversation = Twilio::Rails::SMS::FindOperation.call(sms_conversation_id: session[:sms_conversation_id]) else conversation = Twilio::Rails::SMS::CreateOperation.call(params: params_hash) session[:sms_conversation_id] = conversation.id end render xml: Twilio::Rails::SMS::Twiml::MessageOperation.call(sms_conversation_id: conversation.id, params: params_hash) end end end end |
#status ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/twilio/rails/sms_controller.rb', line 28 def status respond_to do |format| format.xml do if params[:message_id].present? = Twilio::Rails::SMS::UpdateMessageOperation.call(message_id: params[:message_id].to_i, params: params_hash) else = Twilio::Rails::SMS::FindMessageOperation.call(params: params_hash) = Twilio::Rails::SMS::UpdateMessageOperation.call(message_id: .id, params: params_hash) end head :ok end end end |