Class: OvirtSDK4::UserOptionsService

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

Instance Method Summary collapse

Methods inherited from Service

#inspect, #to_s

Instance Method Details

#add(option, opts = {}) ⇒ UserOption

Adds a new user profile property of type JSON.

Example request(for user with identifier 123):

POST /ovirt-engine/api/users/123/options

Payload:

  <user_option>
    <name>SomeName</name>
    <content>["any", "JSON"]</content>
  </user_option>

Parameters:

  • option (UserOption)

    The option to add.

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

    Additional options.

Options Hash (opts):

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:


29355
29356
29357
# File 'lib/ovirtsdk4/services.rb', line 29355

def add(option, opts = {})
  internal_add(option, UserOption, ADD, opts)
end

#list(opts = {}) ⇒ Array<UserOption>

Returns a list of user profile properties of type JSON.

Example request(for user with identifier 123):

GET /ovirt-engine/api/users/123/options

The result will be the following XML document:

<user_options>
  <user_option href="/ovirt-engine/api/users/123/options/456" id="456">
    <name>SomeName</name>
    <content>["any", "JSON"]</content>
    <user href="/ovirt-engine/api/users/123" id="123"/>
  </user_option>
</user_options>

Parameters:

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

    Additional options.

Options Hash (opts):

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:


29400
29401
29402
# File 'lib/ovirtsdk4/services.rb', line 29400

def list(opts = {})
  internal_get(LIST, opts)
end

#option_service(id) ⇒ UserOptionService

Locates the option service.

Parameters:

  • id (String)

    The identifier of the option.

Returns:


29411
29412
29413
# File 'lib/ovirtsdk4/services.rb', line 29411

def option_service(id)
  UserOptionService.new(self, id)
end

#service(path) ⇒ Service

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.


29422
29423
29424
29425
29426
29427
29428
29429
29430
29431
# File 'lib/ovirtsdk4/services.rb', line 29422

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