Class: Twilio::Rails::Phone::UpdateOperation

Inherits:
BaseOperation show all
Defined in:
app/operations/twilio/rails/phone/update_operation.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/operations/twilio/rails/phone/update_operation.rb', line 8

def execute
  if phone_call.outbound?
    if params["AnsweredBy"].present? && phone_call.answered_by != params["AnsweredBy"]
      phone_call.answered_by = params["AnsweredBy"]
    end
  end

  if params["CallStatus"].present? && phone_call.call_status != params["CallStatus"]
    phone_call.call_status = params["CallStatus"]
  end

  phone_call.save! if phone_call.changed?

  phone_call
end