Class: Apiwork::Introspection::API::Info::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/apiwork/introspection/api/info/server.rb

Overview

Wraps API server information.

Examples:

api.info.servers.each do |server|
  puts server.url # => "https://api.example.com"
  puts server.description # => "Production server"
end

Instance Method Summary collapse

Constructor Details

#initialize(dump) ⇒ Server

Returns a new instance of Server.



16
17
18
# File 'lib/apiwork/introspection/api/info/server.rb', line 16

def initialize(dump)
  @dump = dump
end

Instance Method Details

#descriptionString?

The server description.

Returns:

  • (String, nil)


32
33
34
# File 'lib/apiwork/introspection/api/info/server.rb', line 32

def description
  @dump[:description]
end

#to_hHash

Converts this server to a hash.

Returns:

  • (Hash)


40
41
42
43
44
45
# File 'lib/apiwork/introspection/api/info/server.rb', line 40

def to_h
  {
    description: description,
    url: url,
  }
end

#urlString?

The server URL.

Returns:

  • (String, nil)


24
25
26
# File 'lib/apiwork/introspection/api/info/server.rb', line 24

def url
  @dump[:url]
end