Module: Insque
- Defined in:
- lib/devise_yauth_token/insque.rb
Class Method Summary collapse
- .yauth_account_create(msg) ⇒ Object
- .yauth_account_update(msg) ⇒ Object
- .yauth_user_create(msg) ⇒ Object
- .yauth_user_destroy(msg) ⇒ Object
- .yauth_user_sign_out(msg) ⇒ Object
- .yauth_user_update(msg) ⇒ Object
Class Method Details
.yauth_account_create(msg) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/devise_yauth_token/insque.rb', line 34 def self.yauth_account_create msg unless Account.where(:yauth_account_id => msg['params']['id']).exists? account = Account.new account.yauth_host = msg['params']['host'] account.code = msg['params']['code'] account.name = msg['params']['name'] account.yauth_account_id = msg['params']['id'] account.save! :validate => false end end |
.yauth_account_update(msg) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/devise_yauth_token/insque.rb', line 45 def self.yauth_account_update msg account = Account.where(:yauth_account_id => msg['params']['id']).first account.yauth_host = msg['params']['host'] account.code = msg['params']['code'] account.name = msg['params']['name'] account.save! :validate => false end |
.yauth_user_create(msg) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/devise_yauth_token/insque.rb', line 8 def self.yauth_user_create msg unless User.where(:yauth_user_id => msg['params']['id']).exists? user = User.new user.email = msg['params']['email'] user.omniauth_name = msg['params']['omniauth_name'] user.yauth_user_id = msg['params']['id'] user.yauth_account_id = msg['params']['account_id'] user.admin = msg['params']['admin'] user.account_id = Account.where(:yauth_account_id => user.yauth_account_id).first.id user.save! :validate => false end end |
.yauth_user_destroy(msg) ⇒ Object
29 30 31 32 |
# File 'lib/devise_yauth_token/insque.rb', line 29 def self.yauth_user_destroy msg user = User.where(:yauth_user_id => msg['params']['id']).first user.destroy end |
.yauth_user_sign_out(msg) ⇒ Object
2 3 4 5 6 |
# File 'lib/devise_yauth_token/insque.rb', line 2 def self.yauth_user_sign_out msg users = User.where(:yauth_user_id => msg['params']['id']) if msg['params']['id'] users = User.where(:yauth_account_id => msg['params']['account_id']) if msg['params']['account_id'] users.update_all :need_sign_out => true end |
.yauth_user_update(msg) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/devise_yauth_token/insque.rb', line 21 def self.yauth_user_update msg user = User.where(:yauth_user_id => msg['params']['id']).first user.email = msg['params']['email'] user.omniauth_name = msg['params']['omniauth_name'] user.admin = msg['params']['admin'] user.save! :validate => false end |