Class: LraClient::User

Inherits:
ApplicationRecord show all
Defined in:
app/models/lra_client/user.rb

Class Method Summary collapse

Class Method Details

.create_or_update_from_loft(params) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'app/models/lra_client/user.rb', line 3

def self.create_or_update_from_loft(params)
  user = User.find_by(loft_id: params['id'])
  user = User.new if user.nil?
  user.loft_id = params['id']
  user.name    = params['name']
  user.avatar  = params['avatar']
  user.email   = params['email']
  user.save!
  user
end