Class: LaunchDarklyApi::UserSegmentsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ UserSegmentsApi

Returns a new instance of UserSegmentsApi.



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

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



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

def api_client
  @api_client
end

Instance Method Details

#delete_user_segment(project_key, environment_key, user_segment_key, opts = {}) ⇒ nil

Delete a user segment.

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_segment_key

    The user segment's key. The key identifies the user segment in your code.

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

    the optional parameters

Returns:

  • (nil)


30
31
32
33
# File 'lib/launchdarkly_api/api/user_segments_api.rb', line 30

def delete_user_segment(project_key, environment_key, user_segment_key, opts = {})
  delete_user_segment_with_http_info(project_key, environment_key, user_segment_key, opts)
  return nil
end

#delete_user_segment_with_http_info(project_key, environment_key, user_segment_key, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete a user segment.

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_segment_key

    The user segment&#39;s key. The key identifies the user segment in your code.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
# File 'lib/launchdarkly_api/api/user_segments_api.rb', line 42

def delete_user_segment_with_http_info(project_key, environment_key, user_segment_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UserSegmentsApi.delete_user_segment ..."
  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 UserSegmentsApi.delete_user_segment"
  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 UserSegmentsApi.delete_user_segment"
  end
  # verify the required parameter 'user_segment_key' is set
  if @api_client.config.client_side_validation && user_segment_key.nil?
    fail ArgumentError, "Missing the required parameter 'user_segment_key' when calling UserSegmentsApi.delete_user_segment"
  end
  # resource path
  local_var_path = "/segments/{projectKey}/{environmentKey}/{userSegmentKey}".sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'userSegmentKey' + '}', user_segment_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(:DELETE, 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: UserSegmentsApi#delete_user_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_user_segment(project_key, environment_key, user_segment_key, opts = {}) ⇒ UserSegment

Get a single user segment 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_segment_key

    The user segment&#39;s key. The key identifies the user segment in your code.

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

    the optional parameters

Returns:



96
97
98
99
# File 'lib/launchdarkly_api/api/user_segments_api.rb', line 96

def get_user_segment(project_key, environment_key, user_segment_key, opts = {})
  data, _status_code, _headers = get_user_segment_with_http_info(project_key, environment_key, user_segment_key, opts)
  return data
end

#get_user_segment_with_http_info(project_key, environment_key, user_segment_key, opts = {}) ⇒ Array<(UserSegment, Fixnum, Hash)>

Get a single user segment 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_segment_key

    The user segment&#39;s key. The key identifies the user segment in your code.

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

    the optional parameters

Returns:

  • (Array<(UserSegment, Fixnum, Hash)>)

    UserSegment data, response status code and response headers



108
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
# File 'lib/launchdarkly_api/api/user_segments_api.rb', line 108

def get_user_segment_with_http_info(project_key, environment_key, user_segment_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UserSegmentsApi.get_user_segment ..."
  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 UserSegmentsApi.get_user_segment"
  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 UserSegmentsApi.get_user_segment"
  end
  # verify the required parameter 'user_segment_key' is set
  if @api_client.config.client_side_validation && user_segment_key.nil?
    fail ArgumentError, "Missing the required parameter 'user_segment_key' when calling UserSegmentsApi.get_user_segment"
  end
  # resource path
  local_var_path = "/segments/{projectKey}/{environmentKey}/{userSegmentKey}".sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'userSegmentKey' + '}', user_segment_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 => 'UserSegment')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserSegmentsApi#get_user_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_user_segments(project_key, environment_key, opts = {}) ⇒ UserSegments

Get a list of all user segments in the given project.

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.

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

    the optional parameters

Options Hash (opts):

  • :tag (String)

    Filter by tag. A tag can be used to group flags across projects.

Returns:



163
164
165
166
# File 'lib/launchdarkly_api/api/user_segments_api.rb', line 163

def get_user_segments(project_key, environment_key, opts = {})
  data, _status_code, _headers = get_user_segments_with_http_info(project_key, environment_key, opts)
  return data
end

#get_user_segments_with_http_info(project_key, environment_key, opts = {}) ⇒ Array<(UserSegments, Fixnum, Hash)>

Get a list of all user segments in the given project.

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.

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

    the optional parameters

Options Hash (opts):

  • :tag (String)

    Filter by tag. A tag can be used to group flags across projects.

Returns:

  • (Array<(UserSegments, Fixnum, Hash)>)

    UserSegments data, response status code and response headers



175
176
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
# File 'lib/launchdarkly_api/api/user_segments_api.rb', line 175

def get_user_segments_with_http_info(project_key, environment_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UserSegmentsApi.get_user_segments ..."
  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 UserSegmentsApi.get_user_segments"
  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 UserSegmentsApi.get_user_segments"
  end
  # resource path
  local_var_path = "/segments/{projectKey}/{environmentKey}".sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s)

  # query parameters
  query_params = {}
  query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?

  # 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 => 'UserSegments')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserSegmentsApi#get_user_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_user_segment(project_key, environment_key, user_segment_key, patch_only, opts = {}) ⇒ UserSegment

Perform a partial update to a user segment.

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_segment_key

    The user segment&#39;s key. The key identifies the user segment in your code.

  • patch_only

    Requires a JSON Patch representation of the desired changes to the project. &#39;jsonpatch.com/&#39; Feature flag patches also support JSON Merge Patch format. &#39;tools.ietf.org/html/rfc7386&#39; The addition of comments is also supported.

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

    the optional parameters

Returns:



228
229
230
231
# File 'lib/launchdarkly_api/api/user_segments_api.rb', line 228

def patch_user_segment(project_key, environment_key, user_segment_key, patch_only, opts = {})
  data, _status_code, _headers = patch_user_segment_with_http_info(project_key, environment_key, user_segment_key, patch_only, opts)
  return data
end

#patch_user_segment_with_http_info(project_key, environment_key, user_segment_key, patch_only, opts = {}) ⇒ Array<(UserSegment, Fixnum, Hash)>

Perform a partial update to a user segment.

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_segment_key

    The user segment&#39;s key. The key identifies the user segment in your code.

  • patch_only

    Requires a JSON Patch representation of the desired changes to the project. &#39;jsonpatch.com/&#39; Feature flag patches also support JSON Merge Patch format. &#39;tools.ietf.org/html/rfc7386&#39; The addition of comments is also supported.

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

    the optional parameters

Returns:

  • (Array<(UserSegment, Fixnum, Hash)>)

    UserSegment data, response status code and response headers



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/launchdarkly_api/api/user_segments_api.rb', line 241

def patch_user_segment_with_http_info(project_key, environment_key, user_segment_key, patch_only, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UserSegmentsApi.patch_user_segment ..."
  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 UserSegmentsApi.patch_user_segment"
  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 UserSegmentsApi.patch_user_segment"
  end
  # verify the required parameter 'user_segment_key' is set
  if @api_client.config.client_side_validation && user_segment_key.nil?
    fail ArgumentError, "Missing the required parameter 'user_segment_key' when calling UserSegmentsApi.patch_user_segment"
  end
  # verify the required parameter 'patch_only' is set
  if @api_client.config.client_side_validation && patch_only.nil?
    fail ArgumentError, "Missing the required parameter 'patch_only' when calling UserSegmentsApi.patch_user_segment"
  end
  # resource path
  local_var_path = "/segments/{projectKey}/{environmentKey}/{userSegmentKey}".sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'userSegmentKey' + '}', user_segment_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(patch_only)
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UserSegment')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserSegmentsApi#patch_user_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_user_segment(project_key, environment_key, user_segment_body, opts = {}) ⇒ nil

Creates a new user segment.

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_segment_body

    Create a new user segment.

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

    the optional parameters

Returns:

  • (nil)


300
301
302
303
# File 'lib/launchdarkly_api/api/user_segments_api.rb', line 300

def post_user_segment(project_key, environment_key, user_segment_body, opts = {})
  post_user_segment_with_http_info(project_key, environment_key, user_segment_body, opts)
  return nil
end

#post_user_segment_with_http_info(project_key, environment_key, user_segment_body, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Creates a new user segment.

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_segment_body

    Create a new user segment.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/launchdarkly_api/api/user_segments_api.rb', line 312

def post_user_segment_with_http_info(project_key, environment_key, user_segment_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UserSegmentsApi.post_user_segment ..."
  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 UserSegmentsApi.post_user_segment"
  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 UserSegmentsApi.post_user_segment"
  end
  # verify the required parameter 'user_segment_body' is set
  if @api_client.config.client_side_validation && user_segment_body.nil?
    fail ArgumentError, "Missing the required parameter 'user_segment_body' when calling UserSegmentsApi.post_user_segment"
  end
  # resource path
  local_var_path = "/segments/{projectKey}/{environmentKey}".sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_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(user_segment_body)
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:POST, 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: UserSegmentsApi#post_user_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end