lib/murlsh/dispatch.rb in murlsh-0.10.0 vs lib/murlsh/dispatch.rb in murlsh-0.11.0

- old
+ new

@@ -14,10 +14,11 @@ def initialize(config) @config = config ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => @config.fetch('db_file')) + ActiveRecord::Base.include_root_in_json = false db = ActiveRecord::Base.connection.instance_variable_get(:@connection) url_server = Murlsh::UrlServer.new(@config, db) config_server = Murlsh::ConfigServer.new(@config) @@ -25,13 +26,17 @@ twitter_server = Murlsh::TwitterServer.new root_path = URI(@config.fetch('root_url')).path @dispatch = [ + [%r{^HEAD #{root_path}(url)?$}, url_server.method(:head)], [%r{^GET #{root_path}(url)?$}, url_server.method(:get)], [%r{^POST #{root_path}(url)?$}, url_server.method(:post)], + [%r{^HEAD #{root_path}config$}, config_server.method(:head)], [%r{^GET #{root_path}config$}, config_server.method(:get)], + [%r{^HEAD #{root_path}flickr$}, flickr_server.method(:head)], [%r{^GET #{root_path}flickr$}, flickr_server.method(:get)], + [%r{^HEAD #{root_path}twitter/.+$}, twitter_server.method(:head)], [%r{^GET #{root_path}twitter/.+$}, twitter_server.method(:get)], ] end # Figure out which method will handle request.