Class: WinewooCore::Repositories::Mongo::WinewooUsersMongoRepo

Inherits:
Object
  • Object
show all
Defined in:
lib/winewoo_core/repositories/mongo/winewoo_users_mongo_repo.rb

Constant Summary collapse

SOCIAL_NETWORKS =
[:facebook_id, :twitter_id, :google_id, :linkedin_id]

Instance Method Summary collapse

Instance Method Details

#create(params) ⇒ Object



12
13
14
15
16
# File 'lib/winewoo_core/repositories/mongo/winewoo_users_mongo_repo.rb', line 12

def create(params)
  wuser = user_with_social_network_or_params(params)
  WinewooUserDevicesMongoRepo.new.create(wuser, params) if wuser.persisted?
  return wuser
end

#get(wuser_id) ⇒ Object



7
8
9
# File 'lib/winewoo_core/repositories/mongo/winewoo_users_mongo_repo.rb', line 7

def get(wuser_id)
  User.find(wuser_id)
end

#update(wuser_id, params) ⇒ Object



19
20
21
22
23
24
# File 'lib/winewoo_core/repositories/mongo/winewoo_users_mongo_repo.rb', line 19

def update(wuser_id, params)
  wuser = self.get(wuser_id)
  return unless wuser
  wuser.update_attributes(params.get)
  return wuser
end