Class: OvirtSDK4::IconsService

Inherits:
Service
  • Object
show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary (collapse)

Instance Method Details

- (IconService) icon_service(id)

Locates the icon service.

Parameters:

  • id (String)

    The identifier of the icon.

Returns:



10353
10354
10355
# File 'lib/ovirtsdk4/services.rb', line 10353

def icon_service(id)
  return IconService.new(@connection, "#{@path}/#{id}")
end

- (Array<Icon>) list(opts = {})

Returns the representation of the object managed by this service.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :max (Integer)

    Sets the maximum number of icons to return. If not specified all the icons are returned.

Returns:



10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
# File 'lib/ovirtsdk4/services.rb', line 10324

def list(opts = {})
  query = {}
  value = opts[:max]
  unless value.nil?
    value = Writer.render_integer(value)
    query['max'] = value
  end
  request = Request.new(:method => :GET, :path => @path, :query => query)
  response = @connection.send(request)
  case response.code
  when 200
    begin
      reader = XmlReader.new(response.body)
      return IconReader.read_many(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (Service) service(path)

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.



10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
# File 'lib/ovirtsdk4/services.rb', line 10364

def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return icon_service(path)
  end
  return icon_service(path[0..(index - 1)]).service(path[(index +1)..-1])
end

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


10380
10381
10382
# File 'lib/ovirtsdk4/services.rb', line 10380

def to_s
  return "#<#{IconsService}:#{@path}>"
end