Sha256: 1bf7c7ffebb282c6897677c79b17c6521499953cd7fa984546d6dcbc52e131c5

Contents?: true

Size: 734 Bytes

Versions: 23

Compression:

Stored size: 734 Bytes

Contents

# frozen_string_literal: true

module Praxis
  module Docs
    module OpenApi
      class ServerObject
        # https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#server-object
        attr_reader :url, :description, :variables

        def initialize(url:, description: nil, variables: [])
          @url = url
          @description = description
          @variables = variables
          raise "OpenApi docs require a 'url' for your server object." unless url
        end

        def dump
          result = { url: url }
          result[:description] = description if description
          result[:variables] = variables unless variables.empty?

          result
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
praxis-2.0.pre.21 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.20 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.19 lib/praxis/docs/open_api/server_object.rb