module-and-template-store/lib/api_constraints.rb

10 lines
240 B
Ruby
Raw Normal View History

class ApiConstraints
def initialize(options)
@version = options[:version]
@default = options[:default]
end
def matches?(req)
@default || req.headers['Accept'].include?("application/vnd.example.v#{@version}")
end
end