Sha256: 8f066dd47e4c37a24dbb1d0ee4cd16db529c0cf4ef9ee999b3151d506f9d6ae6

Contents?: true

Size: 922 Bytes

Versions: 21

Compression:

Stored size: 922 Bytes

Contents

# frozen_string_literal: true

# 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
      module_function

      # @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
        when :accept_version_header
          AcceptVersionHeader
        else
          raise Grape::Exceptions::InvalidVersionerOption.new(strategy)
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
grape-2.1.3 lib/grape/middleware/versioner.rb
grape-2.1.2 lib/grape/middleware/versioner.rb
grape-2.1.1 lib/grape/middleware/versioner.rb
grape-2.1.0 lib/grape/middleware/versioner.rb
grape-2.0.0 lib/grape/middleware/versioner.rb
grape-1.8.0 lib/grape/middleware/versioner.rb
grape-1.7.1 lib/grape/middleware/versioner.rb
grape-1.7.0 lib/grape/middleware/versioner.rb
grape-1.6.2 lib/grape/middleware/versioner.rb
grape-1.6.1 lib/grape/middleware/versioner.rb
grape-1.6.0 lib/grape/middleware/versioner.rb
grape-1.5.3 lib/grape/middleware/versioner.rb
grape-1.5.2 lib/grape/middleware/versioner.rb
grape-1.5.1 lib/grape/middleware/versioner.rb
grape-1.5.0 lib/grape/middleware/versioner.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.4.0/lib/grape/middleware/versioner.rb
grape-1.4.0 lib/grape/middleware/versioner.rb
grape-1.3.3 lib/grape/middleware/versioner.rb
grape-1.3.2 lib/grape/middleware/versioner.rb
grape-1.3.1 lib/grape/middleware/versioner.rb