Class: TaskManager::ApiConstraints

Inherits:
Object
  • Object
show all
Defined in:
lib/task-manager/api_constraints.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ApiConstraints

Returns a new instance of ApiConstraints.



3
4
5
6
# File 'lib/task-manager/api_constraints.rb', line 3

def initialize(options)
  @version = options[:version]
  @default = options[:default]
end

Instance Method Details

#matches?(req) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/task-manager/api_constraints.rb', line 8

def matches?(req)
  @default || req.headers['Accept'].include?("application/vnd.menglifang.com.cn; version=#{@version}")
end