Class: ApiVersions::VersionCheck
- Inherits:
-
Object
- Object
- ApiVersions::VersionCheck
- Defined in:
- lib/api-versions/version_check.rb
Class Attribute Summary collapse
-
.default_version ⇒ Object
Returns the value of attribute default_version.
-
.vendor_string ⇒ Object
Returns the value of attribute vendor_string.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ VersionCheck
constructor
A new instance of VersionCheck.
- #matches?(request) ⇒ Boolean
Constructor Details
#initialize(args = {}) ⇒ VersionCheck
Returns a new instance of VersionCheck.
7 8 9 |
# File 'lib/api-versions/version_check.rb', line 7 def initialize(args = {}) @process_version = args[:version] end |
Class Attribute Details
.default_version ⇒ Object
Returns the value of attribute default_version.
4 5 6 |
# File 'lib/api-versions/version_check.rb', line 4 def default_version @default_version end |
.vendor_string ⇒ Object
Returns the value of attribute vendor_string.
4 5 6 |
# File 'lib/api-versions/version_check.rb', line 4 def vendor_string @vendor_string end |
Instance Method Details
#matches?(request) ⇒ Boolean
11 12 13 14 15 16 17 |
# File 'lib/api-versions/version_check.rb', line 11 def matches?(request) accepts = request.headers['Accept'].split(',') accepts.any? do |accept| accept.strip! accepts_proper_format?(accept) && (matches_version?(accept) || unversioned?(accept)) end end |