Class: Jsapi::Meta::Info

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

Overview

Specifies metadata about an API.

Instance Method Summary collapse

Methods included from OpenAPI::Extensions

included

Methods inherited from Jsapi::Model::Base

#==, #errors, #initialize, #inspect, model_name, #respond_to_missing?

Constructor Details

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Jsapi::Model::Base

Instance Method Details

#contactObject

:attr: contact The Contact.



12
# File 'lib/jsapi/meta/info.rb', line 12

attribute :contact, Contact

#descriptionObject

:attr: description The description of the API.



17
# File 'lib/jsapi/meta/info.rb', line 17

attribute :description, String

#licenseObject

:attr: license The License.



22
# File 'lib/jsapi/meta/info.rb', line 22

attribute :license, License

#summaryObject

:attr: summary The short summary of the API. Applies to OpenAPI 3.1 and higher.



27
# File 'lib/jsapi/meta/info.rb', line 27

attribute :summary, String

#terms_of_serviceObject

:attr: terms_of_service The URL pointing to the terms of service.



32
# File 'lib/jsapi/meta/info.rb', line 32

attribute :terms_of_service, String

#titleObject

:attr: title The title of the API.



37
# File 'lib/jsapi/meta/info.rb', line 37

attribute :title, String

#to_openapi(version) ⇒ Object

Returns a hash representing the OpenAPI info object.



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/jsapi/meta/info.rb', line 45

def to_openapi(version, *)
  version = OpenAPI::Version.from(version)

  with_openapi_extensions(
    title: title,
    summary: (summary if version >= OpenAPI::V3_1),
    description: description,
    termsOfService: terms_of_service,
    contact: contact&.to_openapi,
    license: license&.to_openapi(version),
    version: self.version
  )
end

#versionObject

:attr: version The version of the API.



42
# File 'lib/jsapi/meta/info.rb', line 42

attribute :version, String