34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/random_user.rb', line 34
def self.create_from_hash(hash)
user = RandomUser.new
user.name = hash['name']
user.email = hash['email']
user.gender = hash['gender']
user.username = hash['username']
user.password = hash['password']
user.salt = hash['salt']
user.md5 = hash['md5']
user.sha1 = hash['sha1']
user.sha256 = hash['sha256']
user.dob = Time.at(hash['dob'].to_i) if hash['dob']
user.phone = hash['phone']
user.cell = hash['cell']
user.nationality = hash['nationality']
user.location = hash['location']
user.registered = Time.at(hash['registered'].to_i) if hash['registered']
user.picture = hash['picture']
return user if user.valid?
end
|