Class: RandomUser

Inherits:
Object
  • Object
show all
Defined in:
lib/random_user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cellObject

Returns the value of attribute cell.



3
4
5
# File 'lib/random_user.rb', line 3

def cell
  @cell
end

#DNIObject

Returns the value of attribute DNI.



3
4
5
# File 'lib/random_user.rb', line 3

def DNI
  @DNI
end

#dobObject

Returns the value of attribute dob.



3
4
5
# File 'lib/random_user.rb', line 3

def dob
  @dob
end

#emailObject

Returns the value of attribute email.



3
4
5
# File 'lib/random_user.rb', line 3

def email
  @email
end

#genderObject

Returns the value of attribute gender.



3
4
5
# File 'lib/random_user.rb', line 3

def gender
  @gender
end

#locationObject

Returns the value of attribute location.



3
4
5
# File 'lib/random_user.rb', line 3

def location
  @location
end

#md5Object

Returns the value of attribute md5.



3
4
5
# File 'lib/random_user.rb', line 3

def md5
  @md5
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/random_user.rb', line 3

def name
  @name
end

#nationalityObject

Returns the value of attribute nationality.



3
4
5
# File 'lib/random_user.rb', line 3

def nationality
  @nationality
end

#passwordObject

Returns the value of attribute password.



3
4
5
# File 'lib/random_user.rb', line 3

def password
  @password
end

#phoneObject

Returns the value of attribute phone.



3
4
5
# File 'lib/random_user.rb', line 3

def phone
  @phone
end

#pictureObject

Returns the value of attribute picture.



3
4
5
# File 'lib/random_user.rb', line 3

def picture
  @picture
end

#registeredObject

Returns the value of attribute registered.



3
4
5
# File 'lib/random_user.rb', line 3

def registered
  @registered
end

#saltObject

Returns the value of attribute salt.



3
4
5
# File 'lib/random_user.rb', line 3

def salt
  @salt
end

#sha1Object

Returns the value of attribute sha1.



3
4
5
# File 'lib/random_user.rb', line 3

def sha1
  @sha1
end

#sha256Object

Returns the value of attribute sha256.



3
4
5
# File 'lib/random_user.rb', line 3

def sha256
  @sha256
end

#usernameObject

Returns the value of attribute username.



3
4
5
# File 'lib/random_user.rb', line 3

def username
  @username
end

Class Method Details

.create_from_hash(hash) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/random_user.rb', line 16

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.registered =   Time.at(hash['registered'].to_i) if hash['registered']
  user.picture =      hash['picture']
  return user if user.valid?
end

Instance Method Details

#first_nameObject



12
13
14
# File 'lib/random_user.rb', line 12

def first_name
  name[""]
end

#newObject



5
6
# File 'lib/random_user.rb', line 5

def new
end

#valid?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/random_user.rb', line 8

def valid?
  self.email
end