Class: OpenApi::Info
- Inherits:
-
Object
- Object
- OpenApi::Info
- Includes:
- EquatableAsContent
- Defined in:
- lib/open_api/info.rb
Overview
Instance Attribute Summary collapse
-
#contact ⇒ Object
Returns the value of attribute contact.
-
#description ⇒ Object
Returns the value of attribute description.
-
#license ⇒ Object
Returns the value of attribute license.
-
#terms_of_service ⇒ Object
Returns the value of attribute terms_of_service.
-
#title ⇒ Object
Returns the value of attribute title.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(title:, description: nil, terms_of_service: nil, contact: nil, license: nil, version:) ⇒ Info
constructor
A new instance of Info.
- #serializable_hash ⇒ Object
Methods included from EquatableAsContent
Constructor Details
#initialize(title:, description: nil, terms_of_service: nil, contact: nil, license: nil, version:) ⇒ Info
Returns a new instance of Info.
8 9 10 11 12 13 14 15 |
# 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 |
Instance Attribute Details
#contact ⇒ Object
Returns the value of attribute contact.
6 7 8 |
# File 'lib/open_api/info.rb', line 6 def contact @contact end |
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/open_api/info.rb', line 6 def description @description end |
#license ⇒ Object
Returns the value of attribute license.
6 7 8 |
# File 'lib/open_api/info.rb', line 6 def license @license end |
#terms_of_service ⇒ Object
Returns the value of attribute terms_of_service.
6 7 8 |
# File 'lib/open_api/info.rb', line 6 def terms_of_service @terms_of_service end |
#title ⇒ Object
Returns the value of attribute title.
6 7 8 |
# File 'lib/open_api/info.rb', line 6 def title @title end |
#version ⇒ Object
Returns the value of attribute version.
6 7 8 |
# File 'lib/open_api/info.rb', line 6 def version @version end |
Class Method Details
.load(hash) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# 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 |
Instance Method Details
#serializable_hash ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# 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 |