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:



29736
29737
29738
# File 'lib/ovirtsdk4/services.rb', line 29736

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:



29781
29782
29783
# File 'lib/ovirtsdk4/services.rb', line 29781

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:



29792
29793
29794
# File 'lib/ovirtsdk4/services.rb', line 29792

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.



29803
29804
29805
29806
29807
29808
29809
29810
29811
29812
# File 'lib/ovirtsdk4/services.rb', line 29803

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