Class: Square::Loyalty::Client
- Inherits:
-
Object
- Object
- Square::Loyalty::Client
- Defined in:
- lib/square/loyalty/client.rb
Instance Method Summary collapse
- #accounts ⇒ Square::Accounts::Client
- #initialize(client:) ⇒ Square::Loyalty::Client constructor
- #programs ⇒ Square::Programs::Client
- #rewards ⇒ Square::Rewards::Client
-
#search_events(request_options: {}, **params) ⇒ Square::Types::SearchLoyaltyEventsResponse
Searches for loyalty events.
Constructor Details
#initialize(client:) ⇒ Square::Loyalty::Client
7 8 9 |
# File 'lib/square/loyalty/client.rb', line 7 def initialize(client:) @client = client end |
Instance Method Details
#accounts ⇒ Square::Accounts::Client
37 38 39 |
# File 'lib/square/loyalty/client.rb', line 37 def accounts @accounts ||= Square::Loyalty::Accounts::Client.new(client: @client) end |
#programs ⇒ Square::Programs::Client
42 43 44 |
# File 'lib/square/loyalty/client.rb', line 42 def programs @programs ||= Square::Loyalty::Programs::Client.new(client: @client) end |
#rewards ⇒ Square::Rewards::Client
47 48 49 |
# File 'lib/square/loyalty/client.rb', line 47 def rewards @rewards ||= Square::Loyalty::Rewards::Client.new(client: @client) end |
#search_events(request_options: {}, **params) ⇒ Square::Types::SearchLoyaltyEventsResponse
Searches for loyalty events.
A Square loyalty program maintains a ledger of events that occur during the lifetime of a buyer’s loyalty account. Each change in the point balance (for example, points earned, points redeemed, and points expired) is recorded in the ledger. Using this endpoint, you can search the ledger for events.
Search results are sorted by ‘created_at` in descending order.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/square/loyalty/client.rb', line 21 def search_events(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "POST", path: "v2/loyalty/events/search", body: params ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::SearchLoyaltyEventsResponse.load(_response.body) end raise _response.body end |