Sha256: de2cedf33b2cda100350cd539df445de89f8a1a1b8e79f7e8d7cafddbbcdd48b

Contents?: true

Size: 821 Bytes

Versions: 5

Compression:

Stored size: 821 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
#   :param  - version from uri query string, e.g. /v1/resource?apiver=v1
#
# See individual classes for details.
module Grape
  module Middleware
    module Versioner
      extend self

      # @param strategy [Symbol] :path, :header or :param
      # @return a middleware class based on strategy
      def using(strategy)
        case strategy
        when :path
          Path
        when :header
          Header
        when :param
          Param
        else
          raise Grape::Exceptions::InvalidVersionerOption.new(strategy)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
grape-0.4.1 lib/grape/middleware/versioner.rb
grape-0.4.0 lib/grape/middleware/versioner.rb
grape-0.3.2 lib/grape/middleware/versioner.rb
grape-0.3.1 lib/grape/middleware/versioner.rb
grape-0.3.0 lib/grape/middleware/versioner.rb