Class: Robocall::RobocallsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/robocall/robocalls_controller.rb

Instance Method Summary collapse

Instance Method Details

#connected_to_callerObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/robocall/robocalls_controller.rb', line 13

def connected_to_caller
  @r = Robocall.find_by_id(params[:id])

  error = ''
  error = "Caller record #{params[:id]} not found" unless @r
  error = "No token provided" unless params[:token]
  error = "The token was invalid" unless @r && @r.token == params[:token]
  if error != ''
    xml = ::Robocall.render_say(text: "An error has occured retrieving your automatic message. "+
                                    "Specifically, #{error}.")
    render :xml => xml, :content_type => 'application/xml'
  else
    render :xml => @r.xml, :content_type => 'application/xml'
  end
end

#set_formatObject



9
10
11
# File 'app/controllers/robocall/robocalls_controller.rb', line 9

def set_format
  request.format = 'xml'
end