Class: ApiConstraints
- Inherits:
-
Object
- Object
- ApiConstraints
- Defined in:
- lib/api_constraints.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ ApiConstraints
constructor
A new instance of ApiConstraints.
- #matches?(req) ⇒ Boolean
Constructor Details
#initialize(options) ⇒ ApiConstraints
Returns a new instance of ApiConstraints.
2 3 4 5 |
# File 'lib/api_constraints.rb', line 2 def initialize() @version = [:version] @default = [:default] end |
Instance Method Details
#matches?(req) ⇒ Boolean
7 8 9 |
# File 'lib/api_constraints.rb', line 7 def matches?(req) @default || req.headers['Accept'].include?("application/vnd.example.v#{@version}") end |