class Bfwd::CouponinstanceApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

create_coupon_instance(coupon_instance, opts = {}) click to toggle source

Create a coupon-instance. {"nickname":"Create a new coupon","request":"createCouponInstanceRequest.html","response":"createCouponInstanceResponse.html"} @param coupon_instance The coupon-instance object to be created. @param [Hash] opts the optional parameters @return [CouponInstancePagedMetadata]

# File lib/bf_ruby2/api/couponinstance_api.rb, line 28
def create_coupon_instance(coupon_instance, opts = {})
  data, _status_code, _headers = create_coupon_instance_with_http_info(coupon_instance, opts)
  return data
end
create_coupon_instance_with_http_info(coupon_instance, opts = {}) click to toggle source

Create a coupon-instance. {&quot;nickname&quot;:&quot;Create a new coupon&quot;,&quot;request&quot;:&quot;createCouponInstanceRequest.html&quot;,&quot;response&quot;:&quot;createCouponInstanceResponse.html&quot;} @param coupon_instance The coupon-instance object to be created. @param [Hash] opts the optional parameters @return [Array<(CouponInstancePagedMetadata, Fixnum, Hash)>] CouponInstancePagedMetadata data, response status code and response headers

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

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

Retire a coupon-instance, specified by the coupon-instance-ID parameter. {"nickname":"Delete a coupon","response":"deleteCouponInstanceByID.html"} @param coupon_instance_id ID of the coupon-instance. @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 [CouponInstancePagedMetadata]

# File lib/bf_ruby2/api/couponinstance_api.rb, line 84
def delete_coupon_instance(coupon_instance_id, opts = {})
  data, _status_code, _headers = delete_coupon_instance_with_http_info(coupon_instance_id, opts)
  return data
end
delete_coupon_instance_with_http_info(coupon_instance_id, opts = {}) click to toggle source

Retire a coupon-instance, specified by the coupon-instance-ID parameter. {&quot;nickname&quot;:&quot;Delete a coupon&quot;,&quot;response&quot;:&quot;deleteCouponInstanceByID.html&quot;} @param coupon_instance_id ID of the coupon-instance. @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<(CouponInstancePagedMetadata, Fixnum, Hash)>] CouponInstancePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/couponinstance_api.rb, line 95
def delete_coupon_instance_with_http_info(coupon_instance_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CouponinstanceApi.delete_coupon_instance ..."
  end
  # verify the required parameter 'coupon_instance_id' is set
  if @api_client.config.client_side_validation && coupon_instance_id.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_instance_id' when calling CouponinstanceApi.delete_coupon_instance"
  end
  # resource path
  local_var_path = "/coupon-instances/{coupon-instance-ID}".sub('{' + 'coupon-instance-ID' + '}', coupon_instance_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 => 'CouponInstancePagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponinstanceApi#delete_coupon_instance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_all_attachable_coupon_instances(attachableness, has_code, opts = {}) click to toggle source

Returns a collection of attachable coupon-instances. An attachable coupon-instance has at least one remaining use, and is not deleted. By default 10 values are returned. Records are returned in natural order. {"nickname":"Get attachable coupons","response":"getCouponInstanceAllAttachable.html"} @param attachableness The attachableness of the coupon-instance. @param has_code Whether the coupon-instances have coupon codes or not. @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 coupon-instance to return. (default to 0) @option opts [Integer] :records The maximum number of coupon-instances 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 [CouponInstancePagedMetadata]

# File lib/bf_ruby2/api/couponinstance_api.rb, line 147
def get_all_attachable_coupon_instances(attachableness, has_code, opts = {})
  data, _status_code, _headers = get_all_attachable_coupon_instances_with_http_info(attachableness, has_code, opts)
  return data
end
get_all_attachable_coupon_instances_with_http_info(attachableness, has_code, opts = {}) click to toggle source

Returns a collection of attachable coupon-instances. An attachable coupon-instance has at least one remaining use, and is not deleted. By default 10 values are returned. Records are returned in natural order. {&quot;nickname&quot;:&quot;Get attachable coupons&quot;,&quot;response&quot;:&quot;getCouponInstanceAllAttachable.html&quot;} @param attachableness The attachableness of the coupon-instance. @param has_code Whether the coupon-instances have coupon codes or not. @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 coupon-instance to return. @option opts [Integer] :records The maximum number of coupon-instances 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<(CouponInstancePagedMetadata, Fixnum, Hash)>] CouponInstancePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/couponinstance_api.rb, line 163
def get_all_attachable_coupon_instances_with_http_info(attachableness, has_code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CouponinstanceApi.get_all_attachable_coupon_instances ..."
  end
  # verify the required parameter 'attachableness' is set
  if @api_client.config.client_side_validation && attachableness.nil?
    fail ArgumentError, "Missing the required parameter 'attachableness' when calling CouponinstanceApi.get_all_attachable_coupon_instances"
  end
  # verify the required parameter 'has_code' is set
  if @api_client.config.client_side_validation && has_code.nil?
    fail ArgumentError, "Missing the required parameter 'has_code' when calling CouponinstanceApi.get_all_attachable_coupon_instances"
  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-instances/attachable/{attachableness}/{has_code}".sub('{' + 'attachableness' + '}', attachableness.to_s).sub('{' + 'has_code' + '}', has_code.to_s)

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

Returns a collection of coupon-instances. By default 10 values are returned. Records are returned in natural order. {"nickname":"Get all coupons","response":"getCouponInstanceAll.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 coupon-instance to return. (default to 0) @option opts [Integer] :records The maximum number of coupon-instances 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-instances should be returned. (default to true) @return [CouponInstancePagedMetadata]

# File lib/bf_ruby2/api/couponinstance_api.rb, line 223
def get_all_coupon_instances(opts = {})
  data, _status_code, _headers = get_all_coupon_instances_with_http_info(opts)
  return data
end
get_all_coupon_instances_with_http_info(opts = {}) click to toggle source

Returns a collection of coupon-instances. By default 10 values are returned. Records are returned in natural order. {&quot;nickname&quot;:&quot;Get all coupons&quot;,&quot;response&quot;:&quot;getCouponInstanceAll.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 coupon-instance to return. @option opts [Integer] :records The maximum number of coupon-instances 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-instances should be returned. @return [Array<(CouponInstancePagedMetadata, Fixnum, Hash)>] CouponInstancePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/couponinstance_api.rb, line 238
def get_all_coupon_instances_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CouponinstanceApi.get_all_coupon_instances ..."
  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-instances"

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

Returns a collection of coupon-instances, specified by coupon-code parameter. By default 10 coupon-instances are returned. Records are returned in natural order. {"nickname":"Retrieve by coupon code","response":"getCouponInstanceByCouponCode.html"} @param coupon_code The string coupon-code of the coupon-instance. @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 coupon-instance to return. (default to 0) @option opts [Integer] :records The maximum number of coupon-instances 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-instances should be returned. (default to true) @return [CouponInstancePagedMetadata]

# File lib/bf_ruby2/api/couponinstance_api.rb, line 292
def get_coupon_instance_by_coupon_code(coupon_code, opts = {})
  data, _status_code, _headers = get_coupon_instance_by_coupon_code_with_http_info(coupon_code, opts)
  return data
end
get_coupon_instance_by_coupon_code_with_http_info(coupon_code, opts = {}) click to toggle source

Returns a collection of coupon-instances, specified by coupon-code parameter. By default 10 coupon-instances are returned. Records are returned in natural order. {&quot;nickname&quot;:&quot;Retrieve by coupon code&quot;,&quot;response&quot;:&quot;getCouponInstanceByCouponCode.html&quot;} @param coupon_code The string coupon-code of the coupon-instance. @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 coupon-instance to return. @option opts [Integer] :records The maximum number of coupon-instances 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-instances should be returned. @return [Array<(CouponInstancePagedMetadata, Fixnum, Hash)>] CouponInstancePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/couponinstance_api.rb, line 308
def get_coupon_instance_by_coupon_code_with_http_info(coupon_code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CouponinstanceApi.get_coupon_instance_by_coupon_code ..."
  end
  # verify the required parameter 'coupon_code' is set
  if @api_client.config.client_side_validation && coupon_code.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_code' when calling CouponinstanceApi.get_coupon_instance_by_coupon_code"
  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-instances/coupon/{coupon-code}".sub('{' + 'coupon-code' + '}', coupon_code.to_s)

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

Returns a collection of coupon-instances, specified by coupon-definition-ID parameter. By default 10 coupon-instances are returned. Records are returned in natural order. {"nickname":"Retrieve by coupon definition","response":"getCouponInstanceByCouponDefinitionID.html"} @param coupon_definition_id The string coupon-definition-ID of the coupon-instance. @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 coupon-instance to return. (default to 0) @option opts [Integer] :records The maximum number of coupon-instances 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-instances should be returned. (default to true) @return [CouponInstancePagedMetadata]

# File lib/bf_ruby2/api/couponinstance_api.rb, line 368
def get_coupon_instance_by_coupon_definition_id(coupon_definition_id, opts = {})
  data, _status_code, _headers = get_coupon_instance_by_coupon_definition_id_with_http_info(coupon_definition_id, opts)
  return data
end
get_coupon_instance_by_coupon_definition_id_with_http_info(coupon_definition_id, opts = {}) click to toggle source

Returns a collection of coupon-instances, specified by coupon-definition-ID parameter. By default 10 coupon-instances are returned. Records are returned in natural order. {&quot;nickname&quot;:&quot;Retrieve by coupon definition&quot;,&quot;response&quot;:&quot;getCouponInstanceByCouponDefinitionID.html&quot;} @param coupon_definition_id The string coupon-definition-ID of the coupon-instance. @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 coupon-instance to return. @option opts [Integer] :records The maximum number of coupon-instances 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-instances should be returned. @return [Array<(CouponInstancePagedMetadata, Fixnum, Hash)>] CouponInstancePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/couponinstance_api.rb, line 384
def get_coupon_instance_by_coupon_definition_id_with_http_info(coupon_definition_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CouponinstanceApi.get_coupon_instance_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 CouponinstanceApi.get_coupon_instance_by_coupon_definition_id"
  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-instances/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?
  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'])
  # 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 => 'CouponInstancePagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponinstanceApi#get_coupon_instance_by_coupon_definition_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_coupon_instance_by_id(coupon_instance_id, opts = {}) click to toggle source

Returns a single coupon-instance, specified by the coupon-instance-ID parameter. {"nickname":"Get existing coupon","response":"getCouponInstanceByID.html"} @param coupon_instance_id ID of the coupon-instance. @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 [CouponInstancePagedMetadata]

# File lib/bf_ruby2/api/couponinstance_api.rb, line 439
def get_coupon_instance_by_id(coupon_instance_id, opts = {})
  data, _status_code, _headers = get_coupon_instance_by_id_with_http_info(coupon_instance_id, opts)
  return data
end
get_coupon_instance_by_id_with_http_info(coupon_instance_id, opts = {}) click to toggle source

Returns a single coupon-instance, specified by the coupon-instance-ID parameter. {&quot;nickname&quot;:&quot;Get existing coupon&quot;,&quot;response&quot;:&quot;getCouponInstanceByID.html&quot;} @param coupon_instance_id ID of the coupon-instance. @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<(CouponInstancePagedMetadata, Fixnum, Hash)>] CouponInstancePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/couponinstance_api.rb, line 450
def get_coupon_instance_by_id_with_http_info(coupon_instance_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CouponinstanceApi.get_coupon_instance_by_id ..."
  end
  # verify the required parameter 'coupon_instance_id' is set
  if @api_client.config.client_side_validation && coupon_instance_id.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_instance_id' when calling CouponinstanceApi.get_coupon_instance_by_id"
  end
  # resource path
  local_var_path = "/coupon-instances/{coupon-instance-ID}".sub('{' + 'coupon-instance-ID' + '}', coupon_instance_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 => 'CouponInstancePagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CouponinstanceApi#get_coupon_instance_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_coupon_instance_by_target_id(target_id, opts = {}) click to toggle source

Returns a collection of coupon-instances, specified by target-ID parameter. By default 10 coupon-instances are returned. Records are returned in natural order. {"nickname":"Retrieve by target","response":"getCouponInstanceByTargetID.html"} @param target_id The string target-ID of the coupon-instance. @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 coupon-instance to return. (default to 0) @option opts [Integer] :records The maximum number of coupon-instances 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-instances should be returned. (default to true) @return [CouponInstancePagedMetadata]

# File lib/bf_ruby2/api/couponinstance_api.rb, line 502
def get_coupon_instance_by_target_id(target_id, opts = {})
  data, _status_code, _headers = get_coupon_instance_by_target_id_with_http_info(target_id, opts)
  return data
end
get_coupon_instance_by_target_id_with_http_info(target_id, opts = {}) click to toggle source

Returns a collection of coupon-instances, specified by target-ID parameter. By default 10 coupon-instances are returned. Records are returned in natural order. {&quot;nickname&quot;:&quot;Retrieve by target&quot;,&quot;response&quot;:&quot;getCouponInstanceByTargetID.html&quot;} @param target_id The string target-ID of the coupon-instance. @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 coupon-instance to return. @option opts [Integer] :records The maximum number of coupon-instances 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-instances should be returned. @return [Array<(CouponInstancePagedMetadata, Fixnum, Hash)>] CouponInstancePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/couponinstance_api.rb, line 518
def get_coupon_instance_by_target_id_with_http_info(target_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CouponinstanceApi.get_coupon_instance_by_target_id ..."
  end
  # verify the required parameter 'target_id' is set
  if @api_client.config.client_side_validation && target_id.nil?
    fail ArgumentError, "Missing the required parameter 'target_id' when calling CouponinstanceApi.get_coupon_instance_by_target_id"
  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-instances/target/{target-ID}".sub('{' + 'target-ID' + '}', target_id.to_s)

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

Returns a collection of coupon-instances, specified by target parameter. By default 10 coupon-instances are returned. Records are returned in natural order. {"nickname":"Retrieve by target type","response":"getCouponInstanceByTarget.html"} @param target The string target of the coupon-instance. @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 coupon-instance to return. (default to 0) @option opts [Integer] :records The maximum number of coupon-instances 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-instances should be returned. (default to true) @return [CouponInstancePagedMetadata]

# File lib/bf_ruby2/api/couponinstance_api.rb, line 578
def get_coupon_instance_by_target_type(target, opts = {})
  data, _status_code, _headers = get_coupon_instance_by_target_type_with_http_info(target, opts)
  return data
end
get_coupon_instance_by_target_type_with_http_info(target, opts = {}) click to toggle source

Returns a collection of coupon-instances, specified by target parameter. By default 10 coupon-instances are returned. Records are returned in natural order. {&quot;nickname&quot;:&quot;Retrieve by target type&quot;,&quot;response&quot;:&quot;getCouponInstanceByTarget.html&quot;} @param target The string target of the coupon-instance. @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 coupon-instance to return. @option opts [Integer] :records The maximum number of coupon-instances 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-instances should be returned. @return [Array<(CouponInstancePagedMetadata, Fixnum, Hash)>] CouponInstancePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/couponinstance_api.rb, line 594
def get_coupon_instance_by_target_type_with_http_info(target, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CouponinstanceApi.get_coupon_instance_by_target_type ..."
  end
  # verify the required parameter 'target' is set
  if @api_client.config.client_side_validation && target.nil?
    fail ArgumentError, "Missing the required parameter 'target' when calling CouponinstanceApi.get_coupon_instance_by_target_type"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['none', 'subscription', 'account'].include?(target)
    fail ArgumentError, "invalid value for 'target', must be one of none, subscription, account"
  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-instances/target-entity/{target}".sub('{' + 'target' + '}', target.to_s)

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

Update a coupon-instance. {"nickname":"Update a coupon","request":"updateCouponInstanceRequest.html","response":"updateCouponInstanceResponse.html"} @param coupon_instance The coupon-instance object to be updated. @param [Hash] opts the optional parameters @return [CouponInstancePagedMetadata]

# File lib/bf_ruby2/api/couponinstance_api.rb, line 650
def update_coupon_instance(coupon_instance, opts = {})
  data, _status_code, _headers = update_coupon_instance_with_http_info(coupon_instance, opts)
  return data
end
update_coupon_instance_with_http_info(coupon_instance, opts = {}) click to toggle source

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

# File lib/bf_ruby2/api/couponinstance_api.rb, line 660
def update_coupon_instance_with_http_info(coupon_instance, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CouponinstanceApi.update_coupon_instance ..."
  end
  # verify the required parameter 'coupon_instance' is set
  if @api_client.config.client_side_validation && coupon_instance.nil?
    fail ArgumentError, "Missing the required parameter 'coupon_instance' when calling CouponinstanceApi.update_coupon_instance"
  end
  # resource path
  local_var_path = "/coupon-instances"

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