Class: Praxis::Docs::OpenApi::InfoObject
- Inherits:
-
Object
- Object
- Praxis::Docs::OpenApi::InfoObject
- Defined in:
- lib/praxis/docs/open_api/info_object.rb
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #dump ⇒ Object
-
#initialize(version:, api_definition_info:) ⇒ InfoObject
constructor
A new instance of InfoObject.
Constructor Details
#initialize(version:, api_definition_info:) ⇒ InfoObject
Returns a new instance of InfoObject.
9 10 11 12 13 |
# File 'lib/praxis/docs/open_api/info_object.rb', line 9 def initialize(version:, api_definition_info:) @version = version @info = api_definition_info raise "OpenApi docs require a 'Title' for your API." unless info.title end |
Instance Attribute Details
#info ⇒ Object (readonly)
Returns the value of attribute info.
7 8 9 |
# File 'lib/praxis/docs/open_api/info_object.rb', line 7 def info @info end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
7 8 9 |
# File 'lib/praxis/docs/open_api/info_object.rb', line 7 def version @version end |
Instance Method Details
#dump ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/praxis/docs/open_api/info_object.rb', line 15 def dump data = { version: version } %i[ title description termsOfService contact license ].each do |attr| val = info.send(attr) data[attr] = val if val end # Special attributes data[:'x-name'] = info.name if info.logo_url data[:'x-logo'] = { url: info.logo_url, backgroundColor: '#FFFFFF', altText: info.title } end data end |