Class: SimpleSpark::Endpoints::Events

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_spark/endpoints/events.rb

Overview

Provides access to the /message-events endpoint

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Events

Returns a new instance of Events.



8
9
10
# File 'lib/simple_spark/endpoints/events.rb', line 8

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



6
7
8
# File 'lib/simple_spark/endpoints/events.rb', line 6

def client
  @client
end

Instance Method Details

#samples(events = nil) ⇒ Array

Parameters:

  • events (String) (defaults to: nil)

    Event types for which to get a sample payload, use the Webhooks Events endpoint to list the available event types, defaults to all event types

Returns:

  • (Array)

    a list of sample Event hash objects



17
18
19
20
# File 'lib/simple_spark/endpoints/events.rb', line 17

def samples(events = nil)
  query_params = events.nil? ? {} : { events: events }
  @client.call(method: :get, path: 'events/message/samples', query_values: query_params)
end

#search(params = {}) ⇒ Array

Perform a filtered search for message event data. The response is sorted by descending timestamp.

Parameters:

  • params (String) (defaults to: {})

    Params to use in the search

Returns:

  • (Array)

    a list of Event hash objects



26
27
28
# File 'lib/simple_spark/endpoints/events.rb', line 26

def search(params = {})
  @client.call(method: :get, path: 'events/message', query_values: params)
end