class OpenApi::Info

github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#info-object

Attributes

contact[RW]
description[RW]
license[RW]
terms_of_service[RW]
title[RW]
version[RW]

Public Class Methods

load(hash) click to toggle source
# File lib/open_api/info.rb, line 28
def self.load(hash)
  new(
    title: hash["title"].to_s,
    description: hash["description"]&.to_s,
    terms_of_service: hash["termsOfService"]&.to_s,
    contact: Contact.load(hash["contact"]),
    license: License.load(hash["license"]),
    version: hash["version"].to_s,
  )
end
new(title:, description: nil, terms_of_service: nil, contact: nil, license: nil, version:) click to toggle source
# File lib/open_api/info.rb, line 8
def initialize(title:, description: nil, terms_of_service: nil, contact: nil, license: nil, version:)
  self.title = title
  self.description = description
  self.terms_of_service = terms_of_service
  self.contact = contact
  self.license = license
  self.version = version
end

Public Instance Methods

serializable_hash() click to toggle source
# File lib/open_api/info.rb, line 17
def serializable_hash
  {
    "title" => title.to_s,
    "description" => description&.to_s,
    "termsOfService" => terms_of_service&.to_s,
    "contact" => contact&.serializable_hash,
    "license" => license&.serializable_hash,
    "version" => version.to_s,
  }.compact
end