class OpenStax::Api::Constraints
Public Class Methods
new(options)
click to toggle source
# File lib/openstax/api/constraints.rb, line 6 def initialize(options) @version = options[:version] @default = options[:default] end
Public Instance Methods
api_accept_header()
click to toggle source
# File lib/openstax/api/constraints.rb, line 11 def api_accept_header "application/vnd.openstax.#{@version.to_s}" end
matches?(req)
click to toggle source
# File lib/openstax/api/constraints.rb, line 15 def matches?(req) !!(@default || req.headers['Accept'].try(:include?, api_accept_header)) end