class VoucherifySdk::CustomersApi
Attributes
Public Class Methods
# File lib/VoucherifySdk/api/customers_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Create Customer
Creates a customer object. 📘 Upsert Mode If you pass an id or a source_id that already exists in the customer database, Voucherify will return a related customer object with updated fields. @param [Hash] opts the optional parameters @option opts [CustomersCreateRequestBody] :customers_create_request_body Create a customer with specified parameters. @return [CustomersCreateResponseBody]
# File lib/VoucherifySdk/api/customers_api.rb, line 27 def create_customer(opts = {}) data, _status_code, _headers = create_customer_with_http_info(opts) data end
Delete Customer
Permanently The organization user can remove consumer data permanently from the Voucherify system by using this API method. It deletes all customer data and connected resources. It makes the customer profile forgotten by Voucherify. @param customer_id [String] A Voucherify customers id or source_id. @param [Hash] opts the optional parameters @return [CustomersPermanentDeletionCreateResponseBody]
# File lib/VoucherifySdk/api/customers_api.rb, line 91 def customer_permanently_deletion(customer_id, opts = {}) data, _status_code, _headers = customer_permanently_deletion_with_http_info(customer_id, opts) data end
Delete Customer
This method deletes a customer. @param customer_id [String] A Voucherify customers id or source_id. @param [Hash] opts the optional parameters @return [nil]
# File lib/VoucherifySdk/api/customers_api.rb, line 150 def delete_customer(customer_id, opts = {}) delete_customer_with_http_info(customer_id, opts) nil end
Get Customer
Retrieve customer details. @param customer_id [String] A Voucherify customers id or source_id. @param [Hash] opts the optional parameters @return [CustomersGetResponseBody]
# File lib/VoucherifySdk/api/customers_api.rb, line 207 def get_customer(customer_id, opts = {}) data, _status_code, _headers = get_customer_with_http_info(customer_id, opts) data end
Import and Update Customers using CSV This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. # Request Example # CSV File Format The CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object. 📘 Standard customer fields mapping **No spaces allowed in field names** Id, Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2 # Update Customers using CSV If you would like to update customers data, you can do it using the CSV file with new data. However, remember to include a source_id in your CSV file to manage the update successfully. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. @param [Hash] opts the optional parameters @option opts [File] :file File path. @return [CustomersImportCsvCreateResponseBody]
# File lib/VoucherifySdk/api/customers_api.rb, line 266 def import_customers_using_csv(opts = {}) data, _status_code, _headers = import_customers_using_csv_with_http_info(opts) data end
List Customer
Activities [Deprecated] > ❗️ Deprecated This endpoint represents the deprecated version of the API responsible for listing customer activities and we do not recommend using it. Developers are encouraged to migrate to the latest version to take advantage of the latest enhancements and bug fixes. No updates will be provided to the deprecated endpoint. Retrieve customer activities. @param customer_id [String] A Voucherify customers id or source ID of the customer who performed the activities. @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 [ParameterOrder] :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 [Time] :starting_after A cursor for pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. @option opts [ParameterCampaignType] :campaign_type Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM @option opts [String] :campaign_id By applying this parameter you request only events related to specific campaign identified by its ID. @option opts [String] :product_id By applying this parameter you request only events related to specific product identified by its ID. @option opts [Time] :start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @return [CustomersActivitiesListResponseBody]
# File lib/VoucherifySdk/api/customers_api.rb, line 340 def list_customer_activities(customer_id, opts = {}) data, _status_code, _headers = list_customer_activities_with_http_info(customer_id, opts) data end
List Customer
Activity Retrieve customer activities. @param customer_id [String] A Voucherify customers id or source ID of the customer who performed the activities. @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 [ParameterOrderCreatedAt] :order Apply this filter to order the events according the date and time when it was created. @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. @option opts [Time] :start_date Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @option opts [String] :campaign_id Requests only events related to specific campaign identified by its ID. @option opts [ParameterCampaignType] :campaign_type Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. @option opts [ParameterActivityCategory] :category Filters activities for actions or effects. Allowed values: ACTION, EFFECT. @option opts [String] :type Event name of the customer event. @return [CustomersActivityListResponseBody]
# File lib/VoucherifySdk/api/customers_api.rb, line 426 def list_customer_activity(customer_id, opts = {}) data, _status_code, _headers = list_customer_activity_with_http_info(customer_id, opts) data end
List Customer’s Redeemables 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 customer_id [String] Unique identifier of a customer represented by an internal customer ID or customer source ID. @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 [ParameterFiltersListCustomerRedeemables] :filters Filters for listing customer redeemables. @return [CustomersRedeemablesListResponseBody]
# File lib/VoucherifySdk/api/customers_api.rb, line 507 def list_customer_redeemables(customer_id, opts = {}) data, _status_code, _headers = list_customer_redeemables_with_http_info(customer_id, opts) data end
List Customer’s Segments Returns the list of segments IDs to which the customer belongs to. If you pass a customerId which is not stored and recognized by Voucherify as an existing customer in the system, the response will generate a list of segments that the customer would potentialy qualify for if they were to become a customer tracked in the system. @param customer_id [String] Unique identifier of a customer represented by an internal customer ID or customer source ID. @param [Hash] opts the optional parameters @return [CustomersSegmentsListResponseBody]
# File lib/VoucherifySdk/api/customers_api.rb, line 574 def list_customer_segments(customer_id, opts = {}) data, _status_code, _headers = list_customer_segments_with_http_info(customer_id, opts) data end
List Customers Returns a list of customers. @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 [Integer] :page Which page of results to return. The lowest value is 1. @option opts [String] :email Limit the customers to the ones that have this specific email address. @option opts [String] :city Limit the customers to the ones that are located in the specified city. @option opts [String] :name Filter customers by the name property. @option opts [String] :segment_id Filter customers by the segment id. @option opts [Time] :created_at_before Filter customers by date customer was created. @option opts [Time] :created_at_after Filter customers by date customer was created. @option opts [Time] :updated_at_before Filter customers by date customer was updated last time. @option opts [Time] :updated_at_after Filter customers by date customer was updated last time. @option opts [ParameterOrderListCustomers] :order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @option opts [Time] :starting_after A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list.
@return [CustomersListResponseBody]
# File lib/VoucherifySdk/api/customers_api.rb, line 644 def list_customers(opts = {}) data, _status_code, _headers = list_customers_with_http_info(opts) data end
Update Customer
Updates the specified customer by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. @param customer_id [String] A Voucherify customers id or source_id. @param [Hash] opts the optional parameters @option opts [CustomersUpdateRequestBody] :customers_update_request_body Specify the parameters to be updated. @return [CustomersUpdateResponseBody]
# File lib/VoucherifySdk/api/customers_api.rb, line 727 def update_customer(customer_id, opts = {}) data, _status_code, _headers = update_customer_with_http_info(customer_id, opts) data end
Update Customers in Bulk Updates customers in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a customer object is not found, it is upserted. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. @param [Hash] opts the optional parameters @option opts [Array<CustomersUpdateInBulkRequestBody>] :customers_update_in_bulk_request_body List the customer fields to be updated in each customer object. @return [CustomersUpdateInBulkResponseBody]
# File lib/VoucherifySdk/api/customers_api.rb, line 792 def update_customers_in_bulk(opts = {}) data, _status_code, _headers = update_customers_in_bulk_with_http_info(opts) data end
Update Customers’ Metadata in Bulk Updates metadata parameters for a list of customers. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is upserted. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. @param [Hash] opts the optional parameters @option opts [CustomersMetadataUpdateInBulkRequestBody] :customers_metadata_update_in_bulk_request_body List the source_ids of the customers you would like to update with the metadata key/value pairs. @return [CustomersMetadataUpdateInBulkResponseBody]
# File lib/VoucherifySdk/api/customers_api.rb, line 856 def update_customers_metadata_in_bulk(opts = {}) data, _status_code, _headers = update_customers_metadata_in_bulk_with_http_info(opts) data end
Private Instance Methods
Create Customer
Creates a customer object. 📘 Upsert Mode If you pass an id or a source_id that already exists in the customer database, Voucherify will return a related customer object with updated fields. @param [Hash] opts the optional parameters @option opts [CustomersCreateRequestBody] :customers_create_request_body Create a customer with specified parameters. @return [Array<(CustomersCreateResponseBody
, Integer, Hash)>] CustomersCreateResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/customers_api.rb, line 37 def create_customer_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.create_customer ...' end # resource path local_var_path = '/v1/customers' # 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[:'customers_create_request_body']) # return_type return_type = opts[:debug_return_type] || 'CustomersCreateResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"CustomersApi.create_customer", :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: CustomersApi#create_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Delete Customer
Permanently The organization user can remove consumer data permanently from the Voucherify system by using this API method. It deletes all customer data and connected resources. It makes the customer profile forgotten by Voucherify. @param customer_id [String] A Voucherify customers id or source_id. @param [Hash] opts the optional parameters @return [Array<(CustomersPermanentDeletionCreateResponseBody
, Integer, Hash)>] CustomersPermanentDeletionCreateResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/customers_api.rb, line 101 def customer_permanently_deletion_with_http_info(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.customer_permanently_deletion ...' end # resource path local_var_path = '/v1/customers/{customerId}/permanent-deletion'.sub('{' + 'customerId' + '}', CGI.escape(customer_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] || 'CustomersPermanentDeletionCreateResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"CustomersApi.customer_permanently_deletion", :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: CustomersApi#customer_permanently_deletion\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Delete Customer
This method deletes a customer. @param customer_id [String] A Voucherify customers id or source_id. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/VoucherifySdk/api/customers_api.rb, line 160 def delete_customer_with_http_info(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.delete_customer ...' end # resource path local_var_path = '/v1/customers/{customerId}'.sub('{' + 'customerId' + '}', CGI.escape(customer_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 => :"CustomersApi.delete_customer", :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: CustomersApi#delete_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Customer
Retrieve customer details. @param customer_id [String] A Voucherify customers id or source_id. @param [Hash] opts the optional parameters @return [Array<(CustomersGetResponseBody
, Integer, Hash)>] CustomersGetResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/customers_api.rb, line 217 def get_customer_with_http_info(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.get_customer ...' end # resource path local_var_path = '/v1/customers/{customerId}'.sub('{' + 'customerId' + '}', CGI.escape(customer_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] || 'CustomersGetResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"CustomersApi.get_customer", :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: CustomersApi#get_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Import and Update Customers using CSV This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. # Request Example # CSV File Format The CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object. 📘 Standard customer fields mapping **No spaces allowed in field names** Id, Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2 # Update Customers using CSV If you would like to update customers data, you can do it using the CSV file with new data. However, remember to include a source_id in your CSV file to manage the update successfully. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. @param [Hash] opts the optional parameters @option opts [File] :file File path. @return [Array<(CustomersImportCsvCreateResponseBody
, Integer, Hash)>] CustomersImportCsvCreateResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/customers_api.rb, line 276 def import_customers_using_csv_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.import_customers_using_csv ...' end # resource path local_var_path = '/v1/customers/importCSV' # 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(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['file'] = opts[:'file'] if !opts[:'file'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'CustomersImportCsvCreateResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"CustomersApi.import_customers_using_csv", :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: CustomersApi#import_customers_using_csv\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List Customer
Activities [Deprecated] > ❗️ Deprecated This endpoint represents the deprecated version of the API responsible for listing customer activities and we do not recommend using it. Developers are encouraged to migrate to the latest version to take advantage of the latest enhancements and bug fixes. No updates will be provided to the deprecated endpoint. Retrieve customer activities. @param customer_id [String] A Voucherify customers id or source ID of the customer who performed the activities. @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 [ParameterOrder] :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 [Time] :starting_after A cursor for pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. @option opts [ParameterCampaignType] :campaign_type Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM @option opts [String] :campaign_id By applying this parameter you request only events related to specific campaign identified by its ID. @option opts [String] :product_id By applying this parameter you request only events related to specific product identified by its ID. @option opts [Time] :start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @return [Array<(CustomersActivitiesListResponseBody
, Integer, Hash)>] CustomersActivitiesListResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/customers_api.rb, line 359 def list_customer_activities_with_http_info(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.list_customer_activities ...' end # resource path local_var_path = '/v1/customers/{customerId}/activities'.sub('{' + 'customerId' + '}', CGI.escape(customer_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'] = opts[:'starting_after'] if !opts[:'starting_after'].nil? query_params[:'starting_after_id'] = opts[:'starting_after_id'] if !opts[:'starting_after_id'].nil? query_params[:'campaign_type'] = opts[:'campaign_type'] if !opts[:'campaign_type'].nil? query_params[:'campaign_id'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil? query_params[:'product_id'] = opts[:'product_id'] if !opts[:'product_id'].nil? query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].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] || 'CustomersActivitiesListResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"CustomersApi.list_customer_activities", :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: CustomersApi#list_customer_activities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List Customer
Activity Retrieve customer activities. @param customer_id [String] A Voucherify customers id or source ID of the customer who performed the activities. @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 [ParameterOrderCreatedAt] :order Apply this filter to order the events according the date and time when it was created. @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. @option opts [Time] :start_date Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @option opts [String] :campaign_id Requests only events related to specific campaign identified by its ID. @option opts [ParameterCampaignType] :campaign_type Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. @option opts [ParameterActivityCategory] :category Filters activities for actions or effects. Allowed values: ACTION, EFFECT. @option opts [String] :type Event name of the customer event. @return [Array<(CustomersActivityListResponseBody
, Integer, Hash)>] CustomersActivityListResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/customers_api.rb, line 445 def list_customer_activity_with_http_info(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.list_customer_activity ...' end # resource path local_var_path = '/v1/customers/{customerId}/activity'.sub('{' + 'customerId' + '}', CGI.escape(customer_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[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'campaign_id'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil? query_params[:'campaign_type'] = opts[:'campaign_type'] if !opts[:'campaign_type'].nil? query_params[:'category'] = opts[:'category'] if !opts[:'category'].nil? query_params[:'type'] = opts[:'type'] if !opts[:'type'].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] || 'CustomersActivityListResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"CustomersApi.list_customer_activity", :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: CustomersApi#list_customer_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List Customer's Redeemables 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 customer_id [String] Unique identifier of a customer represented by an internal customer ID or customer source ID. @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 [ParameterFiltersListCustomerRedeemables] :filters Filters for listing customer redeemables. @return [Array<(CustomersRedeemablesListResponseBody
, Integer, Hash)>] CustomersRedeemablesListResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/customers_api.rb, line 521 def list_customer_redeemables_with_http_info(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.list_customer_redeemables ...' end # resource path local_var_path = '/v1/customers/{customerId}/redeemables'.sub('{' + 'customerId' + '}', CGI.escape(customer_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] || 'CustomersRedeemablesListResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"CustomersApi.list_customer_redeemables", :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: CustomersApi#list_customer_redeemables\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List Customer's Segments Returns the list of segments IDs to which the customer belongs to. If you pass a customerId which is not stored and recognized by Voucherify as an existing customer in the system, the response will generate a list of segments that the customer would potentialy qualify for if they were to become a customer tracked in the system. @param customer_id [String] Unique identifier of a customer represented by an internal customer ID or customer source ID. @param [Hash] opts the optional parameters @return [Array<(CustomersSegmentsListResponseBody
, Integer, Hash)>] CustomersSegmentsListResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/customers_api.rb, line 584 def list_customer_segments_with_http_info(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.list_customer_segments ...' end # resource path local_var_path = '/v1/customers/{customerId}/segments'.sub('{' + 'customerId' + '}', CGI.escape(customer_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] || 'CustomersSegmentsListResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"CustomersApi.list_customer_segments", :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: CustomersApi#list_customer_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List Customers Returns a list of customers. @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 [Integer] :page Which page of results to return. The lowest value is 1. @option opts [String] :email Limit the customers to the ones that have this specific email address. @option opts [String] :city Limit the customers to the ones that are located in the specified city. @option opts [String] :name Filter customers by the name property. @option opts [String] :segment_id Filter customers by the segment id. @option opts [Time] :created_at_before Filter customers by date customer was created. @option opts [Time] :created_at_after Filter customers by date customer was created. @option opts [Time] :updated_at_before Filter customers by date customer was updated last time. @option opts [Time] :updated_at_after Filter customers by date customer was updated last time. @option opts [ParameterOrderListCustomers] :order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @option opts [Time] :starting_after A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list.
@return [Array<(CustomersListResponseBody
, Integer, Hash)>] CustomersListResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/customers_api.rb, line 665 def list_customers_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.list_customers ...' end # resource path local_var_path = '/v1/customers' # 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[:'email'] = opts[:'email'] if !opts[:'email'].nil? query_params[:'city'] = opts[:'city'] if !opts[:'city'].nil? query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil? query_params[:'segment_id'] = opts[:'segment_id'] if !opts[:'segment_id'].nil? query_params[:'created_at[before]'] = opts[:'created_at_before'] if !opts[:'created_at_before'].nil? query_params[:'created_at[after]'] = opts[:'created_at_after'] if !opts[:'created_at_after'].nil? query_params[:'updated_at[before]'] = opts[:'updated_at_before'] if !opts[:'updated_at_before'].nil? query_params[:'updated_at[after]'] = opts[:'updated_at_after'] if !opts[:'updated_at_after'].nil? query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'starting_after'] = opts[:'starting_after'] if !opts[:'starting_after'].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] || 'CustomersListResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"CustomersApi.list_customers", :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: CustomersApi#list_customers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update Customer
Updates the specified customer by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. @param customer_id [String] A Voucherify customers id or source_id. @param [Hash] opts the optional parameters @option opts [CustomersUpdateRequestBody] :customers_update_request_body Specify the parameters to be updated. @return [Array<(CustomersUpdateResponseBody
, Integer, Hash)>] CustomersUpdateResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/customers_api.rb, line 738 def update_customer_with_http_info(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.update_customer ...' end # resource path local_var_path = '/v1/customers/{customerId}'.sub('{' + 'customerId' + '}', CGI.escape(customer_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[:'customers_update_request_body']) # return_type return_type = opts[:debug_return_type] || 'CustomersUpdateResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"CustomersApi.update_customer", :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: CustomersApi#update_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update Customers in Bulk Updates customers in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a customer object is not found, it is upserted. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. @param [Hash] opts the optional parameters @option opts [Array<CustomersUpdateInBulkRequestBody>] :customers_update_in_bulk_request_body List the customer fields to be updated in each customer object. @return [Array<(CustomersUpdateInBulkResponseBody
, Integer, Hash)>] CustomersUpdateInBulkResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/customers_api.rb, line 802 def update_customers_in_bulk_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.update_customers_in_bulk ...' end # resource path local_var_path = '/v1/customers/bulk/async' # 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[:'customers_update_in_bulk_request_body']) # return_type return_type = opts[:debug_return_type] || 'CustomersUpdateInBulkResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"CustomersApi.update_customers_in_bulk", :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: CustomersApi#update_customers_in_bulk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update Customers' Metadata in Bulk Updates metadata parameters for a list of customers. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is upserted. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. @param [Hash] opts the optional parameters @option opts [CustomersMetadataUpdateInBulkRequestBody] :customers_metadata_update_in_bulk_request_body List the source_ids of the customers you would like to update with the metadata key/value pairs. @return [Array<(CustomersMetadataUpdateInBulkResponseBody
, Integer, Hash)>] CustomersMetadataUpdateInBulkResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/customers_api.rb, line 866 def update_customers_metadata_in_bulk_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.update_customers_metadata_in_bulk ...' end # resource path local_var_path = '/v1/customers/metadata/async' # 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[:'customers_metadata_update_in_bulk_request_body']) # return_type return_type = opts[:debug_return_type] || 'CustomersMetadataUpdateInBulkResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"CustomersApi.update_customers_metadata_in_bulk", :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: CustomersApi#update_customers_metadata_in_bulk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end