Class: Anypost::Resources::Events
- Defined in:
- lib/anypost/resources/events.rb
Overview
Read access to the /events stream. List-only — events are not addressable by id.
Instance Method Summary collapse
-
#list(params = {}) ⇒ Object
Page through the team's events, newest-first.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Anypost::Resources::Base
Instance Method Details
#list(params = {}) ⇒ Object
Page through the team's events, newest-first.
The window defaults to the last 24 hours and is clamped to the plan's
retention. Filter with start, end, event_type, recipient,
email_id, message_id, domain, topic, campaign, template_id,
ip_pool, and tags (an array, matched with hasAny).
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/anypost/resources/events.rb', line 13 def list(params = {}) = params[:tags] paginate("/events", { limit: params[:limit], after: params[:after], start: params[:start], end: params[:end], event_type: params[:event_type], recipient: params[:recipient], email_id: params[:email_id], message_id: params[:message_id], domain: params[:domain], topic: params[:topic], campaign: params[:campaign], template_id: params[:template_id], # Exact match against the [a-z0-9]([a-z0-9-]*[a-z0-9])? pool-name # shape. A value outside it returns an empty list rather than being # ignored, so a typo cannot silently widen the answer to "all pools". ip_pool: params[:ip_pool], # Sent comma-separated (tags=a,b); the API matches with hasAny. tags: (.is_a?(Array) && !.empty?) ? .join(",") : nil }) end |