Class: Nexpose::UniqueIdentifier

Inherits:
APIObject show all
Defined in:
lib/nexpose/asset.rb

Overview

Unique system identifiers on an asset.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from APIObject

#object_from_hash

Constructor Details

#initialize(source = nil, id = nil) ⇒ UniqueIdentifier

Returns a new instance of UniqueIdentifier.



276
277
278
279
# File 'lib/nexpose/asset.rb', line 276

def initialize(source = nil, id = nil)
  @id     = id
  @source = source
end

Instance Attribute Details

#idObject (readonly)

Unique identifier of the user as determined by the asset (not Nexpose).



274
275
276
# File 'lib/nexpose/asset.rb', line 274

def id
  @id
end

#sourceObject (readonly)

The source name for the uniuqe identifier.



272
273
274
# File 'lib/nexpose/asset.rb', line 272

def source
  @source
end

Instance Method Details

#<=>(other) ⇒ Object



286
287
288
289
290
# File 'lib/nexpose/asset.rb', line 286

def <=>(other)
  c = source <=> other.source
  return c unless c.zero?
  id <=> other.id
end

#==(other) ⇒ Object



292
293
294
# File 'lib/nexpose/asset.rb', line 292

def ==(other)
  eql?(other)
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


296
297
298
# File 'lib/nexpose/asset.rb', line 296

def eql?(other)
  source.eql?(other.source) && id.eql?(other.id)
end

#to_hObject



281
282
283
284
# File 'lib/nexpose/asset.rb', line 281

def to_h
  { source: source,
    id: id }
end