Method: Orchestrate::Client#list_events

Defined in:
lib/orchestrate/client.rb

#list_events(collection, key, event_type, options = {}) ⇒ Object

Lists events associated with a key. Results are time-ordered in reverse-chronological order, and paginated.

Parameters:

  • collection (#to_s)

    The name of the collection.

  • key (#to_s)

    The name of the key.

  • event_type (#to_s)

    The category for the event.

  • options (Hash) (defaults to: {})

    The parameters for the query.

Options Hash (options):

  • :limit (Integer) — default: 10

    The number of results to return. Default 100.

  • :start (Date, Time, String, Integer)

    The inclusive start of the range.

  • :after (Date, Time, String, Integer)

    The exclusive start of the range.

  • :before (Date, Time, String, Integer)

    The exclusive end of the range.

  • :end (Date, Time, String, Integer)

    The inclusive end of the range.

Returns:

  • Orchestrate::API::CollectionResponse

Raises:

  • Orchestrate::API::NotFound If the provided collection/key doesn't exist.

[View source]

349
350
351
352
353
354
355
356
# File 'lib/orchestrate/client.rb', line 349

def list_events(collection, key, event_type, options={})
  (options.keys & [:start, :after, :before, :end]).each do |param|
    options[param] = API::Helpers.timestamp(options[param])
  end
  API::Helpers.range_keys!('event', options)
  path = [collection, key, 'events', event_type]
  send_request :get, path, { query: options, response: API::CollectionResponse }
end