Class: Hubspot::CustomEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot/custom_event.rb

Overview

HubSpot Custom Behavioral Events HTTP API

https://developers.hubspot.com/docs/api/analytics/events

Constant Summary collapse

POST_EVENT_PATH =
'/events/v3/send'

Class Method Summary collapse

Class Method Details

.trigger(event_name, email, properties, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/hubspot/custom_event.rb', line 13

def trigger(event_name, email, properties, options = {})
  options[:params] ||= {}
  options[:body] ||= {}
  options[:body].merge!(
    eventName: "#{Hubspot::Config.custom_event_prefix}_#{event_name}",
    email: email,
    properties: properties
  )
  Hubspot::CustomEventConnection.trigger(POST_EVENT_PATH, options).success?
end