Sha256: 3bbb00185bc6b0632716cc652365cf8972178dd5710095bdfb56d784a4c4d726

Contents?: true

Size: 746 Bytes

Versions: 8

Compression:

Stored size: 746 Bytes

Contents

# Versioners set env['api.version'] when a version is defined on an API and
# on the requests. The current methods for determining version are:
#
#   :header - version from HTTP Accept header.
#   :path   - version from uri. e.g. /v1/resource
#
# See individual classes for details.
module Grape
  module Middleware
    module Versioner
      extend self

      # @param strategy [Symbol] :path or :header
      # @return a middleware class based on strategy
      def using(strategy)
        case strategy
        when :path
          Path
        when :header
          Header
        when :param
          Param
        else
          raise ArgumentError.new("Unknown :using for versioner: #{strategy}")
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
grape-0.2.1.1 lib/grape/middleware/versioner.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/grape-0.2.2/lib/grape/middleware/versioner.rb
fragrant-0.0.4 vendor/grape/lib/grape/middleware/versioner.rb
grape-0.2.2 lib/grape/middleware/versioner.rb
fragrant-0.0.3 vendor/grape/lib/grape/middleware/versioner.rb
fragrant-0.0.2 vendor/grape/lib/grape/middleware/versioner.rb
fragrant-0.0.1 vendor/grape/lib/grape/middleware/versioner.rb
grape-0.2.1 lib/grape/middleware/versioner.rb