preact 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/preact.rb +5 -5
- data/lib/preact/version.rb +2 -2
- data/readme.md +6 -4
- metadata +1 -1
data/lib/preact.rb
CHANGED
@@ -27,7 +27,7 @@ module Preact
|
|
27
27
|
yield(configuration) if block_given?
|
28
28
|
|
29
29
|
# Configure logger. Default to use Rails
|
30
|
-
self.logger
|
30
|
+
self.logger ||= configuration.logger || (defined?(Rails) ? Rails.logger : Logger.new(STDOUT))
|
31
31
|
|
32
32
|
raise StandardError.new "Must specify project code and secret when configuring the Preact api client" unless configuration.valid?
|
33
33
|
|
@@ -49,14 +49,12 @@ module Preact
|
|
49
49
|
logger.error "[Preact] No event specified, not logging event"
|
50
50
|
return nil
|
51
51
|
end
|
52
|
-
|
53
|
-
person = configuration.convert_to_person(user).as_json
|
54
52
|
|
55
53
|
if event.is_a?(String)
|
56
54
|
preact_event = ActionEvent.new({
|
57
55
|
:name => event,
|
58
56
|
:timestamp => Time.now.to_f
|
59
|
-
})
|
57
|
+
})
|
60
58
|
elsif event.is_a?(Hash)
|
61
59
|
preact_event = ActionEvent.new(event)
|
62
60
|
elsif !event.is_a?(ActionEvent)
|
@@ -67,8 +65,10 @@ module Preact
|
|
67
65
|
# attach the account info to the event
|
68
66
|
preact_event.account = configuration.convert_to_account(account).as_json
|
69
67
|
end
|
68
|
+
|
69
|
+
person = configuration.convert_to_person(user)
|
70
70
|
|
71
|
-
send_log(person, preact_event)
|
71
|
+
send_log(person.as_json, preact_event.as_json)
|
72
72
|
end
|
73
73
|
|
74
74
|
def update_person(user)
|
data/lib/preact/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Preact
|
2
|
-
VERSION = "0.6.
|
3
|
-
end
|
2
|
+
VERSION = "0.6.2"
|
3
|
+
end
|
data/readme.md
CHANGED
@@ -50,7 +50,8 @@ person = {
|
|
50
50
|
:email => "gooley@foliohd.com",
|
51
51
|
:uid => "gooley",
|
52
52
|
:properties => {
|
53
|
-
:
|
53
|
+
:subscription_level => 4,
|
54
|
+
:subscription_level_name => "Pro",
|
54
55
|
:is_paying => true,
|
55
56
|
:created_at => 1347060566
|
56
57
|
:twitter => "gooley"
|
@@ -68,6 +69,7 @@ Preact.log_event(person, {
|
|
68
69
|
:note => "black shoes",
|
69
70
|
:revenue => 2500,
|
70
71
|
:extras => {
|
72
|
+
:category => "shoes",
|
71
73
|
:size => "13",
|
72
74
|
:color => "blue"
|
73
75
|
})
|
@@ -125,8 +127,8 @@ end
|
|
125
127
|
Then, you just pass that model to the log_event method and we will associate the user's action with that account.
|
126
128
|
|
127
129
|
```ruby
|
128
|
-
Preact.log_event(@current_user, 'restored_answer_data', @
|
129
|
-
Preact.log_event(@current_user, { :name => 'updated-profile', :extras => {:twitter => "@gooley"} }, @
|
130
|
+
Preact.log_event(@current_user, 'restored_answer_data', @current_project)
|
131
|
+
Preact.log_event(@current_user, { :name => 'updated-profile', :extras => {:twitter => "@gooley"} }, @current_project)
|
130
132
|
```
|
131
133
|
|
132
134
|
Sidekiq Integration
|
@@ -150,6 +152,6 @@ end
|
|
150
152
|
```
|
151
153
|
|
152
154
|
|
153
|
-
Copyright (c) 2011-2013 Christopher Gooley, Preact. See LICENSE.txt for further details.
|
155
|
+
Copyright (c) 2011-2013 Christopher Gooley, Preact / Less Neglect, Inc. See LICENSE.txt for further details.
|
154
156
|
|
155
157
|
Thanks to [Zach Millman](https://github.com/zmillman) for many contributions.
|