Sha256: e8faee4741b158d3bffdeabe37e9668c3fc6a6d14f67a521442fe53f5792865a
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true require_relative './report_invalid_description' require_relative './report_not_found' # All(?) Rack code is namespaced within this module. module Rack # Module includes our middleware components for managing service API versions. module ServiceApiVersioning # Validates input for AcceptContentTypeSelector. If input passes checks, # returns `nil`. Returns a Rack::Response instance if any validation step # failed. class InputIsInvalid def self.call(input) Internals.verify_input(input) || Internals.verify_api_versions(input) end # Stateless methods module Internals def self._api_versions?(input) input.data[:api_versions].any? end def self.verify_api_versions(input) return ReportNotFound.call unless _api_versions?(input) nil end def self.verify_input(input) return ReportInvalidDescription.call unless input.any? nil end end end # class Rack::ServiceApiVersioning::InputIsInvalid end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rack-service_api_versioning-0.1.1 | lib/rack/service_api_versioning/input_is_invalid.rb |
rack-service_api_versioning-0.1.0 | lib/rack/service_api_versioning/input_is_invalid.rb |