Class: Notifu::Actors::TwilioCall

Inherits:
Notifu::Actor show all
Defined in:
lib/notifu/actors/twilio_call.rb

Instance Attribute Summary

Attributes inherited from Notifu::Actor

#contacts, #issue

Instance Method Summary collapse

Methods inherited from Notifu::Actor

#apply_template, #default_template, #load_data, #perform

Methods included from Util

action_log, log, option

Instance Method Details

#actObject


11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/notifu/actors/twilio_call.rb', line 11

def act
  contacts = self.contacts.map { |contact| contact.cell }
  req_string = Notifu::CONFIG[:actors][:twilio_call][:api] +
                "?token="       + Notifu::CONFIG[:actors][:twilio_call][:token] +
                "&status="      + self.issue.code.to_state +
                "&hostname="    + self.issue.host +
                "&service="     + self.issue.service +
                "&description=" + ERB::Util.url_encode(self.issue.message.to_s) +
                "&call_group="  + ERB::Util.url_encode(contacts.to_json) +
                "&init=1"
  Excon.get req_string if self.issue.code.to_i == 2
end