class LaunchDarklyApi::ExperimentsBetaApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/launchdarkly_api/api/experiments_beta_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

get_experiment(proj_key, flag_key, env_key, metric_key, opts = {}) click to toggle source

Get experiment results Get detailed experiment result data @param proj_key [String] The project key @param flag_key [String] The flag key @param env_key [String] The environment key @param metric_key [String] The metric key @param [Hash] opts the optional parameters @option opts [Integer] :from A timestamp denoting the start of the data collection period, expressed as a Unix epoch time in milliseconds. @option opts [Integer] :to A timestamp denoting the end of the data collection period, expressed as a Unix epoch time in milliseconds. @return [ExperimentResultsRep]

# File lib/launchdarkly_api/api/experiments_beta_api.rb, line 32
def get_experiment(proj_key, flag_key, env_key, metric_key, opts = {})
  data, _status_code, _headers = get_experiment_with_http_info(proj_key, flag_key, env_key, metric_key, opts)
  data
end
get_experiment_with_http_info(proj_key, flag_key, env_key, metric_key, opts = {}) click to toggle source

Get experiment results Get detailed experiment result data @param proj_key [String] The project key @param flag_key [String] The flag key @param env_key [String] The environment key @param metric_key [String] The metric key @param [Hash] opts the optional parameters @option opts [Integer] :from A timestamp denoting the start of the data collection period, expressed as a Unix epoch time in milliseconds. @option opts [Integer] :to A timestamp denoting the end of the data collection period, expressed as a Unix epoch time in milliseconds. @return [Array<(ExperimentResultsRep, Integer, Hash)>] ExperimentResultsRep data, response status code and response headers

# File lib/launchdarkly_api/api/experiments_beta_api.rb, line 47
def get_experiment_with_http_info(proj_key, flag_key, env_key, metric_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsBetaApi.get_experiment ...'
  end
  # verify the required parameter 'proj_key' is set
  if @api_client.config.client_side_validation && proj_key.nil?
    fail ArgumentError, "Missing the required parameter 'proj_key' when calling ExperimentsBetaApi.get_experiment"
  end
  # verify the required parameter 'flag_key' is set
  if @api_client.config.client_side_validation && flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'flag_key' when calling ExperimentsBetaApi.get_experiment"
  end
  # verify the required parameter 'env_key' is set
  if @api_client.config.client_side_validation && env_key.nil?
    fail ArgumentError, "Missing the required parameter 'env_key' when calling ExperimentsBetaApi.get_experiment"
  end
  # verify the required parameter 'metric_key' is set
  if @api_client.config.client_side_validation && metric_key.nil?
    fail ArgumentError, "Missing the required parameter 'metric_key' when calling ExperimentsBetaApi.get_experiment"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projKey}/{flagKey}/experiments/{envKey}/{metricKey}'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s)).sub('{' + 'flagKey' + '}', CGI.escape(flag_key.to_s)).sub('{' + 'envKey' + '}', CGI.escape(env_key.to_s)).sub('{' + 'metricKey' + '}', CGI.escape(metric_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'to'] = opts[:'to'] if !opts[:'to'].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] || 'ExperimentResultsRep'

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

  new_options = opts.merge(
    :operation => :"ExperimentsBetaApi.get_experiment",
    :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: ExperimentsBetaApi#get_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
reset_experiment(proj_key, flag_key, env_key, metric_key, opts = {}) click to toggle source

Reset experiment results Reset all experiment results by deleting all existing data for an experiment @param proj_key [String] The project key @param flag_key [String] The feature flag&#39;s key @param env_key [String] The environment key @param metric_key [String] The metric&#39;s key @param [Hash] opts the optional parameters @return [nil]

# File lib/launchdarkly_api/api/experiments_beta_api.rb, line 117
def reset_experiment(proj_key, flag_key, env_key, metric_key, opts = {})
  reset_experiment_with_http_info(proj_key, flag_key, env_key, metric_key, opts)
  nil
end
reset_experiment_with_http_info(proj_key, flag_key, env_key, metric_key, opts = {}) click to toggle source

Reset experiment results Reset all experiment results by deleting all existing data for an experiment @param proj_key [String] The project key @param flag_key [String] The feature flag&#39;s key @param env_key [String] The environment key @param metric_key [String] The metric&#39;s key @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/launchdarkly_api/api/experiments_beta_api.rb, line 130
def reset_experiment_with_http_info(proj_key, flag_key, env_key, metric_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsBetaApi.reset_experiment ...'
  end
  # verify the required parameter 'proj_key' is set
  if @api_client.config.client_side_validation && proj_key.nil?
    fail ArgumentError, "Missing the required parameter 'proj_key' when calling ExperimentsBetaApi.reset_experiment"
  end
  # verify the required parameter 'flag_key' is set
  if @api_client.config.client_side_validation && flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'flag_key' when calling ExperimentsBetaApi.reset_experiment"
  end
  # verify the required parameter 'env_key' is set
  if @api_client.config.client_side_validation && env_key.nil?
    fail ArgumentError, "Missing the required parameter 'env_key' when calling ExperimentsBetaApi.reset_experiment"
  end
  # verify the required parameter 'metric_key' is set
  if @api_client.config.client_side_validation && metric_key.nil?
    fail ArgumentError, "Missing the required parameter 'metric_key' when calling ExperimentsBetaApi.reset_experiment"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projKey}/{flagKey}/experiments/{envKey}/{metricKey}/results'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s)).sub('{' + 'flagKey' + '}', CGI.escape(flag_key.to_s)).sub('{' + 'envKey' + '}', CGI.escape(env_key.to_s)).sub('{' + 'metricKey' + '}', CGI.escape(metric_key.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"ExperimentsBetaApi.reset_experiment",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsBetaApi#reset_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end