Sha256: 36e4b5665755cd13fde513a7163088c0ad598cb29a23a193d375f2d2dfc99fb9

Contents?: true

Size: 681 Bytes

Versions: 2

Compression:

Stored size: 681 Bytes

Contents

# frozen_string_literal: true

require 'rack'
require 'rack/response'

# All(?) Rack code is namespaced within this module.
module Rack
  # Module includes our middleware components for managing service API versions.
  module ServiceApiVersioning
    # Builds Rack::Response with specified status code and body message.
    class HttpErrorResponse
      def call
        Rack::Response.new(message, code).finish
      end

      protected

      def initialize(code, message)
        @code = code.to_i
        @message = Array(message)
        self
      end

      private

      attr_reader :code, :message
    end # class Rack::ServiceApiVersioning::HttpErrorResponse
  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/http_error_response.rb
rack-service_api_versioning-0.1.0 lib/rack/service_api_versioning/http_error_response.rb