Class: Freshworks::Event
- Inherits:
-
Base
- Object
- Base
- Freshworks::Event
show all
- Defined in:
- lib/freshworks/event.rb
Constant Summary
collapse
- BASE_URI =
'https://events-us.freshsuccess.com'
- VERSION_URI =
'/v1'
- REQUIRED_PARAMS =
%w{
account_id
user_id
created_at
session_id
}
Instance Attribute Summary
Attributes inherited from Base
#raw_response
Class Method Summary
collapse
-
.create(event, action, optional_fields = {}) ⇒ Object
-
.endpoint(*params) ⇒ Object
-
.endpoint_path ⇒ Object
-
.feature(event, feature, module_name, total) ⇒ Object
-
.identify_account(event, details) ⇒ Object
-
.identify_user(event, details) ⇒ Object
-
.module_end(event, module_name, time_spent) ⇒ Object
-
.session_sync(event, active_duration) ⇒ Object
Methods inherited from Base
#initialize, json_data, json_headers, request_helper, #to_json
#serialize, #to_h, #unserialize
Class Method Details
.create(event, action, optional_fields = {}) ⇒ Object
32
33
34
35
36
37
38
|
# 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) ⇒ Object
.feature(event, feature, module_name, total) ⇒ Object
28
29
30
|
# 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) ⇒ Object
16
17
18
|
# File 'lib/freshworks/event.rb', line 16
def self.identify_account(event, details)
create(event, 'identifyAccount', { details: details })
end
|
.identify_user(event, details) ⇒ Object
12
13
14
|
# 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) ⇒ Object
24
25
26
|
# 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) ⇒ Object
20
21
22
|
# File 'lib/freshworks/event.rb', line 20
def self.session_sync(event, active_duration)
create(event, 'sessionSync', { active_duration: active_duration })
end
|