Class: PivotalShell::Cache::User
- Inherits:
-
Object
- Object
- PivotalShell::Cache::User
- Defined in:
- lib/pivotal_shell/cache/user.rb
Constant Summary collapse
- ATTRIBUTES =
%w(name id initials email)
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(source = {}) ⇒ User
constructor
A new instance of User.
- #to_s ⇒ Object
Constructor Details
#initialize(source = {}) ⇒ User
Returns a new instance of User.
9 10 11 12 13 14 15 |
# File 'lib/pivotal_shell/cache/user.rb', line 9 def initialize(source={}) if source.is_a? PivotalTracker::Membership raise 'TODO' elsif source.is_a? Hash create_from_hash(source) end end |
Class Method Details
.find(id) ⇒ Object
21 22 23 24 |
# File 'lib/pivotal_shell/cache/user.rb', line 21 def self.find(id) hash = PivotalShell::Configuration.cache.db.execute("SELECT * FROM users WHERE id=? OR initials=? OR name=? OR email=?", id, id, id, id).first hash && new(hash) end |
Instance Method Details
#to_s ⇒ Object
17 18 19 |
# File 'lib/pivotal_shell/cache/user.rb', line 17 def to_s name end |