lib/trails/twilio/call_handling.rb in trails-1.0.1 vs lib/trails/twilio/call_handling.rb in trails-1.0.2
- old
+ new
@@ -6,22 +6,34 @@
klass.respond_to?( :before_filter )
Mime::Type.register_alias( "text/html", :twiml ) unless Mime.const_defined?( 'TWIML' )
klass.send( :before_filter, :setup_incoming_call )
klass.send( :attr_reader, :incoming_call )
klass.send( :alias_method_chain, :protect_against_forgery?, :twilio )
+ klass.send( :append_view_path, File.expand_path( File.join( File.dirname( __FILE__ ),
+ '../../../assets' ) ) )
+ klass.send( :alias_method_chain, :default_layout, :twilio )
end
protected
+ def default_layout_with_twilio
+ is_twilio_call? ? twiml_layout : default_layout_without_twilio
+ end
+
+ def twiml_layout
+ 'default_layout.twiml.builder'
+ end
+
def protect_against_forgery_with_twilio?
is_twilio_call? ? false : protect_against_forgery_without_twilio?
end
def setup_incoming_call
return unless is_twilio_call?
logger.debug( "at the beginning, request.params = #{request.parameters}" )
request.format = :twiml
response.content_type = 'text/xml'
+
@incoming_call = Trails::Twilio::Incoming.new( request )
end
# TODO: Move this onto the request object,
# it makes more sense to say: