Sha256: 008d0ee6e1ee2e502c33a0c059dfd4e571d700af220643ece1f19eac9163fb1b

Contents?: true

Size: 890 Bytes

Versions: 9

Compression:

Stored size: 890 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
      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
          fail Grape::Exceptions::InvalidVersionerOption.new(strategy)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
grape-0.16.2 lib/grape/middleware/versioner.rb
grape-0.16.1 lib/grape/middleware/versioner.rb
grape-0.15.0 lib/grape/middleware/versioner.rb
grape-0.14.0 lib/grape/middleware/versioner.rb
grape-0.13.0 lib/grape/middleware/versioner.rb
grape-0.12.0 lib/grape/middleware/versioner.rb
grape-0.11.0 lib/grape/middleware/versioner.rb
grape-0.10.1 lib/grape/middleware/versioner.rb
grape-0.10.0 lib/grape/middleware/versioner.rb