class Bfwd::CouponruleApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

create_coupon_rule(coupon_rule, opts = {}) click to toggle source

Create a coupon-rule. {"nickname":"Create a new rule", "request" : "createCouponRuleRequest.html" ,"response" : "createCouponRuleResponse.html" } @param coupon_rule The coupon-rule object to be created. @param [Hash] opts the optional parameters @return [CouponRulePagedMetadata]

# File lib/bf_ruby2/api/couponrule_api.rb, line 28
def create_coupon_rule(coupon_rule, opts = {})
  data, _status_code, _headers = create_coupon_rule_with_http_info(coupon_rule, opts)
  return data
end
create_coupon_rule_with_http_info(coupon_rule, opts = {}) click to toggle source

Create a coupon-rule. {&quot;nickname&quot;:&quot;Create a new rule&quot;, "request&quot; : "createCouponRuleRequest.html&quot; ,&quot;response&quot; : "createCouponRuleResponse.html&quot; } @param coupon_rule The coupon-rule object to be created. @param [Hash] opts the optional parameters @return [Array<(CouponRulePagedMetadata, Fixnum, Hash)>] CouponRulePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/couponrule_api.rb, line 38
def create_coupon_rule_with_http_info(coupon_rule, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CouponruleApi.create_coupon_rule ..."
  end
  # verify the required parameter 'coupon_rule' is set
  if @api_client.config.client_side_validation && coupon_rule.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_rule' when calling CouponruleApi.create_coupon_rule"
  end
  # resource path
  local_var_path = "/coupon-rules"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/xml', 'application/xml', 'application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(coupon_rule)
  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 => 'CouponRulePagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponruleApi#create_coupon_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_coupon_rule(coupon_rule_id, opts = {}) click to toggle source

Retire a coupon-rule, specified by the coupon-rule-ID parameter. {"nickname":"Delete a rule","response" : "deleteCouponRuleByID.html"} @param coupon_rule_id ID of the coupon-rule. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [CouponRulePagedMetadata]

# File lib/bf_ruby2/api/couponrule_api.rb, line 84
def delete_coupon_rule(coupon_rule_id, opts = {})
  data, _status_code, _headers = delete_coupon_rule_with_http_info(coupon_rule_id, opts)
  return data
end
delete_coupon_rule_with_http_info(coupon_rule_id, opts = {}) click to toggle source

Retire a coupon-rule, specified by the coupon-rule-ID parameter. {&quot;nickname&quot;:&quot;Delete a rule&quot;,&quot;response&quot; : "deleteCouponRuleByID.html&quot;} @param coupon_rule_id ID of the coupon-rule. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [Array<(CouponRulePagedMetadata, Fixnum, Hash)>] CouponRulePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/couponrule_api.rb, line 95
def delete_coupon_rule_with_http_info(coupon_rule_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CouponruleApi.delete_coupon_rule ..."
  end
  # verify the required parameter 'coupon_rule_id' is set
  if @api_client.config.client_side_validation && coupon_rule_id.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_rule_id' when calling CouponruleApi.delete_coupon_rule"
  end
  # resource path
  local_var_path = "/coupon-rules/{coupon-rule-ID}".sub('{' + 'coupon-rule-ID' + '}', coupon_rule_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain'])

  # 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,
    :return_type => 'CouponRulePagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponruleApi#delete_coupon_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_all_coupon_rules(opts = {}) click to toggle source

Returns a collection of coupon-rules. By default 10 values are returned. Records are returned in natural order. {"nickname":"Get all rules","response" : "getCouponRuleAll.html"} @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first product-rate-plan to return. (default to 0) @option opts [Integer] :records The maximum number of product-rate-plans to return. (default to 10) @option opts [String] :order_by Specify a field used to order the result set. (default to created) @option opts [String] :order Ihe direction of any ordering, either ASC or DESC. (default to DESC) @return [CouponRulePagedMetadata]

# File lib/bf_ruby2/api/couponrule_api.rb, line 145
def get_all_coupon_rules(opts = {})
  data, _status_code, _headers = get_all_coupon_rules_with_http_info(opts)
  return data
end
get_all_coupon_rules_with_http_info(opts = {}) click to toggle source

Returns a collection of coupon-rules. By default 10 values are returned. Records are returned in natural order. {&quot;nickname&quot;:&quot;Get all rules&quot;,&quot;response&quot; : "getCouponRuleAll.html&quot;} @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first product-rate-plan to return. @option opts [Integer] :records The maximum number of product-rate-plans to return. @option opts [String] :order_by Specify a field used to order the result set. @option opts [String] :order Ihe direction of any ordering, either ASC or DESC. @return [Array<(CouponRulePagedMetadata, Fixnum, Hash)>] CouponRulePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/couponrule_api.rb, line 159
def get_all_coupon_rules_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CouponruleApi.get_all_coupon_rules ..."
  end
  if @api_client.config.client_side_validation && opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])
    fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC'
  end
  # resource path
  local_var_path = "/coupon-rules"

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])

  # 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 => 'CouponRulePagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponruleApi#get_all_coupon_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_coupon_rule_by_coupon_definition_id(coupon_definition_id, opts = {}) click to toggle source

Returns a single coupon-definition, specified by the coupon-definition-ID parameter. {"nickname":"Retrieve by coupon definition","response" : "getCouponRuleByCouponDefinitionID.html"} @param coupon_definition_id ID of the coupon-definition. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [CouponRulePagedMetadata]

# File lib/bf_ruby2/api/couponrule_api.rb, line 207
def get_coupon_rule_by_coupon_definition_id(coupon_definition_id, opts = {})
  data, _status_code, _headers = get_coupon_rule_by_coupon_definition_id_with_http_info(coupon_definition_id, opts)
  return data
end
get_coupon_rule_by_coupon_definition_id_with_http_info(coupon_definition_id, opts = {}) click to toggle source

Returns a single coupon-definition, specified by the coupon-definition-ID parameter. {&quot;nickname&quot;:&quot;Retrieve by coupon definition&quot;,&quot;response&quot; : "getCouponRuleByCouponDefinitionID.html&quot;} @param coupon_definition_id ID of the coupon-definition. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [Array<(CouponRulePagedMetadata, Fixnum, Hash)>] CouponRulePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/couponrule_api.rb, line 218
def get_coupon_rule_by_coupon_definition_id_with_http_info(coupon_definition_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CouponruleApi.get_coupon_rule_by_coupon_definition_id ..."
  end
  # verify the required parameter 'coupon_definition_id' is set
  if @api_client.config.client_side_validation && coupon_definition_id.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_definition_id' when calling CouponruleApi.get_coupon_rule_by_coupon_definition_id"
  end
  # resource path
  local_var_path = "/coupon-rules/coupon-definition/{coupon-definition-ID}".sub('{' + 'coupon-definition-ID' + '}', coupon_definition_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain'])

  # 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 => 'CouponRulePagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponruleApi#get_coupon_rule_by_coupon_definition_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_coupon_rule_by_id(coupon_rule_id, opts = {}) click to toggle source

Returns a single coupon-rule, specified by the coupon-rule-ID parameter. {"nickname":"Retrieve an existing rule","response" : "getCouponRuleByID.html"} @param coupon_rule_id ID of the coupon-rule. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [CouponRulePagedMetadata]

# File lib/bf_ruby2/api/couponrule_api.rb, line 265
def get_coupon_rule_by_id(coupon_rule_id, opts = {})
  data, _status_code, _headers = get_coupon_rule_by_id_with_http_info(coupon_rule_id, opts)
  return data
end
get_coupon_rule_by_id_with_http_info(coupon_rule_id, opts = {}) click to toggle source

Returns a single coupon-rule, specified by the coupon-rule-ID parameter. {&quot;nickname&quot;:&quot;Retrieve an existing rule&quot;,&quot;response&quot; : "getCouponRuleByID.html&quot;} @param coupon_rule_id ID of the coupon-rule. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [Array<(CouponRulePagedMetadata, Fixnum, Hash)>] CouponRulePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/couponrule_api.rb, line 276
def get_coupon_rule_by_id_with_http_info(coupon_rule_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CouponruleApi.get_coupon_rule_by_id ..."
  end
  # verify the required parameter 'coupon_rule_id' is set
  if @api_client.config.client_side_validation && coupon_rule_id.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_rule_id' when calling CouponruleApi.get_coupon_rule_by_id"
  end
  # resource path
  local_var_path = "/coupon-rules/{coupon-rule-ID}".sub('{' + 'coupon-rule-ID' + '}', coupon_rule_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain'])

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