Sha256: 6023415705ad24e0327ea44121d741ef6f7191ff969f39e7152eb9d279982d27

Contents?: true

Size: 460 Bytes

Versions: 11

Compression:

Stored size: 460 Bytes

Contents

module Swaggard
  module Swagger
    class Definition

      attr_reader :id

      def initialize(id)
        @id = id
        @properties = []
      end

      def add_property(property)
        @properties << property
      end

      def to_doc
        {
          'type'        => 'object',
          'required'    => [],
          'properties'  => Hash[@properties.map { |property| [property.id, property.to_doc] }]
        }
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
swaggard-0.5.4 lib/swaggard/swagger/definition.rb
swaggard-0.5.3 lib/swaggard/swagger/definition.rb
swaggard-0.5.2 lib/swaggard/swagger/definition.rb
swaggard-0.5.1 lib/swaggard/swagger/definition.rb
swaggard-0.5.0 lib/swaggard/swagger/definition.rb
swaggard-0.4.0 lib/swaggard/swagger/definition.rb
swaggard-0.3.0 lib/swaggard/swagger/definition.rb
swaggard-0.2.1 lib/swaggard/swagger/definition.rb
swaggard-0.2.0 lib/swaggard/swagger/definition.rb
swaggard-0.1.1 lib/swaggard/swagger/definition.rb
swaggard-0.1.0 lib/swaggard/swagger/definition.rb