peimelo/controlled_health_api

View on GitHub
lib/api_constraints.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
class ApiConstraints
  def initialize(options)
    @version = options[:version]
    @default = options[:default]
  end

  def matches?(req)
    @default || req.headers['Accept']&.include?("application/vnd.saudecontrolada.v#{@version}")
  end
end