Module: Gitlab::Client::Features

Included in:
Gitlab::Client
Defined in:
lib/gitlab/client/features.rb

Overview

Defines methods related to feature flags. docs.gitlab.com/ce/api/features.html

Instance Method Summary collapse

Instance Method Details

#delete_feature(name) ⇒ void

This method returns an undefined value.

Delete a feature.

Examples:

Gitlab.delete_feature('new_library')

Parameters:

  • name (String)

    Name of the feature to delete



44
45
46
# File 'lib/gitlab/client/features.rb', line 44

def delete_feature(name)
  delete("/features/#{name}")
end

#featuresArray<Gitlab::ObjectifiedHash>

Get a list of all persisted features, with its gate values.

Examples:

Gitlab.features

Returns:



13
14
15
# File 'lib/gitlab/client/features.rb', line 13

def features
  get('/features')
end

#set_feature(name, value, options = {}) ⇒ Gitlab::ObjectifiedHash

Set a features gate value. If a feature with the given name does not exist yet it will be created. The value can be a boolean, or an integer to indicate percentage of time.

Examples:

Gitlab.set_feature('new_library', true)
Gitlab.set_feature('new_library', 8)
Gitlab.set_feature('new_library', true, {user: 'gitlab'})

Parameters:

  • name(required) (String)

    Name of the feature to create or update

  • value(required) (String, Integer)

    true or false to enable/disable, or an integer for percentage of time

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

    A customizable set of options.

Options Hash (options):

  • :feature_group(optional) (String)

    A Feature group name

  • :user(optional) (String)

    A GitLab username

  • :project(optional) (String)

    A projects path, for example “gitlab-org/gitlab-ce”

Returns:



32
33
34
35
# File 'lib/gitlab/client/features.rb', line 32

def set_feature(name, value, options = {})
  body = { value: value }.merge(options)
  post("/features/#{name}", body: body)
end