Add Transit Network Selection to your Routing Script
From TBwiki
Applies to version(s): v2.6, v2.7.
This article applies to: | Product | Version |
Tmedia | 2.6, 2.7 |
To add transit network selection to any routing script, do the following:
1- Click Routing script in the navigation panel.
2- Edit your main script
3- Add the 5 following lines to the script:
At the top of the page
require 'transit_network_selection'
Following your main class definition
include TransitNetworkSelection
Add before filter, route match and after filter in your main class
before_filter :method => :transit_network_selection_before_filter route_match :method => :transit_network_selection_route_match after_filter :method => :transit_network_selection_after_filter
4- Click 'Save'
Example
require 'base_routing' require 'transit_network_selection' # <- Add this line here class my_script < BaseRouting include TransitNetworkSelection # <- Add this line here before_filter :method => :transit_network_selection_before_filter # <- Add this line here route_match :call_field_name => :called route_match :call_field_name => :calling route_match :call_field_name => :nap route_match :method => :transit_network_selection_route_match # <- Add this line here route_remap :call_field_name => :called, :route_field_name => :remapped_called route_remap :call_field_name => :calling, :route_field_name => :remapped_calling route_remap :call_field_name => :nap, :route_field_name => :remapped_nap after_filter :method => :transit_network_selection_after_filter # <- Add this line here end @@routing = my_script.new def init_routes( routes ) @@routing.init routes end def route( call, nap_list ) @@routing.route call, nap_list end