class VoucherifySdk::ReferralsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

referrals_add_holders(member_id, opts = {}) click to toggle source

Add Referral Code Holders Adds new holders to a referral code as referees. The data sent in the request is upserted into the customer data. If the request returns an error even for one customer, you have to resend the whole request. Customer data is upserted if the data for all customers is correct. To use this endpoint, you must have the following permissions: - Create and modify Customers and Segments (customers.modify) - Publish Voucher (vouchers.publish) 👍 To add a holder as a referer, use the Create Publication endpoint. 📘 Alternative endpoint This endpoint is an alternative to the Add Referral Code Holders endpoint. The URL was re-designed to retrieve the referral member holders without providing the campaignId as a path paremeter. @param member_id [String] Unique referral code or its identifier. @param [Hash] opts the optional parameters @option opts [ReferralsMembersHoldersCreateInBulkRequestBody] :referrals_members_holders_create_in_bulk_request_body Specify the customer data to be upserted as redeemable holders. @return [ReferralsMembersHoldersCreateInBulkResponseBody]

# File lib/VoucherifySdk/api/referrals_api.rb, line 28
def referrals_add_holders(member_id, opts = {})
  data, _status_code, _headers = referrals_add_holders_with_http_info(member_id, opts)
  data
end
referrals_add_holders1(campaign_id, member_id, opts = {}) click to toggle source

Add Referral Code Holders Adds new holders to a referral code as referees. The data sent in the request is upserted into the customer data. If the request returns an error even for one customer, you have to resend the whole request. Customer data is upserted if the data for all customers is correct. To use this endpoint, you must have the following permissions: - Create and modify Customers and Segments (customers.modify) - Publish Voucher (vouchers.publish) 👍 To add a holder as a referer, use the Create Publication endpoint. @param campaign_id [String] Unique identifier of a referral program campaign. @param member_id [String] Unique referral code or its identifier. @param [Hash] opts the optional parameters @option opts [ReferralsMembersHoldersCreateInBulkRequestBody] :referrals_members_holders_create_in_bulk_request_body Specify the customer data to be upserted as redeemable holders. @return [ReferralsMembersHoldersCreateInBulkResponseBody]

# File lib/VoucherifySdk/api/referrals_api.rb, line 95
def referrals_add_holders1(campaign_id, member_id, opts = {})
  data, _status_code, _headers = referrals_add_holders1_with_http_info(campaign_id, member_id, opts)
  data
end
referrals_code_holders(campaign_id, member_id, opts = {}) click to toggle source

List Referral Code Holders Retrieves all the redeemables that have been assigned to the customer. To use this endpoint, you must have the following permissions: - Read Customers (customers.details.read) @param campaign_id [String] Unique identifier of a referral program campaign. @param member_id [String] Unique referral code or its identifier. @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. If no limit is set, it returns 10 items. @option opts [ParameterOrderListRedeemables] :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 [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. @option opts [ParameterFiltersListReferralsRedeemableHolders] :filters Filters for listing customer redeemables. @return [ReferralsMembersHoldersListResponseBody]

# File lib/VoucherifySdk/api/referrals_api.rb, line 166
def referrals_code_holders(campaign_id, member_id, opts = {})
  data, _status_code, _headers = referrals_code_holders_with_http_info(campaign_id, member_id, opts)
  data
end
referrals_code_holders1(member_id, opts = {}) click to toggle source

List Referral Code Holders Retrieves the holders of the referral code from a referral campaign. To use this endpoint, you must have the following permissions: - Read Customers (customers.details.read) 📘 Alternative endpoint This endpoint is an alternative to the List Member Holders endpoint. The URL was re-designed to retrieve the referral member holders without providing the campaignId as a path paremeter. @param member_id [String] Unique referral code or its identifier. @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. If no limit is set, it returns 10 items. @option opts [ParameterOrderListRedeemables] :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 [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. @option opts [ParameterFiltersListReferralsRedeemableHolders] :filters Filters for listing customer redeemables. @return [ReferralsMembersHoldersListResponseBody]

# File lib/VoucherifySdk/api/referrals_api.rb, line 238
def referrals_code_holders1(member_id, opts = {})
  data, _status_code, _headers = referrals_code_holders1_with_http_info(member_id, opts)
  data
end
referrals_remove_holder(member_id, holder_id, opts = {}) click to toggle source

Remove Referral Card Holder Removes the holder from a referral card. You can remove a referee only. To use this endpoint, you must have the following permissions: - Create and modify Customers and Segments (customers.modify) - Publish Voucher (vouchers.publish) 📘 Alternative endpoint This endpoint is an alternative to the Remove Referral Card Holder endpoint. The URL was re-designed to retrieve the referral member holders without providing the campaignId as a path paremeter. @param member_id [String] Unique referral code or its identifier. @param holder_id [String] Unique identifier of a redeemable holder. @param [Hash] opts the optional parameters @return [nil]

# File lib/VoucherifySdk/api/referrals_api.rb, line 306
def referrals_remove_holder(member_id, holder_id, opts = {})
  referrals_remove_holder_with_http_info(member_id, holder_id, opts)
  nil
end
referrals_remove_holder1(campaign_id, member_id, holder_id, opts = {}) click to toggle source

Remove Referral Card Holder Removes the holder from a referral card. You can remove a referee only. To use this endpoint, you must have the following permissions: - Create and modify Customers and Segments (customers.modify) - Publish Voucher (vouchers.publish) @param campaign_id [String] Unique identifier of a referral program campaign. @param member_id [String] Unique referral code or its identifier. @param holder_id [String] Unique identifier of a redeemable holder. @param [Hash] opts the optional parameters @return [nil]

# File lib/VoucherifySdk/api/referrals_api.rb, line 366
def referrals_remove_holder1(campaign_id, member_id, holder_id, opts = {})
  referrals_remove_holder1_with_http_info(campaign_id, member_id, holder_id, opts)
  nil
end

Private Instance Methods

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

Add Referral Code Holders Adds new holders to a referral code as referees. The data sent in the request is upserted into the customer data. If the request returns an error even for one customer, you have to resend the whole request. Customer data is upserted if the data for all customers is correct. To use this endpoint, you must have the following permissions: - Create and modify Customers and Segments (customers.modify) - Publish Voucher (vouchers.publish) 👍 To add a holder as a referer, use the Create Publication endpoint. @param campaign_id [String] Unique identifier of a referral program campaign. @param member_id [String] Unique referral code or its identifier. @param [Hash] opts the optional parameters @option opts [ReferralsMembersHoldersCreateInBulkRequestBody] :referrals_members_holders_create_in_bulk_request_body Specify the customer data to be upserted as redeemable holders. @return [Array<(ReferralsMembersHoldersCreateInBulkResponseBody, Integer, Hash)>] ReferralsMembersHoldersCreateInBulkResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/referrals_api.rb, line 107
        def referrals_add_holders1_with_http_info(campaign_id, member_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReferralsApi.referrals_add_holders1 ...'
  end
  # resource path
  local_var_path = '/v1/referrals/{campaignId}/members/{memberId}/holders'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'memberId' + '}', CGI.escape(member_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[:'referrals_members_holders_create_in_bulk_request_body'])

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

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

  new_options = opts.merge(
    :operation => :"ReferralsApi.referrals_add_holders1",
    :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: ReferralsApi#referrals_add_holders1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
referrals_add_holders_with_http_info(member_id, opts = {}) click to toggle source

Add Referral Code Holders Adds new holders to a referral code as referees. The data sent in the request is upserted into the customer data. If the request returns an error even for one customer, you have to resend the whole request. Customer data is upserted if the data for all customers is correct. To use this endpoint, you must have the following permissions: - Create and modify Customers and Segments (customers.modify) - Publish Voucher (vouchers.publish) 👍 To add a holder as a referer, use the Create Publication endpoint. 📘 Alternative endpoint This endpoint is an alternative to the Add Referral Code Holders endpoint. The URL was re-designed to retrieve the referral member holders without providing the campaignId as a path paremeter. @param member_id [String] Unique referral code or its identifier. @param [Hash] opts the optional parameters @option opts [ReferralsMembersHoldersCreateInBulkRequestBody] :referrals_members_holders_create_in_bulk_request_body Specify the customer data to be upserted as redeemable holders. @return [Array<(ReferralsMembersHoldersCreateInBulkResponseBody, Integer, Hash)>] ReferralsMembersHoldersCreateInBulkResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/referrals_api.rb, line 39
        def referrals_add_holders_with_http_info(member_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReferralsApi.referrals_add_holders ...'
  end
  # resource path
  local_var_path = '/v1/referrals/members/{memberId}/holders'.sub('{' + 'memberId' + '}', CGI.escape(member_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[:'referrals_members_holders_create_in_bulk_request_body'])

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

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

  new_options = opts.merge(
    :operation => :"ReferralsApi.referrals_add_holders",
    :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: ReferralsApi#referrals_add_holders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
referrals_code_holders1_with_http_info(member_id, opts = {}) click to toggle source

List Referral Code Holders Retrieves the holders of the referral code from a referral campaign. To use this endpoint, you must have the following permissions: - Read Customers (customers.details.read) 📘 Alternative endpoint This endpoint is an alternative to the List Member Holders endpoint. The URL was re-designed to retrieve the referral member holders without providing the campaignId as a path paremeter. @param member_id [String] Unique referral code or its identifier. @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. If no limit is set, it returns 10 items. @option opts [ParameterOrderListRedeemables] :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 [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. @option opts [ParameterFiltersListReferralsRedeemableHolders] :filters Filters for listing customer redeemables. @return [Array<(ReferralsMembersHoldersListResponseBody, Integer, Hash)>] ReferralsMembersHoldersListResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/referrals_api.rb, line 252
        def referrals_code_holders1_with_http_info(member_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReferralsApi.referrals_code_holders1 ...'
  end
  # resource path
  local_var_path = '/v1/referrals/members/{memberId}/holders'.sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'starting_after_id'] = opts[:'starting_after_id'] if !opts[:'starting_after_id'].nil?
  query_params[:'filters'] = opts[:'filters'] if !opts[:'filters'].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] || 'ReferralsMembersHoldersListResponseBody'

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

  new_options = opts.merge(
    :operation => :"ReferralsApi.referrals_code_holders1",
    :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: ReferralsApi#referrals_code_holders1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
referrals_code_holders_with_http_info(campaign_id, member_id, opts = {}) click to toggle source

List Referral Code Holders Retrieves all the redeemables that have been assigned to the customer. To use this endpoint, you must have the following permissions: - Read Customers (customers.details.read) @param campaign_id [String] Unique identifier of a referral program campaign. @param member_id [String] Unique referral code or its identifier. @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. If no limit is set, it returns 10 items. @option opts [ParameterOrderListRedeemables] :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 [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. @option opts [ParameterFiltersListReferralsRedeemableHolders] :filters Filters for listing customer redeemables. @return [Array<(ReferralsMembersHoldersListResponseBody, Integer, Hash)>] ReferralsMembersHoldersListResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/referrals_api.rb, line 181
        def referrals_code_holders_with_http_info(campaign_id, member_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReferralsApi.referrals_code_holders ...'
  end
  # resource path
  local_var_path = '/v1/referrals/{campaignId}/members/{memberId}/holders'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'starting_after_id'] = opts[:'starting_after_id'] if !opts[:'starting_after_id'].nil?
  query_params[:'filters'] = opts[:'filters'] if !opts[:'filters'].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] || 'ReferralsMembersHoldersListResponseBody'

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

  new_options = opts.merge(
    :operation => :"ReferralsApi.referrals_code_holders",
    :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: ReferralsApi#referrals_code_holders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
referrals_remove_holder1_with_http_info(campaign_id, member_id, holder_id, opts = {}) click to toggle source

Remove Referral Card Holder Removes the holder from a referral card. You can remove a referee only. To use this endpoint, you must have the following permissions: - Create and modify Customers and Segments (customers.modify) - Publish Voucher (vouchers.publish) @param campaign_id [String] Unique identifier of a referral program campaign. @param member_id [String] Unique referral code or its identifier. @param holder_id [String] Unique identifier of a redeemable holder. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/VoucherifySdk/api/referrals_api.rb, line 378
        def referrals_remove_holder1_with_http_info(campaign_id, member_id, holder_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReferralsApi.referrals_remove_holder1 ...'
  end
  # resource path
  local_var_path = '/v1/referrals/{campaignId}/members/{memberId}/holders/{holderId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)).sub('{' + 'holderId' + '}', CGI.escape(holder_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 => :"ReferralsApi.referrals_remove_holder1",
    :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: ReferralsApi#referrals_remove_holder1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
referrals_remove_holder_with_http_info(member_id, holder_id, opts = {}) click to toggle source

Remove Referral Card Holder Removes the holder from a referral card. You can remove a referee only. To use this endpoint, you must have the following permissions: - Create and modify Customers and Segments (customers.modify) - Publish Voucher (vouchers.publish) 📘 Alternative endpoint This endpoint is an alternative to the Remove Referral Card Holder endpoint. The URL was re-designed to retrieve the referral member holders without providing the campaignId as a path paremeter. @param member_id [String] Unique referral code or its identifier. @param holder_id [String] Unique identifier of a redeemable holder. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/VoucherifySdk/api/referrals_api.rb, line 317
        def referrals_remove_holder_with_http_info(member_id, holder_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReferralsApi.referrals_remove_holder ...'
  end
  # resource path
  local_var_path = '/v1/referrals/members/{memberId}/holders/{holderId}'.sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s)).sub('{' + 'holderId' + '}', CGI.escape(holder_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 => :"ReferralsApi.referrals_remove_holder",
    :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: ReferralsApi#referrals_remove_holder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end