class Freshworks::Event

Constants

BASE_URI
REQUIRED_PARAMS
VERSION_URI

Public Class Methods

create(event, action, optional_fields={}) click to toggle source
# File lib/freshworks/event.rb, line 32
def self.create(event, action, optional_fields={})
  body = event.to_h
  body.merge!({ action: action })
  body.merge!(optional_fields)

  post([], json_data(body))
end
endpoint(*params) click to toggle source
# File lib/freshworks/event.rb, line 44
def self.endpoint(*params)
  params = [endpoint_path, params].flatten.compact.map(&:to_s)
  Freshworks.full_endpoint_uri(BASE_URI, VERSION_URI, params)
end
endpoint_path() click to toggle source
# File lib/freshworks/event.rb, line 40
def self.endpoint_path
  [Freshworks.configuration.event_auth_key, Freshworks.configuration.event_api_key]
end
feature(event, feature, module_name, total) click to toggle source
# File lib/freshworks/event.rb, line 28
def self.feature(event, feature, module_name, total)
  create(event, 'feature', { feature: feature, module: module_name, total: total })
end
identify_account(event, details) click to toggle source
# File lib/freshworks/event.rb, line 16
def self.identify_account(event, details)
  create(event, 'identifyAccount', { details: details })
end
identify_user(event, details) click to toggle source
# File lib/freshworks/event.rb, line 12
def self.identify_user(event, details)
  create(event, 'identifyUser', { details: details })
end
module_end(event, module_name, time_spent) click to toggle source
# File lib/freshworks/event.rb, line 24
def self.module_end(event, module_name, time_spent)
  create(event, 'moduleEnd', { module: module_name, time_spent: time_spent })
end
session_sync(event, active_duration) click to toggle source
# File lib/freshworks/event.rb, line 20
def self.session_sync(event, active_duration)
  create(event, 'sessionSync', { active_duration: active_duration })
end