Class: Storyberg
- Inherits:
-
Object
- Object
- Storyberg
- Defined in:
- lib/storyberg.rb
Class Method Summary collapse
- .api_key ⇒ Object
- .identify(user_id, user_attributes = {}) ⇒ Object
- .init(key, host = nil) ⇒ Object
- .record(user_id, user_attributes = {}) ⇒ Object
Class Method Details
.api_key ⇒ Object
8 9 10 |
# File 'lib/storyberg.rb', line 8 def self.api_key @key end |
.identify(user_id, user_attributes = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/storyberg.rb', line 12 def self.identify(user_id, user_attributes = {}) return false unless self.is_initialized? field_values = hash_keys_to_str user_attributes field_values.update('api_key' => @key) field_values.update('user_id' => user_id) self.request 'project_users/identify', field_values end |
.init(key, host = nil) ⇒ Object
22 23 24 25 |
# File 'lib/storyberg.rb', line 22 def self.init(key, host = nil) @key = key @host = host unless host == nil end |
.record(user_id, user_attributes = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/storyberg.rb', line 27 def self.record(user_id, user_attributes = {}) return false unless self.is_initialized? field_values = hash_keys_to_str user_attributes field_values.update('api_key' => @key) field_values.update('user_id' => user_id) self.identify user_id, user_attributes self.request 'project_user_events/record', field_values end |