Skip to content

Commit 2054ccf

Browse files
committed
Merge pull request #6 from mathildemouw/master
Solution to timestamp default issue
2 parents 0eb41f6 + 1886f48 commit 2054ccf

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ build/
1919
/_yardoc/
2020
/doc/
2121
/rdoc/
22+
.idea/
23+
/lib/.idea/
2224

2325
## Environment normalisation:
2426
/.bundle/

lib/outbound.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def Outbound.identify(user_id, info={})
4343
return @ob.identify(user_id, info)
4444
end
4545

46-
def Outbound.track(user_id, event, properties={}, timestamp=nil)
46+
def Outbound.track(user_id, event, properties={}, timestamp=Time.now.to_i)
4747
if @ob == nil
4848
res = Result.new Outbound::ERROR_INIT, false
4949
@logger.error res.error
@@ -136,7 +136,7 @@ def identify(user_id, info={})
136136
return post(@api_key, '/identify', user_data)
137137
end
138138

139-
def track(user_id, event, properties={}, user_info={}, timestamp)
139+
def track(user_id, event, properties={}, user_info={}, timestamp=Time.now.to_i)
140140
unless user_id.is_a? String or user_id.is_a? Numeric
141141
res = Result.new Outbound::ERROR_USER_ID, false
142142
@logger.error res.error
@@ -159,11 +159,8 @@ def track(user_id, event, properties={}, user_info={}, timestamp)
159159
@logger.error "Could not use event properties (#{properties}) given to track call."
160160
end
161161

162-
unless timestamp == nil
163-
data[:timestamp] = timestamp
164-
else
165-
data[:timestamp] = Time.now.to_i
166-
end
162+
data[:timestamp] = timestamp
163+
puts timestamp
167164

168165
return post(@api_key, '/track', data)
169166
end

0 commit comments

Comments
 (0)