Class: OvirtSDK4::HostDevicesService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::HostDevicesService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (HostDeviceService) device_service(id)
Locates the
device
service. -
- (Array<HostDevice>) list(opts = {})
Returns the representation of the object managed by this service.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (String) to_s
Returns an string representation of this service.
Instance Method Details
- (HostDeviceService) device_service(id)
Locates the device
service.
9597 9598 9599 |
# File 'lib/ovirtsdk4/services.rb', line 9597 def device_service(id) return HostDeviceService.new(@connection, "#{@path}/#{id}") end |
- (Array<HostDevice>) list(opts = {})
Returns the representation of the object managed by this service.
9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 |
# File 'lib/ovirtsdk4/services.rb', line 9568 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 HostDeviceReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 |
# File 'lib/ovirtsdk4/services.rb', line 9608 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return device_service(path) end return device_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (String) to_s
Returns an string representation of this service.
9624 9625 9626 |
# File 'lib/ovirtsdk4/services.rb', line 9624 def to_s return "#<#{HostDevicesService}:#{@path}>" end |