Module: Drip::Client::Events

Included in:
Drip::Client
Defined in:
lib/drip/client/events.rb

Instance Method Summary collapse

Instance Method Details

#event_actions(options = {}) ⇒ Object

Public: Fetch all custom event actions.

options - Optional. A Hash of options

- page   - Optional. The page number. Defaults to 1
- per_page - Optional. The number of records to be returned
             on each page. Defaults to 100. Maximum 1000.

Returns a Drip::Response. See www.getdrip.com/docs/rest-api#events



45
46
47
# File 'lib/drip/client/events.rb', line 45

def event_actions(options = {})
  make_json_api_request :get, "v2/#{}/event_actions", options
end

#track_event(email, action, properties = {}, options = {}) ⇒ Object

Public: Track an event.

email - Required. The String email address of the subscriber. action - Required. The String event action. properties - Optional. A Hash of event properties. options - Optional. A Hash of additional options:

- prospect    - A Boolean indicating if the subscriber is a prospect.
- occurred_at - A String time at which the event occurred in ISO-8601 format.

Returns a Drip::Response. See www.getdrip.com/docs/rest-api#record_event



17
18
19
20
# File 'lib/drip/client/events.rb', line 17

def track_event(email, action, properties = {}, options = {})
  data = options.merge({ "email" => email, "action" => action, "properties" => properties })
  make_json_api_request :post, "v2/#{}/events", private_generate_resource("events", data)
end

#track_events(events) ⇒ Object

Public: Track a collection of events all at once.

events - Required. An Array of between 1 and 1000 Hashes of event data.

- email      - Required. The String email address of the subscriber.
- action     - Required. The String event action.
- properties - Optional. A Hash of event properties.

Returns a Drip::Response. See www.getdrip.com/docs/rest-api#event_batches



31
32
33
34
# File 'lib/drip/client/events.rb', line 31

def track_events(events)
  url = "v2/#{}/events/batches"
  make_json_api_request :post, url, private_generate_resource("batches", { "events" => events })
end