Class: Apiwork::Introspection::API::Info
- Inherits:
-
Object
- Object
- Apiwork::Introspection::API::Info
- Defined in:
- lib/apiwork/introspection/api/info.rb,
lib/apiwork/introspection/api/info/server.rb,
lib/apiwork/introspection/api/info/contact.rb,
lib/apiwork/introspection/api/info/license.rb
Overview
Wraps API metadata/info.
Defined Under Namespace
Classes: Contact, License, Server
Instance Method Summary collapse
-
#contact ⇒ Info::Contact?
The API contact.
-
#description ⇒ String?
The API description.
-
#initialize(dump) ⇒ Info
constructor
A new instance of Info.
-
#license ⇒ Info::License?
The API license.
-
#servers ⇒ Array<Info::Server>
The API servers.
-
#summary ⇒ String?
The API summary.
-
#terms_of_service ⇒ String?
The API terms of service.
-
#title ⇒ String?
The API title.
-
#to_h ⇒ Hash
Converts the API info to a hash.
-
#version ⇒ String?
The API version.
Constructor Details
#initialize(dump) ⇒ Info
Returns a new instance of Info.
17 18 19 |
# File 'lib/apiwork/introspection/api/info.rb', line 17 def initialize(dump) @dump = dump end |
Instance Method Details
#contact ⇒ Info::Contact?
The API contact.
66 67 68 |
# File 'lib/apiwork/introspection/api/info.rb', line 66 def contact @contact ||= @dump[:contact] ? Contact.new(@dump[:contact]) : nil end |
#description ⇒ String?
The API description.
41 42 43 |
# File 'lib/apiwork/introspection/api/info.rb', line 41 def description @dump[:description] end |
#license ⇒ Info::License?
The API license.
75 76 77 |
# File 'lib/apiwork/introspection/api/info.rb', line 75 def license @license ||= @dump[:license] ? License.new(@dump[:license]) : nil end |
#servers ⇒ Array<Info::Server>
The API servers.
84 85 86 |
# File 'lib/apiwork/introspection/api/info.rb', line 84 def servers @servers ||= @dump[:servers].map { |server| Server.new(server) } end |
#summary ⇒ String?
The API summary.
49 50 51 |
# File 'lib/apiwork/introspection/api/info.rb', line 49 def summary @dump[:summary] end |
#terms_of_service ⇒ String?
The API terms of service.
57 58 59 |
# File 'lib/apiwork/introspection/api/info.rb', line 57 def terms_of_service @dump[:terms_of_service] end |
#title ⇒ String?
The API title.
25 26 27 |
# File 'lib/apiwork/introspection/api/info.rb', line 25 def title @dump[:title] end |
#to_h ⇒ Hash
Converts the API info to a hash.
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/apiwork/introspection/api/info.rb', line 92 def to_h { contact: contact&.to_h, description: description, license: license&.to_h, servers: servers.map(&:to_h), summary: summary, terms_of_service: terms_of_service, title: title, version: version, } end |
#version ⇒ String?
The API version.
33 34 35 |
# File 'lib/apiwork/introspection/api/info.rb', line 33 def version @dump[:version] end |