class Phenotype::AcceptHeaderStrategy
Attributes
mime_type[R]
Public Class Methods
new(mime_type = 'application/vnd.rentpath.api+json')
click to toggle source
# File lib/phenotype/strategies/accept_header_strategy.rb, line 7 def initialize(mime_type = 'application/vnd.rentpath.api+json') @mime_type = mime_type end
Public Instance Methods
version(env)
click to toggle source
# File lib/phenotype/strategies/accept_header_strategy.rb, line 11 def version(env) env['HTTP_ACCEPT'].to_s.match(/#{Regexp.quote(mime_type)};version=(?<version>\d+)/) { |match| match[:version] } || NullStrategy.new end