Sha256: 3efbdbe0175a846e86e969a15c075ac4130f4f6b564cdad4b0c5035535b5d14e

Contents?: true

Size: 538 Bytes

Versions: 10

Compression:

Stored size: 538 Bytes

Contents

require_relative 'operation'

module Swaggard
  module Swagger
    class Path
      attr_reader :path

      def initialize(path)
        @path = path
        @operations = {}
      end

      def add_operation(operation)
        @operations[operation.http_method.downcase] = operation
      end

      def ignore_put_if_patch!
        @operations.delete('put') if @operations.key?('patch')
      end

      def to_doc
        Hash[@operations.map { |http_method, operation| [http_method, operation.to_doc] }]
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
swaggard-1.5.1 lib/swaggard/swagger/path.rb
swaggard-1.5.0 lib/swaggard/swagger/path.rb
swaggard-1.4.0 lib/swaggard/swagger/path.rb
swaggard-1.3.0 lib/swaggard/swagger/path.rb
swaggard-1.2.0 lib/swaggard/swagger/path.rb
swaggard-1.1.1 lib/swaggard/swagger/path.rb
swaggard-1.1.0 lib/swaggard/swagger/path.rb
swaggard-1.0.2 lib/swaggard/swagger/path.rb
swaggard-1.0.1 lib/swaggard/swagger/path.rb
swaggard-1.0.0 lib/swaggard/swagger/path.rb