Class: Square::Customers::Segments::Client
- Inherits:
-
Object
- Object
- Square::Customers::Segments::Client
- Defined in:
- lib/square/customers/segments/client.rb
Instance Method Summary collapse
-
#get(request_options: {}, **params) ⇒ Square::Types::GetCustomerSegmentResponse
Retrieves a specific customer segment as identified by the ‘segment_id` value.
- #initialize(client:) ⇒ Square::Customers::Segments::Client constructor
-
#list(request_options: {}, **params) ⇒ Square::Types::ListCustomerSegmentsResponse
Retrieves the list of customer segments of a business.
Constructor Details
#initialize(client:) ⇒ Square::Customers::Segments::Client
8 9 10 |
# File 'lib/square/customers/segments/client.rb', line 8 def initialize(client:) @client = client end |
Instance Method Details
#get(request_options: {}, **params) ⇒ Square::Types::GetCustomerSegmentResponse
Retrieves a specific customer segment as identified by the ‘segment_id` value.
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/square/customers/segments/client.rb', line 37 def get(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "GET", path: "v2/customers/segments/#{params[:segment_id]}" ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::GetCustomerSegmentResponse.load(_response.body) end raise _response.body end |
#list(request_options: {}, **params) ⇒ Square::Types::ListCustomerSegmentsResponse
Retrieves the list of customer segments of a business.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/square/customers/segments/client.rb', line 15 def list(request_options: {}, **params) _query_param_names = %w[cursor limit] _query = params.slice(*_query_param_names) params.except(*_query_param_names) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "GET", path: "v2/customers/segments", query: _query ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::ListCustomerSegmentsResponse.load(_response.body) end raise _response.body end |