Class: OvirtSDK4::Payload

Inherits:
Struct
  • Object
show all
Defined in:
lib/ovirtsdk4/types.rb,
lib/ovirtsdk4/types.rb

Instance Method Summary collapse

Methods included from Type

#dig, #href, #href=

Constructor Details

#initialize(opts = {}) ⇒ Payload

Creates a new instance of the OvirtSDK4::Payload class.

Options Hash (opts):

  • :files (Array<File>, Array<Hash>)

    The values of attribute files.

  • :type (VmDeviceType)

    The value of attribute type.

  • :volume_id (String)

    The value of attribute volume_id.



14316
14317
14318
14319
14320
14321
# File 'lib/ovirtsdk4/types.rb', line 14316

def initialize(opts = {})
  super(opts)
  self.files = opts[:files]
  self.type = opts[:type]
  self.volume_id = opts[:volume_id]
end

Instance Method Details

#==(other) ⇒ Object

Returns true if self and other have the same attributes and values.



14326
14327
14328
14329
14330
14331
# File 'lib/ovirtsdk4/types.rb', line 14326

def ==(other)
  super &&
  @files == other.files &&
  @type == other.type &&
  @volume_id == other.volume_id
end

#filesArray<File>

Returns the value of the files attribute.



14245
14246
14247
# File 'lib/ovirtsdk4/types.rb', line 14245

def files
  @files
end

#files=(list) ⇒ Object

Sets the value of the files attribute.



14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
# File 'lib/ovirtsdk4/types.rb', line 14254

def files=(list)
  if list.class == Array
    list = List.new(list)
    list.each_with_index do |value, index|
      if value.is_a?(Hash)
        list[index] = File.new(value)
      end
    end
  end
  @files = list
end

#hashObject

Generates a hash value for this object.



14336
14337
14338
14339
14340
14341
# File 'lib/ovirtsdk4/types.rb', line 14336

def hash
  super +
  @files.hash +
  @type.hash +
  @volume_id.hash
end

#typeVmDeviceType

Returns the value of the type attribute.



14271
14272
14273
# File 'lib/ovirtsdk4/types.rb', line 14271

def type
  @type
end

#type=(value) ⇒ Object

Sets the value of the type attribute.



14280
14281
14282
# File 'lib/ovirtsdk4/types.rb', line 14280

def type=(value)
  @type = value
end

#volume_idString

Returns the value of the volume_id attribute.



14289
14290
14291
# File 'lib/ovirtsdk4/types.rb', line 14289

def volume_id
  @volume_id
end

#volume_id=(value) ⇒ Object

Sets the value of the volume_id attribute.



14298
14299
14300
# File 'lib/ovirtsdk4/types.rb', line 14298

def volume_id=(value)
  @volume_id = value
end