Skip to content

Latest commit

 

History

History
82 lines (52 loc) · 2.51 KB

customer-segments.md

File metadata and controls

82 lines (52 loc) · 2.51 KB

Customer Segments

customer_segments_api = client.customer_segments

Class Name

CustomerSegmentsApi

Methods

List Customer Segments

Retrieves the list of customer segments of a business.

def list_customer_segments(cursor: nil,
                           limit: nil)

Parameters

Parameter Type Tags Description
cursor String Query, Optional A pagination cursor returned by previous calls to ListCustomerSegments.
This cursor is used to retrieve the next set of query results.

For more information, see Pagination.
limit Integer Query, Optional The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
If the specified limit is less than 1 or greater than 50, Square returns a 400 VALUE_TOO_LOW or 400 VALUE_TOO_HIGH error. The default value is 50.

For more information, see Pagination.

Response Type

This method returns a ApiResponse instance. The data property in this instance returns the response data which is of type List Customer Segments Response Hash.

Example Usage

result = customer_segments_api.list_customer_segments

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

Retrieve Customer Segment

Retrieves a specific customer segment as identified by the segment_id value.

def retrieve_customer_segment(segment_id:)

Parameters

Parameter Type Tags Description
segment_id String Template, Required The Square-issued ID of the customer segment.

Response Type

This method returns a ApiResponse instance. The data property in this instance returns the response data which is of type Retrieve Customer Segment Response Hash.

Example Usage

segment_id = 'segment_id4'


result = customer_segments_api.retrieve_customer_segment(segment_id: segment_id)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end