Class: Twilio::Rails::SMS::CreateOperation

Inherits:
ApplicationOperation show all
Defined in:
app/operations/twilio/rails/sms/create_operation.rb

Overview

Called by Twilio::Rails::SMSController with the Twilio params to create a new SMS conversation.

Instance Method Summary collapse

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
# File 'app/operations/twilio/rails/sms/create_operation.rb', line 9

def execute
  conversation = ::Twilio::Rails.config.sms_conversation_class.new(
    number: params["Called"].presence || params["To"].presence,
    from_number: params["From"].presence,
    from_city: params["FromCity"].presence,
    from_province: params["FromState"].presence,
    from_country: params["FromCountry"].presence,
  )
  conversation.save!
  conversation
end