class Bfwd::CoupondefinitionApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

create_coupon_definition(coupon_definition, opts = {}) click to toggle source

Create a coupon-definition. {"nickname":"Create a new definition","request":"createCouponDefinitionRequest.html","response":"createCouponDefinitionResponse.html"} @param coupon_definition The coupon-definiton object to be created. @param [Hash] opts the optional parameters @return [CouponDefinitionPagedMetadata]

# File lib/bf_ruby2/api/coupondefinition_api.rb, line 28
def create_coupon_definition(coupon_definition, opts = {})
  data, _status_code, _headers = create_coupon_definition_with_http_info(coupon_definition, opts)
  return data
end
create_coupon_definition_with_http_info(coupon_definition, opts = {}) click to toggle source

Create a coupon-definition. {&quot;nickname&quot;:&quot;Create a new definition&quot;,&quot;request&quot;:&quot;createCouponDefinitionRequest.html&quot;,&quot;response&quot;:&quot;createCouponDefinitionResponse.html&quot;} @param coupon_definition The coupon-definiton object to be created. @param [Hash] opts the optional parameters @return [Array<(CouponDefinitionPagedMetadata, Fixnum, Hash)>] CouponDefinitionPagedMetadata data, response status code and response headers

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

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

Retire a coupon-definition, specified by the coupon-definition-ID parameter. {"nickname":"Delete a definition","response":"deleteCouponDefinitionByID.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 [CouponDefinitionPagedMetadata]

# File lib/bf_ruby2/api/coupondefinition_api.rb, line 84
def delete_coupon_definition(coupon_definition_id, opts = {})
  data, _status_code, _headers = delete_coupon_definition_with_http_info(coupon_definition_id, opts)
  return data
end
delete_coupon_definition_with_http_info(coupon_definition_id, opts = {}) click to toggle source

Retire a coupon-definition, specified by the coupon-definition-ID parameter. {&quot;nickname&quot;:&quot;Delete a definition&quot;,&quot;response&quot;:&quot;deleteCouponDefinitionByID.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<(CouponDefinitionPagedMetadata, Fixnum, Hash)>] CouponDefinitionPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/coupondefinition_api.rb, line 95
def delete_coupon_definition_with_http_info(coupon_definition_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CoupondefinitionApi.delete_coupon_definition ..."
  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 CoupondefinitionApi.delete_coupon_definition"
  end
  # resource path
  local_var_path = "/coupon-definitions/{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(: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 => 'CouponDefinitionPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CoupondefinitionApi#delete_coupon_definition\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_all_coupon_definitions(opts = {}) click to toggle source

Returns a collection of coupon-definitions. By default 10 values are returned. Records are returned in natural order. {"nickname":"Get all coupon definitions","response":"getCouponDefinitionAll.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) @option opts [BOOLEAN] :include_retired Whether retired coupon-definitions should be returned. (default to true) @return [CouponDefinitionPagedMetadata]

# File lib/bf_ruby2/api/coupondefinition_api.rb, line 146
def get_all_coupon_definitions(opts = {})
  data, _status_code, _headers = get_all_coupon_definitions_with_http_info(opts)
  return data
end
get_all_coupon_definitions_with_http_info(opts = {}) click to toggle source

Returns a collection of coupon-definitions. By default 10 values are returned. Records are returned in natural order. {&quot;nickname&quot;:&quot;Get all coupon definitions&quot;,&quot;response&quot;:&quot;getCouponDefinitionAll.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. @option opts [BOOLEAN] :include_retired Whether retired coupon-definitions should be returned. @return [Array<(CouponDefinitionPagedMetadata, Fixnum, Hash)>] CouponDefinitionPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/coupondefinition_api.rb, line 161
def get_all_coupon_definitions_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CoupondefinitionApi.get_all_coupon_definitions ..."
  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-definitions"

  # 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?
  query_params[:'include_retired'] = opts[:'include_retired'] if !opts[:'include_retired'].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 => 'CouponDefinitionPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CoupondefinitionApi#get_all_coupon_definitions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_coupon_definition_by_id(coupon_definition_id, opts = {}) click to toggle source

Returns a single coupon-definition, specified by the coupon-definition-ID parameter. {"nickname":"Get existing coupon definition","response":"getCouponDefinitionByID.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 [CouponDefinitionPagedMetadata]

# File lib/bf_ruby2/api/coupondefinition_api.rb, line 210
def get_coupon_definition_by_id(coupon_definition_id, opts = {})
  data, _status_code, _headers = get_coupon_definition_by_id_with_http_info(coupon_definition_id, opts)
  return data
end
get_coupon_definition_by_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;Get existing coupon definition&quot;,&quot;response&quot;:&quot;getCouponDefinitionByID.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<(CouponDefinitionPagedMetadata, Fixnum, Hash)>] CouponDefinitionPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/coupondefinition_api.rb, line 221
def get_coupon_definition_by_id_with_http_info(coupon_definition_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CoupondefinitionApi.get_coupon_definition_by_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 CoupondefinitionApi.get_coupon_definition_by_id"
  end
  # resource path
  local_var_path = "/coupon-definitions/{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 => 'CouponDefinitionPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CoupondefinitionApi#get_coupon_definition_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_coupon_definition(coupon_definition, opts = {}) click to toggle source

Update a coupon-definition. {"nickname":"Update a definition","request":"updateCouponDefinitionRequest.html","response":"updateCouponDefinitionResponse.html"} @param coupon_definition The coupon-definition object to be updated. @param [Hash] opts the optional parameters @return [CouponDefinitionPagedMetadata]

# File lib/bf_ruby2/api/coupondefinition_api.rb, line 267
def update_coupon_definition(coupon_definition, opts = {})
  data, _status_code, _headers = update_coupon_definition_with_http_info(coupon_definition, opts)
  return data
end
update_coupon_definition_with_http_info(coupon_definition, opts = {}) click to toggle source

Update a coupon-definition. {&quot;nickname&quot;:&quot;Update a definition&quot;,&quot;request&quot;:&quot;updateCouponDefinitionRequest.html&quot;,&quot;response&quot;:&quot;updateCouponDefinitionResponse.html&quot;} @param coupon_definition The coupon-definition object to be updated. @param [Hash] opts the optional parameters @return [Array<(CouponDefinitionPagedMetadata, Fixnum, Hash)>] CouponDefinitionPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/coupondefinition_api.rb, line 277
def update_coupon_definition_with_http_info(coupon_definition, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CoupondefinitionApi.update_coupon_definition ..."
  end
  # verify the required parameter 'coupon_definition' is set
  if @api_client.config.client_side_validation && coupon_definition.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_definition' when calling CoupondefinitionApi.update_coupon_definition"
  end
  # resource path
  local_var_path = "/coupon-definitions"

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