def api_version(config, &block)
      raise ArgumentError, "you must pass a configuration Hash to api_version" if config.nil? || !config.is_a?(Hash)
      config.symbolize_keys!
      raise ArgumentError, "you must specify :header, :path, or :parameter in configuration Hash passed to api_version" if !config.has_key?(:header) && !config.has_key?(:path) && !config.has_key?(:parameter)
      [:header, :path, :parameter].each do |s|
        raise ArgumentError, "#{s} key in configuration Hash passed to api_version must point to a Hash" if config.has_key?(s) && !config[s].is_a?(Hash)
      end
      raise ArgumentError, "you must specify :module in configuration Hash passed to api_version" if !config.has_key?(:module)
      raise ArgumentError, ":defaults must be a Hash" if config.has_key?(:defaults) && !config[:defaults].is_a?(Hash)
      rails_quirks(config, &block)
      configure_header(config, &block) if config.has_key?(:header)
      configure_path(config, &block) if config.has_key?(:path)
      configure_parameter(config, &block) if config.has_key?(:parameter)
      configure_default(config, &block) if config.has_key?(:default) && config[:default]
    end
def api_version(config, &block)
      raise ArgumentError, "you must pass a configuration Hash to api_version" if config.nil? || !config.is_a?(Hash)
      config.symbolize_keys!
      raise ArgumentError, "you must specify :header, :path, or :parameter in configuration Hash passed to api_version" if !config.has_key?(:header) && !config.has_key?(:path) && !config.has_key?(:parameter)
      [:header, :path, :parameter].each do |s|
        raise ArgumentError, "#{s} key in configuration Hash passed to api_version must point to a Hash" if config.has_key?(s) && !config[s].is_a?(Hash)
      end
      raise ArgumentError, "you must specify :module in configuration Hash passed to api_version" if !config.has_key?(:module)
      raise ArgumentError, ":defaults must be a Hash" if config.has_key?(:defaults) && !config[:defaults].is_a?(Hash)
      rails_quirks(config, &block)
      configure_header(config, &block) if config.has_key?(:header)
      configure_path(config, &block) if config.has_key?(:path)
      configure_parameter(config, &block) if config.has_key?(:parameter)
      configure_default(config, &block) if config.has_key?(:default) && config[:default]
    end
Allows you to constrain routes to specific versions of your api using versioning strategies.
 Supported formats:

 HTTP Header
 api_version(:module => "V1", :header => {:name => "Accept", :value => "application/vnd.mycompany.com; version=1"}})

 Path
 api_version(:module => "V1", :path => {:value => "v1"}})

 Request Parameter
 api_version(:module => "V1", :parameter => {:name => "version", :value => "1"}})

 Specifying default version:
 api_version(:module => "V1", :default => true, :header => {:name => "Accept", :value => "application/vnd.mycompany.com; version=1"}})

 Multiple Strategies per version
 api_version(:module => "V1", :header => {:name => "Accept", :value => "application/vnd.mycompany.com; version=1"}, :path => {:value => "v1"})