Class: DAF::SMSAction

Inherits:
Action
  • Object
show all
Defined in:
lib/daf/actions/sms_action.rb

Overview

An action that sends an sms using twilio based on parameters

Instance Method Summary collapse

Methods inherited from Action

#activate

Methods included from Configurable

included

Instance Method Details

#clientObject



15
16
17
# File 'lib/daf/actions/sms_action.rb', line 15

def client
  @client ||= Twilio::REST::Client.new(@sid, @token)
end

#invokeObject



19
20
21
22
23
# File 'lib/daf/actions/sms_action.rb', line 19

def invoke
  @message_id = client..messages.create(body: @message,
                                               to: @to,
                                               from: @from)
end