Class: VoucherifySdk::CustomersApi

Inherits:
Object
  • Object
show all
Defined in:
lib/VoucherifySdk/api/customers_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CustomersApi

Returns a new instance of CustomersApi.



19
20
21
# File 'lib/VoucherifySdk/api/customers_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/VoucherifySdk/api/customers_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_customer(opts = {}) ⇒ CustomersCreateResponseBody

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.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



27
28
29
30
# 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

#customer_permanently_deletion(customer_id, opts = {}) ⇒ CustomersPermanentDeletionCreateResponseBody

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.

Parameters:

  • customer_id (String)

    A Voucherify customers id or source_id.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



91
92
93
94
# 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(customer_id, opts = {}) ⇒ nil

Delete Customer This method deletes a customer.

Parameters:

  • customer_id (String)

    A Voucherify customers id or source_id.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


150
151
152
153
# 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(customer_id, opts = {}) ⇒ CustomersGetResponseBody

Get Customer Retrieve customer details.

Parameters:

  • customer_id (String)

    A Voucherify customers id or source_id.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



207
208
209
210
# 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_customers_using_csv(opts = {}) ⇒ CustomersImportCsvCreateResponseBody

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.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :file (File)

    File path.

Returns:



266
267
268
269
# 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(customer_id, opts = {}) ⇒ CustomersActivitiesListResponseBody

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.

Parameters:

  • customer_id (String)

    A Voucherify customers id or source ID of the customer who performed the activities.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    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.

  • :order (ParameterOrder)

    Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.

  • :starting_after (Time)

    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.

  • :starting_after_id (String)

    A cursor for pagination. It retrieves the events starting after an event with the given ID.

  • :campaign_type (ParameterCampaignType)

    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

  • :campaign_id (String)

    By applying this parameter you request only events related to specific campaign identified by its ID.

  • :product_id (String)

    By applying this parameter you request only events related to specific product identified by its ID.

  • :start_date (Time)

    Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.

  • :end_date (Time)

    Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.

Returns:



340
341
342
343
# 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(customer_id, opts = {}) ⇒ CustomersActivityListResponseBody

List Customer Activity Retrieve customer activities.

Parameters:

  • customer_id (String)

    A Voucherify customers id or source ID of the customer who performed the activities.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    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.

  • :order (ParameterOrderCreatedAt)

    Apply this filter to order the events according the date and time when it was created.

  • :starting_after_id (String)

    A cursor for pagination. It retrieves the events starting after an event with the given ID.

  • :start_date (Time)

    Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format.

  • :end_date (Time)

    Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.

  • :campaign_id (String)

    Requests only events related to specific campaign identified by its ID.

  • :campaign_type (ParameterCampaignType)

    Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM.

  • :category (ParameterActivityCategory)

    Filters activities for actions or effects. Allowed values: ACTION, EFFECT.

  • :type (String)

    Event name of the customer event.

Returns:



426
427
428
429
# 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_redeemables(customer_id, opts = {}) ⇒ CustomersRedeemablesListResponseBody

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)

Parameters:

  • customer_id (String)

    Unique identifier of a customer represented by an internal customer ID or customer source ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    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.

  • :order (ParameterOrderListRedeemables)

    Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.

  • :starting_after_id (String)

    A cursor for pagination. It retrieves the events starting after an event with the given ID.

  • :filters (ParameterFiltersListCustomerRedeemables)

    Filters for listing customer redeemables.

Returns:



507
508
509
510
# 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_segments(customer_id, opts = {}) ⇒ CustomersSegmentsListResponseBody

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.

Parameters:

  • customer_id (String)

    Unique identifier of a customer represented by an internal customer ID or customer source ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



574
575
576
577
# 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(opts = {}) ⇒ CustomersListResponseBody

List Customers Returns a list of customers.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    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.

  • :page (Integer)

    Which page of results to return. The lowest value is 1.

  • :email (String)

    Limit the customers to the ones that have this specific email address.

  • :city (String)

    Limit the customers to the ones that are located in the specified city.

  • :name (String)

    Filter customers by the name property.

  • :segment_id (String)

    Filter customers by the segment id.

  • :created_at_before (Time)

    Filter customers by date customer was created.

  • :created_at_after (Time)

    Filter customers by date customer was created.

  • :updated_at_before (Time)

    Filter customers by date customer was updated last time.

  • :updated_at_after (Time)

    Filter customers by date customer was updated last time.

  • :order (ParameterOrderListCustomers)

    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.

  • :starting_after (Time)

    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.

Returns:



644
645
646
647
# 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(customer_id, opts = {}) ⇒ CustomersUpdateResponseBody

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.

Parameters:

  • customer_id (String)

    A Voucherify customers id or source_id.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



727
728
729
730
# 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(opts = {}) ⇒ CustomersUpdateInBulkResponseBody

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.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



792
793
794
795
# 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(opts = {}) ⇒ CustomersMetadataUpdateInBulkResponseBody

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.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



856
857
858
859
# File 'lib/VoucherifySdk/api/customers_api.rb', line 856

def (opts = {})
  data, _status_code, _headers = (opts)
  data
end