class Flagr::VariantApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

create_variant(flag_id, body, opts = {}) click to toggle source

@param flag_id numeric ID of the flag @param body create a variant @param [Hash] opts the optional parameters @return [Variant]

# File lib/rbflagr/api/variant_api.rb, line 26
def create_variant(flag_id, body, opts = {})
  data, _status_code, _headers = create_variant_with_http_info(flag_id, body, opts)
  data
end
create_variant_with_http_info(flag_id, body, opts = {}) click to toggle source

@param flag_id numeric ID of the flag @param body create a variant @param [Hash] opts the optional parameters @return [Array<(Variant, Fixnum, Hash)>] Variant data, response status code and response headers

# File lib/rbflagr/api/variant_api.rb, line 35
def create_variant_with_http_info(flag_id, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VariantApi.create_variant ...'
  end
  # verify the required parameter 'flag_id' is set
  if @api_client.config.client_side_validation && flag_id.nil?
    fail ArgumentError, "Missing the required parameter 'flag_id' when calling VariantApi.create_variant"
  end
  if @api_client.config.client_side_validation && flag_id < 1
    fail ArgumentError, 'invalid value for "flag_id" when calling VariantApi.create_variant, must be greater than or equal to 1.'
  end

  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling VariantApi.create_variant"
  end
  # resource path
  local_var_path = '/flags/{flagID}/variants'.sub('{' + 'flagID' + '}', flag_id.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(body)
  auth_names = []
  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,
    :return_type => 'Variant')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VariantApi#create_variant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_variant(flag_id, variant_id, opts = {}) click to toggle source

@param flag_id numeric ID of the flag @param variant_id numeric ID of the variant @param [Hash] opts the optional parameters @return [nil]

# File lib/rbflagr/api/variant_api.rb, line 86
def delete_variant(flag_id, variant_id, opts = {})
  delete_variant_with_http_info(flag_id, variant_id, opts)
  nil
end
delete_variant_with_http_info(flag_id, variant_id, opts = {}) click to toggle source

@param flag_id numeric ID of the flag @param variant_id numeric ID of the variant @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

# File lib/rbflagr/api/variant_api.rb, line 95
def delete_variant_with_http_info(flag_id, variant_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VariantApi.delete_variant ...'
  end
  # verify the required parameter 'flag_id' is set
  if @api_client.config.client_side_validation && flag_id.nil?
    fail ArgumentError, "Missing the required parameter 'flag_id' when calling VariantApi.delete_variant"
  end
  if @api_client.config.client_side_validation && flag_id < 1
    fail ArgumentError, 'invalid value for "flag_id" when calling VariantApi.delete_variant, must be greater than or equal to 1.'
  end

  # verify the required parameter 'variant_id' is set
  if @api_client.config.client_side_validation && variant_id.nil?
    fail ArgumentError, "Missing the required parameter 'variant_id' when calling VariantApi.delete_variant"
  end
  if @api_client.config.client_side_validation && variant_id < 1
    fail ArgumentError, 'invalid value for "variant_id" when calling VariantApi.delete_variant, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/flags/{flagID}/variants/{variantID}'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'variantID' + '}', variant_id.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 = []
  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: VariantApi#delete_variant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
find_variants(flag_id, opts = {}) click to toggle source

@param flag_id numeric ID of the flag @param [Hash] opts the optional parameters @return [Array<Variant>]

# File lib/rbflagr/api/variant_api.rb, line 148
def find_variants(flag_id, opts = {})
  data, _status_code, _headers = find_variants_with_http_info(flag_id, opts)
  data
end
find_variants_with_http_info(flag_id, opts = {}) click to toggle source

@param flag_id numeric ID of the flag @param [Hash] opts the optional parameters @return [Array<(Array<Variant>, Fixnum, Hash)>] Array<Variant> data, response status code and response headers

# File lib/rbflagr/api/variant_api.rb, line 156
def find_variants_with_http_info(flag_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VariantApi.find_variants ...'
  end
  # verify the required parameter 'flag_id' is set
  if @api_client.config.client_side_validation && flag_id.nil?
    fail ArgumentError, "Missing the required parameter 'flag_id' when calling VariantApi.find_variants"
  end
  if @api_client.config.client_side_validation && flag_id < 1
    fail ArgumentError, 'invalid value for "flag_id" when calling VariantApi.find_variants, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/flags/{flagID}/variants'.sub('{' + 'flagID' + '}', flag_id.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 = []
  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 => 'Array<Variant>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VariantApi#find_variants\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
put_variant(flag_id, variant_id, body, opts = {}) click to toggle source

@param flag_id numeric ID of the flag @param variant_id numeric ID of the variant @param body update a variant @param [Hash] opts the optional parameters @return [Variant]

# File lib/rbflagr/api/variant_api.rb, line 204
def put_variant(flag_id, variant_id, body, opts = {})
  data, _status_code, _headers = put_variant_with_http_info(flag_id, variant_id, body, opts)
  data
end
put_variant_with_http_info(flag_id, variant_id, body, opts = {}) click to toggle source

@param flag_id numeric ID of the flag @param variant_id numeric ID of the variant @param body update a variant @param [Hash] opts the optional parameters @return [Array<(Variant, Fixnum, Hash)>] Variant data, response status code and response headers

# File lib/rbflagr/api/variant_api.rb, line 214
def put_variant_with_http_info(flag_id, variant_id, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VariantApi.put_variant ...'
  end
  # verify the required parameter 'flag_id' is set
  if @api_client.config.client_side_validation && flag_id.nil?
    fail ArgumentError, "Missing the required parameter 'flag_id' when calling VariantApi.put_variant"
  end
  if @api_client.config.client_side_validation && flag_id < 1
    fail ArgumentError, 'invalid value for "flag_id" when calling VariantApi.put_variant, must be greater than or equal to 1.'
  end

  # verify the required parameter 'variant_id' is set
  if @api_client.config.client_side_validation && variant_id.nil?
    fail ArgumentError, "Missing the required parameter 'variant_id' when calling VariantApi.put_variant"
  end
  if @api_client.config.client_side_validation && variant_id < 1
    fail ArgumentError, 'invalid value for "variant_id" when calling VariantApi.put_variant, must be greater than or equal to 1.'
  end

  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling VariantApi.put_variant"
  end
  # resource path
  local_var_path = '/flags/{flagID}/variants/{variantID}'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'variantID' + '}', variant_id.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(body)
  auth_names = []
  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,
    :return_type => 'Variant')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VariantApi#put_variant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end