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.0 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.40 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.39 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.38 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.37 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.36 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.35 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.34 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.33 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.32 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.31 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.30 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.29 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.28 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.27 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.26 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.25 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.24 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.23 lib/praxis/docs/open_api/server_object.rb
praxis-2.0.pre.22 lib/praxis/docs/open_api/server_object.rb