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.



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

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

Instance Attribute Details

#attributesObject (readonly)

Group attributes.



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

def attributes
  @attributes
end

#idObject (readonly)

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



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

def id
  @id
end

#nameObject (readonly)

Group account name.



185
186
187
# File 'lib/nexpose/asset.rb', line 185

def name
  @name
end

Instance Method Details

#<=>(other) ⇒ Object



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

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

#==(other) ⇒ Object



211
212
213
# File 'lib/nexpose/asset.rb', line 211

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


215
216
217
# File 'lib/nexpose/asset.rb', line 215

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

#to_hObject



197
198
199
200
201
# File 'lib/nexpose/asset.rb', line 197

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