Sha256: 02276d297af258dd4963754a7829970a3dc08c62621cd5f1502a46d8c65e6a8f

Contents?: true

Size: 955 Bytes

Versions: 1

Compression:

Stored size: 955 Bytes

Contents

module Dox
  module Entities
    class Example

      attr_reader :desc, :request, :response

      def initialize(details, request, response)
        @desc = details[:description]
        @request = request
        @response = response
      end

      def request_parameters
        request.parameters.except(*request.path_parameters.keys.map(&:to_s)).except(*request.query_parameters.keys.map(&:to_s))
      end

      def request_content_type
        request.content_type
      end

      def request_identifier
        fullpath
      end

      def response_status
        response.status
      end

      def response_content_type
        response.content_type
      end

      def response_body
        response.body
      end

      private

      def fullpath
        if request.query_parameters.present?
          "#{request.path}?#{request.query_parameters.to_query}"
        else
          request.path
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dox-0.0.3 lib/dox/entities/example.rb