Class: Minuteman::User
- Inherits:
-
Ohm::Model
- Object
- Ohm::Model
- Minuteman::User
- Defined in:
- lib/minuteman/user.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add(action, time = Time.now.utc) ⇒ Object
- #anonymous? ⇒ Boolean
- #count(action, time = Time.now.utc) ⇒ Object
- #promote(identifier) ⇒ Object
- #save ⇒ Object
- #track(action, time = Time.now.utc) ⇒ Object
Class Method Details
.[](identifier_or_uuid) ⇒ Object
43 44 45 |
# File 'lib/minuteman/user.rb', line 43 def self.[](identifier_or_uuid) with(:uid, identifier_or_uuid) || with(:identifier, identifier_or_uuid) end |
Instance Method Details
#add(action, time = Time.now.utc) ⇒ Object
25 26 27 |
# File 'lib/minuteman/user.rb', line 25 def add(action, time = Time.now.utc) Minuteman.add(action, time, self) end |
#anonymous? ⇒ Boolean
33 34 35 |
# File 'lib/minuteman/user.rb', line 33 def anonymous? self.anonymous == true end |
#count(action, time = Time.now.utc) ⇒ Object
29 30 31 |
# File 'lib/minuteman/user.rb', line 29 def count(action, time = Time.now.utc) Minuteman::Analyzer.new(action, Minuteman::Counter::User, self) end |
#promote(identifier) ⇒ Object
37 38 39 40 41 |
# File 'lib/minuteman/user.rb', line 37 def promote(identifier) self.identifier = identifier self.anonymous = false save end |
#save ⇒ Object
15 16 17 18 19 |
# File 'lib/minuteman/user.rb', line 15 def save self.uid ||= SecureRandom.uuid self.anonymous ||= !identifier super end |