class VoucherifySdk::PromotionsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

add_promotion_tier_to_campaign(campaign_id, opts = {}) click to toggle source

Add Promotion Tier to Campaign This method allows you to add a new promotion tier to an existing campaign. The tier hierarchy will be set as the next consequtive integer following the lowest ranking tier. @param campaign_id [String] Unique campaign ID assigned by Voucherify. @param [Hash] opts the optional parameters @option opts [PromotionsTiersCreateRequestBody] :promotions_tiers_create_request_body Specify the promotion tier parameters. @return [PromotionsTiersCreateResponseBody]

# File lib/VoucherifySdk/api/promotions_api.rb, line 28
def add_promotion_tier_to_campaign(campaign_id, opts = {})
  data, _status_code, _headers = add_promotion_tier_to_campaign_with_http_info(campaign_id, opts)
  data
end
create_promotion_stack(campaign_id, opts = {}) click to toggle source

Create Promotion Stack This method creates one promotion stack. The sequence of promotion tier IDs will determine the promotion stacking order. @param campaign_id [String] Unique campaign ID. @param [Hash] opts the optional parameters @option opts [PromotionsStacksCreateRequestBody] :promotions_stacks_create_request_body Specify the order of promotion tiers for the promotion stack. @return [PromotionsStacksCreateResponseBody]

# File lib/VoucherifySdk/api/promotions_api.rb, line 94
def create_promotion_stack(campaign_id, opts = {})
  data, _status_code, _headers = create_promotion_stack_with_http_info(campaign_id, opts)
  data
end
delete_promotion_stack(campaign_id, stack_id, opts = {}) click to toggle source

Delete Promotion Stack This method deletes a promotion stack. @param campaign_id [String] ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. @param stack_id [String] Promotion stack ID. @param [Hash] opts the optional parameters @return [nil]

# File lib/VoucherifySdk/api/promotions_api.rb, line 160
def delete_promotion_stack(campaign_id, stack_id, opts = {})
  delete_promotion_stack_with_http_info(campaign_id, stack_id, opts)
  nil
end
delete_promotion_tier(promotion_tier_id, opts = {}) click to toggle source

Delete Promotion Tier This method deletes a promotion tier. @param promotion_tier_id [String] Unique promotion tier ID. @param [Hash] opts the optional parameters @return [nil]

# File lib/VoucherifySdk/api/promotions_api.rb, line 218
def delete_promotion_tier(promotion_tier_id, opts = {})
  delete_promotion_tier_with_http_info(promotion_tier_id, opts)
  nil
end
disable_promotion_tier(promotion_tier_id, opts = {}) click to toggle source

Disable Promotion Tier This method disables a promotion tier, i.e. makes the active parameter false. @param promotion_tier_id [String] Unique promotion tier ID. @param [Hash] opts the optional parameters @return [PromotionsTiersDisableResponseBody]

# File lib/VoucherifySdk/api/promotions_api.rb, line 275
def disable_promotion_tier(promotion_tier_id, opts = {})
  data, _status_code, _headers = disable_promotion_tier_with_http_info(promotion_tier_id, opts)
  data
end
enable_promotion_tier(promotion_tier_id, opts = {}) click to toggle source

Enable Promotion Tier This method enables a promotion tier, i.e. makes the active parameter true. @param promotion_tier_id [String] Unique promotion tier ID. @param [Hash] opts the optional parameters @return [PromotionsTiersEnableResponseBody]

# File lib/VoucherifySdk/api/promotions_api.rb, line 334
def enable_promotion_tier(promotion_tier_id, opts = {})
  data, _status_code, _headers = enable_promotion_tier_with_http_info(promotion_tier_id, opts)
  data
end
get_promotion_stack(campaign_id, stack_id, opts = {}) click to toggle source

Get Promotion Stack This method returns the details of a promotion stack, including the promotion tiers grouped within the stack. @param campaign_id [String] ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. @param stack_id [String] Promotion stack ID. @param [Hash] opts the optional parameters @return [PromotionsStacksGetResponseBody]

# File lib/VoucherifySdk/api/promotions_api.rb, line 394
def get_promotion_stack(campaign_id, stack_id, opts = {})
  data, _status_code, _headers = get_promotion_stack_with_http_info(campaign_id, stack_id, opts)
  data
end
get_promotion_tier(promotion_tier_id, opts = {}) click to toggle source

Get Promotion Tier This method enables you to retrieve a specific promotion tier. @param promotion_tier_id [String] Unique promotion tier ID. @param [Hash] opts the optional parameters @return [PromotionsTiersGetResponseBody]

# File lib/VoucherifySdk/api/promotions_api.rb, line 454
def get_promotion_tier(promotion_tier_id, opts = {})
  data, _status_code, _headers = get_promotion_tier_with_http_info(promotion_tier_id, opts)
  data
end
list_all_promotion_stacks(opts = {}) click to toggle source

List Promotion Stacks This method enables you to list promotion stacks irrespective of the campaign they are associated with. You can use filters in the query parameters to specify the stacks to be returned in the response. # Advanced filters for fetching promotion stacks

@param [Hash] opts the optional parameters @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. @option opts [Integer] :page Which page of results to return. The lowest value is 1. @option opts [ParameterOrderListAllPromotionStacks] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @option opts [ParameterCreatedBeforeAfter] :created_at A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at] 2017-09-08T13:52:18.227Z @option opts [ParameterUpdatedBeforeAfter] :updated_at A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at] 2017-09-08T13:52:18.227Z @return [PromotionsStacksListResponseBody]

# File lib/VoucherifySdk/api/promotions_api.rb, line 517
def list_all_promotion_stacks(opts = {})
  data, _status_code, _headers = list_all_promotion_stacks_with_http_info(opts)
  data
end
list_promotion_stacks_in_campaign(campaign_id, opts = {}) click to toggle source

List Promotion Stacks in Campaign This method enables you to list promotion stacks from a specified campaign. @param campaign_id [String] Unique campaign ID. @param [Hash] opts the optional parameters @return [PromotionsStacksListResponseBody]

# File lib/VoucherifySdk/api/promotions_api.rb, line 585
def list_promotion_stacks_in_campaign(campaign_id, opts = {})
  data, _status_code, _headers = list_promotion_stacks_in_campaign_with_http_info(campaign_id, opts)
  data
end
list_promotion_tiers(opts = {}) click to toggle source

List Promotion Tiers This method enables you to list promotion tiers. @param [Hash] opts the optional parameters @option opts [Boolean] :is_available This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. @option opts [Integer] :page Which page of results to return. The lowest value is 1. @option opts [ParameterOrderListPromotionTiers] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @return [PromotionsTiersListResponseBody]

# File lib/VoucherifySdk/api/promotions_api.rb, line 647
def list_promotion_tiers(opts = {})
  data, _status_code, _headers = list_promotion_tiers_with_http_info(opts)
  data
end
list_promotion_tiers_from_campaign(campaign_id, opts = {}) click to toggle source

List Promotion Tiers from Campaign This method enables you to list promotion tiers from a specified campaign. @param campaign_id [String] Unique campaign ID assigned by Voucherify. @param [Hash] opts the optional parameters @return [PromotionsTiersListResponseBody]

# File lib/VoucherifySdk/api/promotions_api.rb, line 713
def list_promotion_tiers_from_campaign(campaign_id, opts = {})
  data, _status_code, _headers = list_promotion_tiers_from_campaign_with_http_info(campaign_id, opts)
  data
end
update_promotion_stack(campaign_id, stack_id, opts = {}) click to toggle source

Update Promotion Stack This methods allows for editing an existing stack. @param campaign_id [String] ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. @param stack_id [String] Promotion stack ID. @param [Hash] opts the optional parameters @option opts [PromotionsStacksUpdateRequestBody] :promotions_stacks_update_request_body Specify the promotion stack parameters that you would like to update. @return [PromotionsStacksUpdateResponseBody]

# File lib/VoucherifySdk/api/promotions_api.rb, line 774
def update_promotion_stack(campaign_id, stack_id, opts = {})
  data, _status_code, _headers = update_promotion_stack_with_http_info(campaign_id, stack_id, opts)
  data
end
update_promotion_tier(promotion_tier_id, opts = {}) click to toggle source

Update Promotion Tier This method updates a promotion tier. @param promotion_tier_id [String] Unique promotion tier ID. @param [Hash] opts the optional parameters @option opts [PromotionsTiersUpdateRequestBody] :promotions_tiers_update_request_body Specify the promotion tier parameters that you would like to update. @return [PromotionsTiersUpdateResponseBody]

# File lib/VoucherifySdk/api/promotions_api.rb, line 841
def update_promotion_tier(promotion_tier_id, opts = {})
  data, _status_code, _headers = update_promotion_tier_with_http_info(promotion_tier_id, opts)
  data
end

Private Instance Methods

add_promotion_tier_to_campaign_with_http_info(campaign_id, opts = {}) click to toggle source

Add Promotion Tier to Campaign This method allows you to add a new promotion tier to an existing campaign. The tier hierarchy will be set as the next consequtive integer following the lowest ranking tier. @param campaign_id [String] Unique campaign ID assigned by Voucherify. @param [Hash] opts the optional parameters @option opts [PromotionsTiersCreateRequestBody] :promotions_tiers_create_request_body Specify the promotion tier parameters. @return [Array<(PromotionsTiersCreateResponseBody, Integer, Hash)>] PromotionsTiersCreateResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/promotions_api.rb, line 39
        def add_promotion_tier_to_campaign_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PromotionsApi.add_promotion_tier_to_campaign ...'
  end
  # resource path
  local_var_path = '/v1/promotions/{campaignId}/tiers'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'promotions_tiers_create_request_body'])

  # return_type
  return_type = opts[:debug_return_type] || 'PromotionsTiersCreateResponseBody'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"PromotionsApi.add_promotion_tier_to_campaign",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PromotionsApi#add_promotion_tier_to_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
create_promotion_stack_with_http_info(campaign_id, opts = {}) click to toggle source

Create Promotion Stack This method creates one promotion stack. The sequence of promotion tier IDs will determine the promotion stacking order. @param campaign_id [String] Unique campaign ID. @param [Hash] opts the optional parameters @option opts [PromotionsStacksCreateRequestBody] :promotions_stacks_create_request_body Specify the order of promotion tiers for the promotion stack. @return [Array<(PromotionsStacksCreateResponseBody, Integer, Hash)>] PromotionsStacksCreateResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/promotions_api.rb, line 105
        def create_promotion_stack_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PromotionsApi.create_promotion_stack ...'
  end
  # resource path
  local_var_path = '/v1/promotions/{campaignId}/stacks'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'promotions_stacks_create_request_body'])

  # return_type
  return_type = opts[:debug_return_type] || 'PromotionsStacksCreateResponseBody'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"PromotionsApi.create_promotion_stack",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PromotionsApi#create_promotion_stack\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_promotion_stack_with_http_info(campaign_id, stack_id, opts = {}) click to toggle source

Delete Promotion Stack This method deletes a promotion stack. @param campaign_id [String] ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. @param stack_id [String] Promotion stack ID. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/VoucherifySdk/api/promotions_api.rb, line 171
        def delete_promotion_stack_with_http_info(campaign_id, stack_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PromotionsApi.delete_promotion_stack ...'
  end
  # resource path
  local_var_path = '/v1/promotions/{campaignId}/stacks/{stackId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'stackId' + '}', CGI.escape(stack_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"PromotionsApi.delete_promotion_stack",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PromotionsApi#delete_promotion_stack\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_promotion_tier_with_http_info(promotion_tier_id, opts = {}) click to toggle source

Delete Promotion Tier This method deletes a promotion tier. @param promotion_tier_id [String] Unique promotion tier ID. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/VoucherifySdk/api/promotions_api.rb, line 228
        def delete_promotion_tier_with_http_info(promotion_tier_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PromotionsApi.delete_promotion_tier ...'
  end
  # resource path
  local_var_path = '/v1/promotions/tiers/{promotionTierId}'.sub('{' + 'promotionTierId' + '}', CGI.escape(promotion_tier_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"PromotionsApi.delete_promotion_tier",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PromotionsApi#delete_promotion_tier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
disable_promotion_tier_with_http_info(promotion_tier_id, opts = {}) click to toggle source

Disable Promotion Tier This method disables a promotion tier, i.e. makes the active parameter false. @param promotion_tier_id [String] Unique promotion tier ID. @param [Hash] opts the optional parameters @return [Array<(PromotionsTiersDisableResponseBody, Integer, Hash)>] PromotionsTiersDisableResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/promotions_api.rb, line 285
        def disable_promotion_tier_with_http_info(promotion_tier_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PromotionsApi.disable_promotion_tier ...'
  end
  # resource path
  local_var_path = '/v1/promotions/tiers/{promotionTierId}/disable'.sub('{' + 'promotionTierId' + '}', CGI.escape(promotion_tier_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PromotionsTiersDisableResponseBody'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"PromotionsApi.disable_promotion_tier",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PromotionsApi#disable_promotion_tier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
enable_promotion_tier_with_http_info(promotion_tier_id, opts = {}) click to toggle source

Enable Promotion Tier This method enables a promotion tier, i.e. makes the active parameter true. @param promotion_tier_id [String] Unique promotion tier ID. @param [Hash] opts the optional parameters @return [Array<(PromotionsTiersEnableResponseBody, Integer, Hash)>] PromotionsTiersEnableResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/promotions_api.rb, line 344
        def enable_promotion_tier_with_http_info(promotion_tier_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PromotionsApi.enable_promotion_tier ...'
  end
  # resource path
  local_var_path = '/v1/promotions/tiers/{promotionTierId}/enable'.sub('{' + 'promotionTierId' + '}', CGI.escape(promotion_tier_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PromotionsTiersEnableResponseBody'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"PromotionsApi.enable_promotion_tier",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PromotionsApi#enable_promotion_tier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_promotion_stack_with_http_info(campaign_id, stack_id, opts = {}) click to toggle source

Get Promotion Stack This method returns the details of a promotion stack, including the promotion tiers grouped within the stack. @param campaign_id [String] ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. @param stack_id [String] Promotion stack ID. @param [Hash] opts the optional parameters @return [Array<(PromotionsStacksGetResponseBody, Integer, Hash)>] PromotionsStacksGetResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/promotions_api.rb, line 405
        def get_promotion_stack_with_http_info(campaign_id, stack_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PromotionsApi.get_promotion_stack ...'
  end
  # resource path
  local_var_path = '/v1/promotions/{campaignId}/stacks/{stackId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'stackId' + '}', CGI.escape(stack_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PromotionsStacksGetResponseBody'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"PromotionsApi.get_promotion_stack",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PromotionsApi#get_promotion_stack\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_promotion_tier_with_http_info(promotion_tier_id, opts = {}) click to toggle source

Get Promotion Tier This method enables you to retrieve a specific promotion tier. @param promotion_tier_id [String] Unique promotion tier ID. @param [Hash] opts the optional parameters @return [Array<(PromotionsTiersGetResponseBody, Integer, Hash)>] PromotionsTiersGetResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/promotions_api.rb, line 464
        def get_promotion_tier_with_http_info(promotion_tier_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PromotionsApi.get_promotion_tier ...'
  end
  # resource path
  local_var_path = '/v1/promotions/tiers/{promotionTierId}'.sub('{' + 'promotionTierId' + '}', CGI.escape(promotion_tier_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PromotionsTiersGetResponseBody'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"PromotionsApi.get_promotion_tier",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PromotionsApi#get_promotion_tier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_all_promotion_stacks_with_http_info(opts = {}) click to toggle source

List Promotion Stacks This method enables you to list promotion stacks irrespective of the campaign they are associated with. You can use filters in the query parameters to specify the stacks to be returned in the response. # Advanced filters for fetching promotion stacks

@param [Hash] opts the optional parameters @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. @option opts [Integer] :page Which page of results to return. The lowest value is 1. @option opts [ParameterOrderListAllPromotionStacks] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @option opts [ParameterCreatedBeforeAfter] :created_at A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at] 2017-09-08T13:52:18.227Z @option opts [ParameterUpdatedBeforeAfter] :updated_at A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at] 2017-09-08T13:52:18.227Z @return [Array<(PromotionsStacksListResponseBody, Integer, Hash)>] PromotionsStacksListResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/promotions_api.rb, line 531
        def list_all_promotion_stacks_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PromotionsApi.list_all_promotion_stacks ...'
  end
  # resource path
  local_var_path = '/v1/promotions/stacks'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'created_at'] = opts[:'created_at'] if !opts[:'created_at'].nil?
  query_params[:'updated_at'] = opts[:'updated_at'] if !opts[:'updated_at'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PromotionsStacksListResponseBody'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"PromotionsApi.list_all_promotion_stacks",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PromotionsApi#list_all_promotion_stacks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_promotion_stacks_in_campaign_with_http_info(campaign_id, opts = {}) click to toggle source

List Promotion Stacks in Campaign This method enables you to list promotion stacks from a specified campaign. @param campaign_id [String] Unique campaign ID. @param [Hash] opts the optional parameters @return [Array<(PromotionsStacksListResponseBody, Integer, Hash)>] PromotionsStacksListResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/promotions_api.rb, line 595
        def list_promotion_stacks_in_campaign_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PromotionsApi.list_promotion_stacks_in_campaign ...'
  end
  # resource path
  local_var_path = '/v1/promotions/{campaignId}/stacks'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PromotionsStacksListResponseBody'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"PromotionsApi.list_promotion_stacks_in_campaign",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PromotionsApi#list_promotion_stacks_in_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_promotion_tiers_from_campaign_with_http_info(campaign_id, opts = {}) click to toggle source

List Promotion Tiers from Campaign This method enables you to list promotion tiers from a specified campaign. @param campaign_id [String] Unique campaign ID assigned by Voucherify. @param [Hash] opts the optional parameters @return [Array<(PromotionsTiersListResponseBody, Integer, Hash)>] PromotionsTiersListResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/promotions_api.rb, line 723
        def list_promotion_tiers_from_campaign_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PromotionsApi.list_promotion_tiers_from_campaign ...'
  end
  # resource path
  local_var_path = '/v1/promotions/{campaignId}/tiers'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PromotionsTiersListResponseBody'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"PromotionsApi.list_promotion_tiers_from_campaign",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PromotionsApi#list_promotion_tiers_from_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_promotion_tiers_with_http_info(opts = {}) click to toggle source

List Promotion Tiers This method enables you to list promotion tiers. @param [Hash] opts the optional parameters @option opts [Boolean] :is_available This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. @option opts [Integer] :page Which page of results to return. The lowest value is 1. @option opts [ParameterOrderListPromotionTiers] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @return [Array<(PromotionsTiersListResponseBody, Integer, Hash)>] PromotionsTiersListResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/promotions_api.rb, line 660
        def list_promotion_tiers_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PromotionsApi.list_promotion_tiers ...'
  end
  # resource path
  local_var_path = '/v1/promotions/tiers'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'is_available'] = opts[:'is_available'] if !opts[:'is_available'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PromotionsTiersListResponseBody'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"PromotionsApi.list_promotion_tiers",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PromotionsApi#list_promotion_tiers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_promotion_stack_with_http_info(campaign_id, stack_id, opts = {}) click to toggle source

Update Promotion Stack This methods allows for editing an existing stack. @param campaign_id [String] ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. @param stack_id [String] Promotion stack ID. @param [Hash] opts the optional parameters @option opts [PromotionsStacksUpdateRequestBody] :promotions_stacks_update_request_body Specify the promotion stack parameters that you would like to update. @return [Array<(PromotionsStacksUpdateResponseBody, Integer, Hash)>] PromotionsStacksUpdateResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/promotions_api.rb, line 786
        def update_promotion_stack_with_http_info(campaign_id, stack_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PromotionsApi.update_promotion_stack ...'
  end
  # resource path
  local_var_path = '/v1/promotions/{campaignId}/stacks/{stackId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'stackId' + '}', CGI.escape(stack_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'promotions_stacks_update_request_body'])

  # return_type
  return_type = opts[:debug_return_type] || 'PromotionsStacksUpdateResponseBody'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"PromotionsApi.update_promotion_stack",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PromotionsApi#update_promotion_stack\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_promotion_tier_with_http_info(promotion_tier_id, opts = {}) click to toggle source

Update Promotion Tier This method updates a promotion tier. @param promotion_tier_id [String] Unique promotion tier ID. @param [Hash] opts the optional parameters @option opts [PromotionsTiersUpdateRequestBody] :promotions_tiers_update_request_body Specify the promotion tier parameters that you would like to update. @return [Array<(PromotionsTiersUpdateResponseBody, Integer, Hash)>] PromotionsTiersUpdateResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/promotions_api.rb, line 852
        def update_promotion_tier_with_http_info(promotion_tier_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PromotionsApi.update_promotion_tier ...'
  end
  # resource path
  local_var_path = '/v1/promotions/tiers/{promotionTierId}'.sub('{' + 'promotionTierId' + '}', CGI.escape(promotion_tier_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'promotions_tiers_update_request_body'])

  # return_type
  return_type = opts[:debug_return_type] || 'PromotionsTiersUpdateResponseBody'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"PromotionsApi.update_promotion_tier",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PromotionsApi#update_promotion_tier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end