Class: Jsapi::Meta::OpenAPI::Server

Inherits:
Base
  • Object
show all
Defined in:
lib/jsapi/meta/openapi/server.rb

Overview

Represents a server object.

Instance Method Summary collapse

Methods inherited from Base

#initialize, #inspect, #reference?, #resolve

Methods included from Attributes::ClassMethods

#attribute, #attribute_names

Constructor Details

This class inherits a constructor from Jsapi::Meta::Base

Instance Method Details

#descriptionObject

:attr: description The optional description of the server.



11
# File 'lib/jsapi/meta/openapi/server.rb', line 11

attribute :description, String

#to_openapiObject

Returns a hash representing the server object.



24
25
26
27
28
29
30
# File 'lib/jsapi/meta/openapi/server.rb', line 24

def to_openapi(*)
  {
    url: url,
    description: description,
    variables: variables&.transform_values(&:to_openapi)
  }.compact
end

#urlObject

:attr: url The absolute or relative URL of the server.



16
# File 'lib/jsapi/meta/openapi/server.rb', line 16

attribute :url, String

#variablesObject

:attr_reader: variables The optional server variables.



21
# File 'lib/jsapi/meta/openapi/server.rb', line 21

attribute :variables, { String => ServerVariable }