Sha256: b5068aef23af039f456782cc1cf4133e1f9f08888e08b9b4abaaf226c90b85eb
Contents?: true
Size: 1002 Bytes
Versions: 1
Compression:
Stored size: 1002 Bytes
Contents
require 'twilio-ruby' TWILIO_SID = ENV['TWILIO_SID'] TWILIO_AUTH_TOKEN = ENV['TWILIO_AUTH_TOKEN'] TWILIO_FROM = ENV['TWILIO_FROM'] module Pushpop class Twilio < Step PLUGIN_NAME = 'twilio' attr_accessor :_from attr_accessor :_to attr_accessor :_body def run(last_response=nil, step_responses=nil) self.configure(last_response, step_responses) _to = self._to _from = self._from || TWILIO_FROM _body = self._body client = ::Twilio::REST::Client.new(TWILIO_SID, TWILIO_AUTH_TOKEN) client.account.messages.create( from: _from, to: _to, body: _body ) end def configure(last_response=nil, step_responses=nil) self.instance_exec(last_response, step_responses, &block) end def from(from) self._from = from end def to(to) self._to = to end def body(body) self._body = body end end Pushpop::Job.register_plugin(Twilio::PLUGIN_NAME, Twilio) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pushpop-0.1.0 | lib/plugins/twilio.rb |