Module: Grape::Middleware::Versioner

Defined in:
lib/grape.rb,
lib/grape/middleware/versioner.rb,
lib/grape/middleware/versioner/path.rb,
lib/grape/middleware/versioner/param.rb,
lib/grape/middleware/versioner/header.rb,
lib/grape/middleware/versioner/accept_version_header.rb

Defined Under Namespace

Classes: AcceptVersionHeader, Header, Param, Path

Class Method Summary (collapse)

Class Method Details

+ (Object) using(strategy)

Returns a middleware class based on strategy

Parameters:

  • strategy (Symbol)

    :path, :header or :param

Returns:

  • a middleware class based on strategy



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/grape/middleware/versioner.rb', line 16

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