Class: LaunchDarklyApi::HoldoutsBetaApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ HoldoutsBetaApi

Returns a new instance of HoldoutsBetaApi.



19
20
21
# File 'lib/launchdarkly_api/api/holdouts_beta_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/holdouts_beta_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_all_holdouts(project_key, environment_key, opts = {}) ⇒ HoldoutsCollectionRep

Get all holdouts

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The number of holdouts to return in the response. Defaults to 20

  • :offset (Integer)

    Where to start in the list. Use this with pagination. For example, an `offset` of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`.

Returns:



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

def get_all_holdouts(project_key, environment_key, opts = {})
  data, _status_code, _headers = get_all_holdouts_with_http_info(project_key, environment_key, opts)
  data
end

#get_all_holdouts_with_http_info(project_key, environment_key, opts = {}) ⇒ Array<(HoldoutsCollectionRep, Integer, Hash)>

Get all holdouts

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The number of holdouts to return in the response. Defaults to 20

  • :offset (Integer)

    Where to start in the list. Use this with pagination. For example, an &#x60;offset&#x60; of 10 skips the first ten items and then returns the next items in the list, up to the query &#x60;limit&#x60;.

Returns:

  • (Array<(HoldoutsCollectionRep, Integer, Hash)>)

    HoldoutsCollectionRep 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
92
93
# File 'lib/launchdarkly_api/api/holdouts_beta_api.rb', line 41

def get_all_holdouts_with_http_info(project_key, environment_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: HoldoutsBetaApi.get_all_holdouts ...'
  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 HoldoutsBetaApi.get_all_holdouts"
  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 HoldoutsBetaApi.get_all_holdouts"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}/holdouts'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'HoldoutsCollectionRep'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"HoldoutsBetaApi.get_all_holdouts",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: HoldoutsBetaApi#get_all_holdouts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_holdout(project_key, environment_key, holdout_key, opts = {}) ⇒ HoldoutDetailRep

Get holdout Get details about a holdout. ### Expanding the holdout response LaunchDarkly supports the following fields for expanding the "Get holdout" response. By default, these fields are not included in the response. To expand the response, append the ‘expand` query parameter and add a comma-separated list with any of the following fields: - `draftIteration` includes the iteration which has not been started yet, if any, for this holdout. - `previousIterations` includes all iterations prior to the current iteration, for this holdout. By default only the current iteration is included in the response. - `rel-draftIteration` includes the iteration which has not been started yet, if any, for the experiments related to this holdout. - `rel-metrics` includes metrics for experiments related to this holdout. - `rel-previousIterations` includes all iterations prior to the current iteration, for the experiments related to this holdout. - `rel-secondaryMetrics` includes secondary metrics for experiments related to this holdout. - `rel-treatments` includes all treatment and parameter details for experiments related to this holdout. - `secondaryMetrics` includes secondary metrics for this holdout. By default only the primary metric is included in the response. - `treatments` includes all treatment and parameter details for this holdout. By default treatment data is not included in the response. For example, `expand=draftIteration,rel-draftIteration` includes the `draftIteration` and `rel-draftIteration` fields in the response. If fields that you request with the `expand` query parameter are empty, they are not included in the response.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • holdout_key (String)

    The holdout experiment key

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

    the optional parameters

Options Hash (opts):

  • :expand (String)

    A comma-separated list of properties that can reveal additional information in the response. Supported fields are explained above. Holdout experiment expansion fields have no prefix. Related experiment expansion fields have &#x60;rel-&#x60; as a prefix.

Returns:



103
104
105
106
# File 'lib/launchdarkly_api/api/holdouts_beta_api.rb', line 103

def get_holdout(project_key, environment_key, holdout_key, opts = {})
  data, _status_code, _headers = get_holdout_with_http_info(project_key, environment_key, holdout_key, opts)
  data
end

#get_holdout_by_id(project_key, environment_key, holdout_id, opts = {}) ⇒ HoldoutRep

Get Holdout by Id

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • holdout_id (String)

    The holdout experiment ID

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

    the optional parameters

Returns:



179
180
181
182
# File 'lib/launchdarkly_api/api/holdouts_beta_api.rb', line 179

def get_holdout_by_id(project_key, environment_key, holdout_id, opts = {})
  data, _status_code, _headers = get_holdout_by_id_with_http_info(project_key, environment_key, holdout_id, opts)
  data
end

#get_holdout_by_id_with_http_info(project_key, environment_key, holdout_id, opts = {}) ⇒ Array<(HoldoutRep, Integer, Hash)>

Get Holdout by Id

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • holdout_id (String)

    The holdout experiment ID

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

    the optional parameters

Returns:

  • (Array<(HoldoutRep, Integer, Hash)>)

    HoldoutRep data, response status code and response headers



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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/launchdarkly_api/api/holdouts_beta_api.rb', line 190

def get_holdout_by_id_with_http_info(project_key, environment_key, holdout_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: HoldoutsBetaApi.get_holdout_by_id ...'
  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 HoldoutsBetaApi.get_holdout_by_id"
  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 HoldoutsBetaApi.get_holdout_by_id"
  end
  # verify the required parameter 'holdout_id' is set
  if @api_client.config.client_side_validation && holdout_id.nil?
    fail ArgumentError, "Missing the required parameter 'holdout_id' when calling HoldoutsBetaApi.get_holdout_by_id"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}/holdouts/id/{holdoutId}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'holdoutId' + '}', CGI.escape(holdout_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'HoldoutRep'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"HoldoutsBetaApi.get_holdout_by_id",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: HoldoutsBetaApi#get_holdout_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_holdout_with_http_info(project_key, environment_key, holdout_key, opts = {}) ⇒ Array<(HoldoutDetailRep, Integer, Hash)>

Get holdout Get details about a holdout. ### Expanding the holdout response LaunchDarkly supports the following fields for expanding the &quot;Get holdout&quot; response. By default, these fields are not included in the response. To expand the response, append the &#x60;expand&#x60; query parameter and add a comma-separated list with any of the following fields: - &#x60;draftIteration&#x60; includes the iteration which has not been started yet, if any, for this holdout. - &#x60;previousIterations&#x60; includes all iterations prior to the current iteration, for this holdout. By default only the current iteration is included in the response. - &#x60;rel-draftIteration&#x60; includes the iteration which has not been started yet, if any, for the experiments related to this holdout. - &#x60;rel-metrics&#x60; includes metrics for experiments related to this holdout. - &#x60;rel-previousIterations&#x60; includes all iterations prior to the current iteration, for the experiments related to this holdout. - &#x60;rel-secondaryMetrics&#x60; includes secondary metrics for experiments related to this holdout. - &#x60;rel-treatments&#x60; includes all treatment and parameter details for experiments related to this holdout. - &#x60;secondaryMetrics&#x60; includes secondary metrics for this holdout. By default only the primary metric is included in the response. - &#x60;treatments&#x60; includes all treatment and parameter details for this holdout. By default treatment data is not included in the response. For example, &#x60;expand&#x3D;draftIteration,rel-draftIteration&#x60; includes the &#x60;draftIteration&#x60; and &#x60;rel-draftIteration&#x60; fields in the response. If fields that you request with the &#x60;expand&#x60; query parameter are empty, they are not included in the response.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • holdout_key (String)

    The holdout experiment key

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

    the optional parameters

Options Hash (opts):

  • :expand (String)

    A comma-separated list of properties that can reveal additional information in the response. Supported fields are explained above. Holdout experiment expansion fields have no prefix. Related experiment expansion fields have &#x60;rel-&#x60; as a prefix.

Returns:

  • (Array<(HoldoutDetailRep, Integer, Hash)>)

    HoldoutDetailRep data, response status code and response headers



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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/launchdarkly_api/api/holdouts_beta_api.rb', line 116

def get_holdout_with_http_info(project_key, environment_key, holdout_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: HoldoutsBetaApi.get_holdout ...'
  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 HoldoutsBetaApi.get_holdout"
  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 HoldoutsBetaApi.get_holdout"
  end
  # verify the required parameter 'holdout_key' is set
  if @api_client.config.client_side_validation && holdout_key.nil?
    fail ArgumentError, "Missing the required parameter 'holdout_key' when calling HoldoutsBetaApi.get_holdout"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}/holdouts/{holdoutKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'holdoutKey' + '}', CGI.escape(holdout_key.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'HoldoutDetailRep'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"HoldoutsBetaApi.get_holdout",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: HoldoutsBetaApi#get_holdout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_holdout(project_key, environment_key, holdout_key, holdout_patch_input, opts = {}) ⇒ HoldoutRep

Patch holdout Updates an existing holdout, and returns the updated holdout. Updating holdouts uses the semantic patch format. To make a semantic patch request, you must append ‘domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](launchdarkly.com/docs/api#updates-using-semantic-patch). ### Instructions Semantic patch requests support the following `kind` instructions for updating holdouts. <details> <summary>Click to expand instructions for <strong>updating holdouts</strong></summary> #### endHoldout Ends a holdout. ##### Parameters None. Here’s an example: “‘json { "comment": "Optional comment describing why the holdout is ending", "instructions": [{ "kind": "endHoldout" }] } “` #### removeExperiment Removes an experiment from a holdout. ##### Parameters - `value`: The key of the experiment to remove Here’s an example: “‘json { "comment": "Optional comment describing the change", "instructions": [{ "kind": "removeExperiment", "value": "experiment-key" }] } “` #### updateDescription Updates the description of the holdout. ##### Parameters - `value`: The new description. Here’s an example: “‘json { "comment": "Optional comment describing the update", "instructions": [{ "kind": "updateDescription", "value": "Updated holdout description" }] } “` #### updateName Updates the name of the holdout. ##### Parameters - `value`: The new name. Here’s an example: “‘json { "comment": "Optional comment describing the update", "instructions": [{ "kind": "updateName", "value": "Updated holdout name" }] } “` </details>

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • holdout_key (String)

    The holdout key

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

    the optional parameters

Returns:



254
255
256
257
# File 'lib/launchdarkly_api/api/holdouts_beta_api.rb', line 254

def patch_holdout(project_key, environment_key, holdout_key, holdout_patch_input, opts = {})
  data, _status_code, _headers = patch_holdout_with_http_info(project_key, environment_key, holdout_key, holdout_patch_input, opts)
  data
end

#patch_holdout_with_http_info(project_key, environment_key, holdout_key, holdout_patch_input, opts = {}) ⇒ Array<(HoldoutRep, Integer, Hash)>

Patch holdout Updates an existing holdout, and returns the updated holdout. Updating holdouts uses the semantic patch format. To make a semantic patch request, you must append &#x60;domain-model&#x3D;launchdarkly.semanticpatch&#x60; to your &#x60;Content-Type&#x60; header. To learn more, read [Updates using semantic patch](launchdarkly.com/docs/api#updates-using-semantic-patch). ### Instructions Semantic patch requests support the following &#x60;kind&#x60; instructions for updating holdouts. &lt;details&gt; &lt;summary&gt;Click to expand instructions for &lt;strong&gt;updating holdouts&lt;/strong&gt;&lt;/summary&gt; #### endHoldout Ends a holdout. ##### Parameters None. Here&#39;s an example: &#x60;&#x60;&#x60;json { &quot;comment&quot;: &quot;Optional comment describing why the holdout is ending&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;endHoldout&quot; }] } &#x60;&#x60;&#x60; #### removeExperiment Removes an experiment from a holdout. ##### Parameters - &#x60;value&#x60;: The key of the experiment to remove Here&#39;s an example: &#x60;&#x60;&#x60;json { &quot;comment&quot;: &quot;Optional comment describing the change&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;removeExperiment&quot;, &quot;value&quot;: &quot;experiment-key&quot; }] } &#x60;&#x60;&#x60; #### updateDescription Updates the description of the holdout. ##### Parameters - &#x60;value&#x60;: The new description. Here&#39;s an example: &#x60;&#x60;&#x60;json { &quot;comment&quot;: &quot;Optional comment describing the update&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;updateDescription&quot;, &quot;value&quot;: &quot;Updated holdout description&quot; }] } &#x60;&#x60;&#x60; #### updateName Updates the name of the holdout. ##### Parameters - &#x60;value&#x60;: The new name. Here&#39;s an example: &#x60;&#x60;&#x60;json { &quot;comment&quot;: &quot;Optional comment describing the update&quot;, &quot;instructions&quot;: [{ &quot;kind&quot;: &quot;updateName&quot;, &quot;value&quot;: &quot;Updated holdout name&quot; }] } &#x60;&#x60;&#x60; &lt;/details&gt;

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • holdout_key (String)

    The holdout key

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

    the optional parameters

Returns:

  • (Array<(HoldoutRep, Integer, Hash)>)

    HoldoutRep data, response status code and response headers



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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/launchdarkly_api/api/holdouts_beta_api.rb', line 267

def patch_holdout_with_http_info(project_key, environment_key, holdout_key, holdout_patch_input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: HoldoutsBetaApi.patch_holdout ...'
  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 HoldoutsBetaApi.patch_holdout"
  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 HoldoutsBetaApi.patch_holdout"
  end
  # verify the required parameter 'holdout_key' is set
  if @api_client.config.client_side_validation && holdout_key.nil?
    fail ArgumentError, "Missing the required parameter 'holdout_key' when calling HoldoutsBetaApi.patch_holdout"
  end
  # verify the required parameter 'holdout_patch_input' is set
  if @api_client.config.client_side_validation && holdout_patch_input.nil?
    fail ArgumentError, "Missing the required parameter 'holdout_patch_input' when calling HoldoutsBetaApi.patch_holdout"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}/holdouts/{holdoutKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'holdoutKey' + '}', CGI.escape(holdout_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(holdout_patch_input)

  # return_type
  return_type = opts[:debug_return_type] || 'HoldoutRep'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"HoldoutsBetaApi.patch_holdout",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: HoldoutsBetaApi#patch_holdout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_holdout(project_key, environment_key, holdout_post_request, opts = {}) ⇒ HoldoutRep

Create holdout Create a new holdout in the specified project.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

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

    the optional parameters

Returns:



339
340
341
342
# File 'lib/launchdarkly_api/api/holdouts_beta_api.rb', line 339

def post_holdout(project_key, environment_key, holdout_post_request, opts = {})
  data, _status_code, _headers = post_holdout_with_http_info(project_key, environment_key, holdout_post_request, opts)
  data
end

#post_holdout_with_http_info(project_key, environment_key, holdout_post_request, opts = {}) ⇒ Array<(HoldoutRep, Integer, Hash)>

Create holdout Create a new holdout in the specified project.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

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

    the optional parameters

Returns:

  • (Array<(HoldoutRep, Integer, Hash)>)

    HoldoutRep data, response status code and response headers



351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/launchdarkly_api/api/holdouts_beta_api.rb', line 351

def post_holdout_with_http_info(project_key, environment_key, holdout_post_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: HoldoutsBetaApi.post_holdout ...'
  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 HoldoutsBetaApi.post_holdout"
  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 HoldoutsBetaApi.post_holdout"
  end
  # verify the required parameter 'holdout_post_request' is set
  if @api_client.config.client_side_validation && holdout_post_request.nil?
    fail ArgumentError, "Missing the required parameter 'holdout_post_request' when calling HoldoutsBetaApi.post_holdout"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}/holdouts'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(holdout_post_request)

  # return_type
  return_type = opts[:debug_return_type] || 'HoldoutRep'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"HoldoutsBetaApi.post_holdout",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: HoldoutsBetaApi#post_holdout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end