Class: OvirtSDK4::ImagesService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::ImagesService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (ImageService) image_service(id)
Locates the
image
service. -
- (Array<Image>) 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
- (ImageService) image_service(id)
Locates the image
service.
10528 10529 10530 |
# File 'lib/ovirtsdk4/services.rb', line 10528 def image_service(id) return ImageService.new(@connection, "#{@path}/#{id}") end |
- (Array<Image>) list(opts = {})
Returns the representation of the object managed by this service.
10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 |
# File 'lib/ovirtsdk4/services.rb', line 10499 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 ImageReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 |
# File 'lib/ovirtsdk4/services.rb', line 10539 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return image_service(path) end return image_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (String) to_s
Returns an string representation of this service.
10555 10556 10557 |
# File 'lib/ovirtsdk4/services.rb', line 10555 def to_s return "#<#{ImagesService}:#{@path}>" end |