Module: SadsXml::ControllerAdditions::InstanceMethods
- Defined in:
- lib/sads_xml/controller_additions.rb
Instance Method Summary collapse
Instance Method Details
#process_sads_request ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/sads_xml/controller_additions.rb', line 18 def process_sads_request setup_sads_request yield # Check ActionController::Responder # This doesn't work for now, see how to implement this # for DRYing the methods in the controller # respond_with_sads end |
#respond_with_sads ⇒ Object
46 47 48 49 50 51 |
# File 'lib/sads_xml/controller_additions.rb', line 46 def respond_with_sads respond_to do |format| format.html { render :template => 'sads_xml/sads', :layout => 'sads_xml' } format.sads { render :xml => @sads.to_sads } end end |
#setup_sads_request ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/sads_xml/controller_additions.rb', line 28 def setup_sads_request # Get WHOISD Parameters if params[:format] == 'sads' @whoisd = {} request.headers.each {|k,v| @whoisd[k] = v if k.match(/^HTTP_WHOISD/) } logger.info " WHOISD: #{@whoisd.inspect}" end # The code below tries to emulate a SADS request # this assumes that both are blank if params[:format] == 'html' params[:abonent] = '639990000000' if params[:abonent].nil? params[:protocol] = 'ussd' if params[:protocol].nil? end @sads = Sads.new end |