Class: Nexpose::GroupAccount

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

Overview

Group accounts on an asset.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from APIObject

#object_from_hash

Constructor Details

#initialize(name = nil, id = 0, attributes = []) ⇒ GroupAccount

Returns a new instance of GroupAccount.



193
194
195
196
197
# File 'lib/nexpose/asset.rb', line 193

def initialize(name = nil, id = 0, attributes = [])
  @name = name
  @id = id
  @attributes = attributes
end

Instance Attribute Details

#attributesObject (readonly)

Group attributes.



191
192
193
# File 'lib/nexpose/asset.rb', line 191

def attributes
  @attributes
end

#idObject (readonly)

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



189
190
191
# File 'lib/nexpose/asset.rb', line 189

def id
  @id
end

#nameObject (readonly)

Group account name.



187
188
189
# File 'lib/nexpose/asset.rb', line 187

def name
  @name
end

Instance Method Details

#<=>(other) ⇒ Object



205
206
207
208
209
210
211
# File 'lib/nexpose/asset.rb', line 205

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

#==(other) ⇒ Object



213
214
215
# File 'lib/nexpose/asset.rb', line 213

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


217
218
219
# File 'lib/nexpose/asset.rb', line 217

def eql?(other)
  name.eql?(other.name) && id.eql?(other.id) && attributes.eql?(other.attributes)
end

#to_hObject



199
200
201
202
203
# File 'lib/nexpose/asset.rb', line 199

def to_h
  { name: name,
    id: id,
    attributes: Attributes.to_hash(attributes) }
end