Sha256: 3a47d2f971f16ea2014cbb812a36bb8fd2fb8c78864c52948945bb436b38eec5

Contents?: true

Size: 710 Bytes

Versions: 1

Compression:

Stored size: 710 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
        else
          raise ArgumentError.new("Unknown :using for versioner: #{strategy}")
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grape-0.2.0 lib/grape/middleware/versioner.rb