Class: Rack::RestApiVersioning
- Inherits:
-
Object
- Object
- Rack::RestApiVersioning
- Defined in:
- lib/rack/rest_api_versioning.rb
Constant Summary collapse
- VERSION_STRING =
1 1.2 1.2.3
'(\d+(?:\.\d+)*)'
- HTTP_ACCEPT_PATTERN =
application/vnd.foo.bar-v1+xml application/vnd.foo.bar-v1.2.3+json …
/.*\-v#{VERSION_STRING}/
- QUERY_STRING_PATTERN =
?version=1.2.3
/\bversion=#{VERSION_STRING}/
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ RestApiVersioning
constructor
A new instance of RestApiVersioning.
Constructor Details
#initialize(app, options = {}) ⇒ RestApiVersioning
Returns a new instance of RestApiVersioning.
5 6 7 8 |
# File 'lib/rack/rest_api_versioning.rb', line 5 def initialize(app, = {}) @app = app @options = end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 |
# File 'lib/rack/rest_api_versioning.rb', line 10 def call(env) extract_version!(env) @app.call(env) end |