Module: Robocall
- Defined in:
- lib/robocall.rb,
lib/robocall/engine.rb,
lib/robocall/version.rb,
app/models/robocall/robocall.rb,
app/helpers/robocall/application_helper.rb,
app/controllers/robocall/robocalls_controller.rb,
app/controllers/robocall/application_controller.rb
Defined Under Namespace
Modules: ApplicationHelper Classes: ApplicationController, Engine, Robocall, RobocallsController
Constant Summary collapse
- VERSION =
"0.0.2"
Class Attribute Summary collapse
-
.auth_token ⇒ Object
Returns the value of attribute auth_token.
-
.base_path ⇒ Object
Returns the value of attribute base_path.
-
.from_phone_number ⇒ Object
Returns the value of attribute from_phone_number.
-
.sid ⇒ Object
Returns the value of attribute sid.
Class Method Summary collapse
- .send_robocall(to: to, text: text, language: :english, from: from_phone_number) ⇒ Object
- .send_robocall_xml(to: to, xml: xml, from: from_phone_number) ⇒ Object
- .send_text(to: to, text: text, from: from_phone_number) ⇒ Object
Class Attribute Details
.auth_token ⇒ Object
Returns the value of attribute auth_token.
7 8 9 |
# File 'lib/robocall.rb', line 7 def auth_token @auth_token end |
.base_path ⇒ Object
Returns the value of attribute base_path.
7 8 9 |
# File 'lib/robocall.rb', line 7 def base_path @base_path end |
.from_phone_number ⇒ Object
Returns the value of attribute from_phone_number.
7 8 9 |
# File 'lib/robocall.rb', line 7 def from_phone_number @from_phone_number end |
.sid ⇒ Object
Returns the value of attribute sid.
7 8 9 |
# File 'lib/robocall.rb', line 7 def sid @sid end |
Class Method Details
.send_robocall(to: to, text: text, language: :english, from: from_phone_number) ⇒ Object
33 34 35 36 37 |
# File 'lib/robocall.rb', line 33 def send_robocall(to: to, text: text, language: :english, from: from_phone_number) # Render XML xml = "<Say language:#{language}>#{text}</Say>" send_robocall_xml(to: to, xml: xml, from: from) end |
.send_robocall_xml(to: to, xml: xml, from: from_phone_number) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/robocall.rb', line 18 def send_robocall_xml(to: to, xml: xml, from: from_phone_number) twilio = get_twilio # Store the xml in a record callback_record = Robocall.new callback_record.xml = xml callback_record.save # construct the callback URL url = base_path+"/robocall/#{callback_record.id}/#{callback_record.token}" twilio.account.calls.create( :from => from, :to => to, :url => url ) end |
.send_text(to: to, text: text, from: from_phone_number) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/robocall.rb', line 9 def send_text(to: to, text: text, from: from_phone_number) twilio = get_twilio twilio.account.sms..create( :from => from, :to => to, :body => text ) end |