Class: Square::CustomerSegmentsApi
- Defined in:
- lib/square/api/customer_segments_api.rb
Overview
CustomerSegmentsApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#list_customer_segments(cursor: nil, limit: nil) ⇒ ApiResponse
Retrieves the list of customer segments of a business.
-
#retrieve_customer_segment(segment_id:) ⇒ ApiResponse
Retrieves a specific customer segment as identified by the ‘segment_id` value.
Methods inherited from BaseApi
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from Square::BaseApi
Instance Method Details
#list_customer_segments(cursor: nil, limit: nil) ⇒ ApiResponse
Retrieves the list of customer segments of a business. previous calls to ‘ListCustomerSegments`. This cursor is used to retrieve the next set of query results. For more information, see [Pagination](developer.squareup.com/docs/build-basics/common-api-p atterns/pagination). 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](developer.squareup.com/docs/build-basics/common-api-p atterns/pagination).
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/square/api/customer_segments_api.rb', line 18 def list_customer_segments(cursor: nil, limit: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/customers/segments', 'default') .query_param(new_parameter(cursor, key: 'cursor')) .query_param(new_parameter(limit, key: 'limit')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_customer_segment(segment_id:) ⇒ ApiResponse
Retrieves a specific customer segment as identified by the ‘segment_id` value. customer segment.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/square/api/customer_segments_api.rb', line 40 def retrieve_customer_segment(segment_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/customers/segments/{segment_id}', 'default') .template_param(new_parameter(segment_id, key: 'segment_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |