Class: OvirtSDK4::FilesService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::FilesService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (FileService) file_service(id)
Locates the
file
service. -
- (Array<File>) 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
- (FileService) file_service(id)
Locates the file
service.
8146 8147 8148 |
# File 'lib/ovirtsdk4/services.rb', line 8146 def file_service(id) return FileService.new(@connection, "#{@path}/#{id}") end |
- (Array<File>) list(opts = {})
Returns the representation of the object managed by this service.
8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 |
# File 'lib/ovirtsdk4/services.rb', line 8108 def list(opts = {}) query = {} value = opts[:case_sensitive] unless value.nil? value = Writer.render_boolean(value) query['case_sensitive'] = value end value = opts[:max] unless value.nil? value = Writer.render_integer(value) query['max'] = value end value = opts[:search] unless value.nil? query['search'] = 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 FileReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 |
# File 'lib/ovirtsdk4/services.rb', line 8157 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return file_service(path) end return file_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (String) to_s
Returns an string representation of this service.
8173 8174 8175 |
# File 'lib/ovirtsdk4/services.rb', line 8173 def to_s return "#<#{FilesService}:#{@path}>" end |