Class: Jsapi::Meta::Example::Base

Inherits:
Model::Base show all
Includes:
OpenAPI::Extensions
Defined in:
lib/jsapi/meta/example/base.rb

Overview

Specifies an example.

Constant Summary

Constants included from Model::Attributes

Model::Attributes::DEFAULT_ARRAY, Model::Attributes::DEFAULT_HASH

Instance Method Summary collapse

Methods included from OpenAPI::Extensions

included

Methods inherited from Model::Base

#initialize, #inspect, #merge!, #reference?, #resolve

Methods included from Model::Attributes

#attribute, #attribute_names

Constructor Details

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

Instance Method Details

#descriptionObject

:attr: description The description of the example.



13
# File 'lib/jsapi/meta/example/base.rb', line 13

attribute :description, String

#externalObject

:attr: external If true, value is interpreted as a URI pointing to an external sample value.



18
# File 'lib/jsapi/meta/example/base.rb', line 18

attribute :external, values: [true, false]

#summaryObject

:attr: summary The summary of the example.



23
# File 'lib/jsapi/meta/example/base.rb', line 23

attribute :summary, String

#to_openapiObject

Returns a hash representing the OpenAPI example object.



31
32
33
34
35
36
37
# File 'lib/jsapi/meta/example/base.rb', line 31

def to_openapi(*)
  with_openapi_extensions(
    { summary: summary, description: description }.tap do |result|
      result[external? ? :externalValue : :value] = value
    end
  )
end

#valueObject

:attr: value The sample value.



28
# File 'lib/jsapi/meta/example/base.rb', line 28

attribute :value