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.

Parameters:

  • opts (Hash) (defaults to: {})

    A hash containing the attributes of the object. The keys of the hash should be symbols corresponding to the names of the attributes. The values of the hash should be the values of the attributes.

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.



13188
13189
13190
13191
13192
13193
# File 'lib/ovirtsdk4/types.rb', line 13188

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.



13198
13199
13200
13201
13202
13203
# File 'lib/ovirtsdk4/types.rb', line 13198

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

#filesArray<File>

Returns the value of the files attribute.

Returns:



13117
13118
13119
# File 'lib/ovirtsdk4/types.rb', line 13117

def files
  @files
end

#files=(list) ⇒ Object

Sets the value of the files attribute.

Parameters:

  • list (Array<File>)


13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
# File 'lib/ovirtsdk4/types.rb', line 13126

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.



13208
13209
13210
13211
13212
13213
# File 'lib/ovirtsdk4/types.rb', line 13208

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

#typeVmDeviceType

Returns the value of the type attribute.

Returns:



13143
13144
13145
# File 'lib/ovirtsdk4/types.rb', line 13143

def type
  @type
end

#type=(value) ⇒ Object

Sets the value of the type attribute.

Parameters:



13152
13153
13154
# File 'lib/ovirtsdk4/types.rb', line 13152

def type=(value)
  @type = value
end

#volume_idString

Returns the value of the volume_id attribute.

Returns:

  • (String)


13161
13162
13163
# File 'lib/ovirtsdk4/types.rb', line 13161

def volume_id
  @volume_id
end

#volume_id=(value) ⇒ Object

Sets the value of the volume_id attribute.

Parameters:

  • value (String)


13170
13171
13172
# File 'lib/ovirtsdk4/types.rb', line 13170

def volume_id=(value)
  @volume_id = value
end