class Flagr::ConstraintApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

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

@param flag_id numeric ID of the flag @param segment_id numeric ID of the segment @param body create a constraint @param [Hash] opts the optional parameters @return [Constraint]

# File lib/rbflagr/api/constraint_api.rb, line 27
def create_constraint(flag_id, segment_id, body, opts = {})
  data, _status_code, _headers = create_constraint_with_http_info(flag_id, segment_id, body, opts)
  data
end
create_constraint_with_http_info(flag_id, segment_id, body, opts = {}) click to toggle source

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

# File lib/rbflagr/api/constraint_api.rb, line 37
def create_constraint_with_http_info(flag_id, segment_id, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConstraintApi.create_constraint ...'
  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 ConstraintApi.create_constraint"
  end
  if @api_client.config.client_side_validation && flag_id < 1
    fail ArgumentError, 'invalid value for "flag_id" when calling ConstraintApi.create_constraint, must be greater than or equal to 1.'
  end

  # verify the required parameter 'segment_id' is set
  if @api_client.config.client_side_validation && segment_id.nil?
    fail ArgumentError, "Missing the required parameter 'segment_id' when calling ConstraintApi.create_constraint"
  end
  if @api_client.config.client_side_validation && segment_id < 1
    fail ArgumentError, 'invalid value for "segment_id" when calling ConstraintApi.create_constraint, 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 ConstraintApi.create_constraint"
  end
  # resource path
  local_var_path = '/flags/{flagID}/segments/{segmentID}/constraints'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'segmentID' + '}', segment_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 => 'Constraint')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConstraintApi#create_constraint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_constraint(flag_id, segment_id, constraint_id, opts = {}) click to toggle source

@param flag_id numeric ID of the flag @param segment_id numeric ID of the segment @param constraint_id numeric ID of the constraint @param [Hash] opts the optional parameters @return [nil]

# File lib/rbflagr/api/constraint_api.rb, line 97
def delete_constraint(flag_id, segment_id, constraint_id, opts = {})
  delete_constraint_with_http_info(flag_id, segment_id, constraint_id, opts)
  nil
end
delete_constraint_with_http_info(flag_id, segment_id, constraint_id, opts = {}) click to toggle source

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

# File lib/rbflagr/api/constraint_api.rb, line 107
def delete_constraint_with_http_info(flag_id, segment_id, constraint_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConstraintApi.delete_constraint ...'
  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 ConstraintApi.delete_constraint"
  end
  if @api_client.config.client_side_validation && flag_id < 1
    fail ArgumentError, 'invalid value for "flag_id" when calling ConstraintApi.delete_constraint, must be greater than or equal to 1.'
  end

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

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

  # resource path
  local_var_path = '/flags/{flagID}/segments/{segmentID}/constraints/{constraintID}'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'segmentID' + '}', segment_id.to_s).sub('{' + 'constraintID' + '}', constraint_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: ConstraintApi#delete_constraint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
find_constraints(flag_id, segment_id, opts = {}) click to toggle source

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

# File lib/rbflagr/api/constraint_api.rb, line 169
def find_constraints(flag_id, segment_id, opts = {})
  data, _status_code, _headers = find_constraints_with_http_info(flag_id, segment_id, opts)
  data
end
find_constraints_with_http_info(flag_id, segment_id, opts = {}) click to toggle source

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

# File lib/rbflagr/api/constraint_api.rb, line 178
def find_constraints_with_http_info(flag_id, segment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConstraintApi.find_constraints ...'
  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 ConstraintApi.find_constraints"
  end
  if @api_client.config.client_side_validation && flag_id < 1
    fail ArgumentError, 'invalid value for "flag_id" when calling ConstraintApi.find_constraints, must be greater than or equal to 1.'
  end

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

  # resource path
  local_var_path = '/flags/{flagID}/segments/{segmentID}/constraints'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'segmentID' + '}', segment_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<Constraint>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConstraintApi#find_constraints\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
put_constraint(flag_id, segment_id, constraint_id, body, opts = {}) click to toggle source

@param flag_id numeric ID of the flag @param segment_id numeric ID of the segment @param constraint_id numeric ID of the constraint @param body create a constraint @param [Hash] opts the optional parameters @return [Constraint]

# File lib/rbflagr/api/constraint_api.rb, line 235
def put_constraint(flag_id, segment_id, constraint_id, body, opts = {})
  data, _status_code, _headers = put_constraint_with_http_info(flag_id, segment_id, constraint_id, body, opts)
  data
end
put_constraint_with_http_info(flag_id, segment_id, constraint_id, body, opts = {}) click to toggle source

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

# File lib/rbflagr/api/constraint_api.rb, line 246
def put_constraint_with_http_info(flag_id, segment_id, constraint_id, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConstraintApi.put_constraint ...'
  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 ConstraintApi.put_constraint"
  end
  if @api_client.config.client_side_validation && flag_id < 1
    fail ArgumentError, 'invalid value for "flag_id" when calling ConstraintApi.put_constraint, must be greater than or equal to 1.'
  end

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

  # verify the required parameter 'constraint_id' is set
  if @api_client.config.client_side_validation && constraint_id.nil?
    fail ArgumentError, "Missing the required parameter 'constraint_id' when calling ConstraintApi.put_constraint"
  end
  if @api_client.config.client_side_validation && constraint_id < 1
    fail ArgumentError, 'invalid value for "constraint_id" when calling ConstraintApi.put_constraint, 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 ConstraintApi.put_constraint"
  end
  # resource path
  local_var_path = '/flags/{flagID}/segments/{segmentID}/constraints/{constraintID}'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'segmentID' + '}', segment_id.to_s).sub('{' + 'constraintID' + '}', constraint_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 => 'Constraint')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConstraintApi#put_constraint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end