Sha256: 1063a9b6e89ff5b994c36a22815c3c0effd520be826bc2fddf54b66a35763f77

Contents?: true

Size: 650 Bytes

Versions: 12

Compression:

Stored size: 650 Bytes

Contents

require 'hubspot/utils'

module Hubspot
  #
  # HubSpot Custom Behavioral Events HTTP API
  #
  # {https://developers.hubspot.com/docs/api/analytics/events}
  #
  class CustomEvent
    POST_EVENT_PATH = '/events/v3/send'

    class << self
      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
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hubspot-api-ruby-0.19.0 lib/hubspot/custom_event.rb
hubspot-api-ruby-0.18.0 lib/hubspot/custom_event.rb
hubspot-api-ruby-0.17.1 lib/hubspot/custom_event.rb
hubspot-api-ruby-0.17.0 lib/hubspot/custom_event.rb
hubspot-api-ruby-0.16.0 lib/hubspot/custom_event.rb
hubspot-api-ruby-0.15.0 lib/hubspot/custom_event.rb
hubspot-api-ruby-0.14.0 lib/hubspot/custom_event.rb
hubspot-api-ruby-0.13.0 lib/hubspot/custom_event.rb
hubspot-api-ruby-0.12.0 lib/hubspot/custom_event.rb
hubspot-api-ruby-0.11.0 lib/hubspot/custom_event.rb
hubspot-api-ruby-0.10.0 lib/hubspot/custom_event.rb
hubspot-api-ruby-0.9.0 lib/hubspot/custom_event.rb