Class: LaunchDarklyApi::UserSettingsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/launchdarkly_api/api/user_settings_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ UserSettingsApi

Returns a new instance of UserSettingsApi.



19
20
21
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_client ⇒ Object

Returns the value of attribute api_client.



17
18
19
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_user_flag_setting(project_key, environment_key, user_key, feature_flag_key, opts = {}) ⇒ UserFlagSetting

Fetch a single flag setting for a user by key.

Parameters:

  • project_key —

    The project key, used to tie the flags together under one project so they can be managed together.

  • environment_key —

    The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

  • user_key —

    The user's key.

  • feature_flag_key —

    The feature flag's key. The key identifies the flag in your code.

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

    the optional parameters

Returns:



29
30
31
32
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 29

def get_user_flag_setting(project_key, environment_key, user_key, feature_flag_key, opts = {})
  data, _status_code, _headers = get_user_flag_setting_with_http_info(project_key, environment_key, user_key, feature_flag_key, opts)
  data
end

#get_user_flag_setting_with_http_info(project_key, environment_key, user_key, feature_flag_key, opts = {}) ⇒ Array<(UserFlagSetting, Fixnum, Hash)>

Fetch a single flag setting for a user by key.

Parameters:

  • project_key —

    The project key, used to tie the flags together under one project so they can be managed together.

  • environment_key —

    The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

  • user_key —

    The user's key.

  • feature_flag_key —

    The feature flag's key. The key identifies the flag in your code.

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

    the optional parameters

Returns:

  • (Array<(UserFlagSetting, Fixnum, Hash)>) —

    UserFlagSetting data, response status code and response headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 41

def get_user_flag_setting_with_http_info(project_key, environment_key, user_key, feature_flag_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserSettingsApi.get_user_flag_setting ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling UserSettingsApi.get_user_flag_setting"
  end
  # verify the required parameter 'environment_key' is set
  if @api_client.config.client_side_validation && environment_key.nil?
    fail ArgumentError, "Missing the required parameter 'environment_key' when calling UserSettingsApi.get_user_flag_setting"
  end
  # verify the required parameter 'user_key' is set
  if @api_client.config.client_side_validation && user_key.nil?
    fail ArgumentError, "Missing the required parameter 'user_key' when calling UserSettingsApi.get_user_flag_setting"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling UserSettingsApi.get_user_flag_setting"
  end
  # resource path
  local_var_path = '/users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'userKey' + '}', user_key.to_s).sub('{' + 'featureFlagKey' + '}', feature_flag_key.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UserFlagSetting')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserSettingsApi#get_user_flag_setting\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_user_flag_settings(project_key, environment_key, user_key, opts = {}) ⇒ UserFlagSettings

Fetch a single flag setting for a user by key.

Parameters:

  • project_key —

    The project key, used to tie the flags together under one project so they can be managed together.

  • environment_key —

    The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

  • user_key —

    The user's key.

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

    the optional parameters

Returns:



98
99
100
101
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 98

def get_user_flag_settings(project_key, environment_key, user_key, opts = {})
  data, _status_code, _headers = get_user_flag_settings_with_http_info(project_key, environment_key, user_key, opts)
  data
end

#get_user_flag_settings_with_http_info(project_key, environment_key, user_key, opts = {}) ⇒ Array<(UserFlagSettings, Fixnum, Hash)>

Fetch a single flag setting for a user by key.

Parameters:

  • project_key —

    The project key, used to tie the flags together under one project so they can be managed together.

  • environment_key —

    The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

  • user_key —

    The user's key.

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

    the optional parameters

Returns:

  • (Array<(UserFlagSettings, Fixnum, Hash)>) —

    UserFlagSettings data, response status code and response headers



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 109

def get_user_flag_settings_with_http_info(project_key, environment_key, user_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserSettingsApi.get_user_flag_settings ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling UserSettingsApi.get_user_flag_settings"
  end
  # verify the required parameter 'environment_key' is set
  if @api_client.config.client_side_validation && environment_key.nil?
    fail ArgumentError, "Missing the required parameter 'environment_key' when calling UserSettingsApi.get_user_flag_settings"
  end
  # verify the required parameter 'user_key' is set
  if @api_client.config.client_side_validation && user_key.nil?
    fail ArgumentError, "Missing the required parameter 'user_key' when calling UserSettingsApi.get_user_flag_settings"
  end
  # resource path
  local_var_path = '/users/{projectKey}/{environmentKey}/{userKey}/flags'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'userKey' + '}', user_key.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UserFlagSettings')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserSettingsApi#get_user_flag_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#put_flag_setting(project_key, environment_key, user_key, feature_flag_key, user_settings_body, opts = {}) ⇒ nil

Specifically enable or disable a feature flag for a user based on their key.

Parameters:

  • project_key —

    The project key, used to tie the flags together under one project so they can be managed together.

  • environment_key —

    The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

  • user_key —

    The user's key.

  • feature_flag_key —

    The feature flag's key. The key identifies the flag in your code.

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

    the optional parameters

Returns:

  • (nil)


164
165
166
167
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 164

def put_flag_setting(project_key, environment_key, user_key, feature_flag_key, , opts = {})
  put_flag_setting_with_http_info(project_key, environment_key, user_key, feature_flag_key, , opts)
  nil
end

#put_flag_setting_with_http_info(project_key, environment_key, user_key, feature_flag_key, user_settings_body, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Specifically enable or disable a feature flag for a user based on their key.

Parameters:

  • project_key —

    The project key, used to tie the flags together under one project so they can be managed together.

  • environment_key —

    The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

  • user_key —

    The user's key.

  • feature_flag_key —

    The feature flag's key. The key identifies the flag in your code.

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

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>) —

    nil, response status code and response headers



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 177

def put_flag_setting_with_http_info(project_key, environment_key, user_key, feature_flag_key, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserSettingsApi.put_flag_setting ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling UserSettingsApi.put_flag_setting"
  end
  # verify the required parameter 'environment_key' is set
  if @api_client.config.client_side_validation && environment_key.nil?
    fail ArgumentError, "Missing the required parameter 'environment_key' when calling UserSettingsApi.put_flag_setting"
  end
  # verify the required parameter 'user_key' is set
  if @api_client.config.client_side_validation && user_key.nil?
    fail ArgumentError, "Missing the required parameter 'user_key' when calling UserSettingsApi.put_flag_setting"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling UserSettingsApi.put_flag_setting"
  end
  # verify the required parameter 'user_settings_body' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'user_settings_body' when calling UserSettingsApi.put_flag_setting"
  end
  # resource path
  local_var_path = '/users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'userKey' + '}', user_key.to_s).sub('{' + 'featureFlagKey' + '}', feature_flag_key.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body()
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserSettingsApi#put_flag_setting\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end