Class: Nexpose::Service
Overview
A service endpoint on an asset.
Defined Under Namespace
Modules: Protocol
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Name of the service.
-
#port ⇒ Object
readonly
Port on which the service is running.
-
#protocol ⇒ Object
readonly
Protocol used to communicate to the port.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
-
#initialize(port = 0, protocol = Protocol::RAW, name = nil) ⇒ Service
constructor
A new instance of Service.
- #to_h ⇒ Object
Methods inherited from APIObject
Constructor Details
Instance Attribute Details
#name ⇒ Object (readonly)
Name of the service. [Optional]
82 83 84 |
# File 'lib/nexpose/asset.rb', line 82 def name @name end |
#port ⇒ Object (readonly)
Port on which the service is running.
84 85 86 |
# File 'lib/nexpose/asset.rb', line 84 def port @port end |
#protocol ⇒ Object (readonly)
Protocol used to communicate to the port. @see Service::Protocol.
86 87 88 |
# File 'lib/nexpose/asset.rb', line 86 def protocol @protocol end |
Instance Method Details
#<=>(other) ⇒ Object
98 99 100 101 102 103 104 |
# File 'lib/nexpose/asset.rb', line 98 def <=>(other) c = port <=> other.port return c unless c == 0 c = protocol <=> other.protocol return c unless c == 0 name <=> other.name end |
#==(other) ⇒ Object
106 107 108 |
# File 'lib/nexpose/asset.rb', line 106 def ==(other) eql?(other) end |
#eql?(other) ⇒ Boolean
110 111 112 |
# File 'lib/nexpose/asset.rb', line 110 def eql?(other) port.eql?(other.port) && protocol.eql?(other.protocol) && name.eql?(other.name) end |
#to_h ⇒ Object
92 93 94 95 96 |
# File 'lib/nexpose/asset.rb', line 92 def to_h { name: name, port: port, protocol: protocol } end |