Class: Rack::ServiceApiVersioning::MatchHeaderAgainstApiVersions

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/service_api_versioning/match_header_against_api_versions.rb

Overview

Matches content of HTTP Accept header against presently-available API Versions. Returns either a symbolic value (e.g., :v2) on success or nil on failure.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(accept_header:, api_versions:) ⇒ Object



14
15
16
# File 'lib/rack/service_api_versioning/match_header_against_api_versions.rb', line 14

def self.call(accept_header:, api_versions:)
  new(accept_header, api_versions).call
end

Instance Method Details

#callObject



18
19
20
# File 'lib/rack/service_api_versioning/match_header_against_api_versions.rb', line 18

def call
  best_match
end