Class: RandomUser
- Inherits:
-
Object
- Object
- RandomUser
- Defined in:
- lib/random_user.rb
Instance Attribute Summary collapse
-
#cell ⇒ Object
Returns the value of attribute cell.
-
#DNI ⇒ Object
Returns the value of attribute DNI.
-
#dob ⇒ Object
Returns the value of attribute dob.
-
#email ⇒ Object
Returns the value of attribute email.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#location ⇒ Object
Returns the value of attribute location.
-
#md5 ⇒ Object
Returns the value of attribute md5.
-
#name ⇒ Object
Returns the value of attribute name.
-
#nationality ⇒ Object
Returns the value of attribute nationality.
-
#password ⇒ Object
Returns the value of attribute password.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#picture ⇒ Object
Returns the value of attribute picture.
-
#registered ⇒ Object
Returns the value of attribute registered.
-
#salt ⇒ Object
Returns the value of attribute salt.
-
#sha1 ⇒ Object
Returns the value of attribute sha1.
-
#sha256 ⇒ Object
Returns the value of attribute sha256.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#cell ⇒ Object
Returns the value of attribute cell.
3 4 5 |
# File 'lib/random_user.rb', line 3 def cell @cell end |
#DNI ⇒ Object
Returns the value of attribute DNI.
3 4 5 |
# File 'lib/random_user.rb', line 3 def DNI @DNI end |
#dob ⇒ Object
Returns the value of attribute dob.
3 4 5 |
# File 'lib/random_user.rb', line 3 def dob @dob end |
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/random_user.rb', line 3 def email @email end |
#gender ⇒ Object
Returns the value of attribute gender.
3 4 5 |
# File 'lib/random_user.rb', line 3 def gender @gender end |
#location ⇒ Object
Returns the value of attribute location.
3 4 5 |
# File 'lib/random_user.rb', line 3 def location @location end |
#md5 ⇒ Object
Returns the value of attribute md5.
3 4 5 |
# File 'lib/random_user.rb', line 3 def md5 @md5 end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/random_user.rb', line 3 def name @name end |
#nationality ⇒ Object
Returns the value of attribute nationality.
3 4 5 |
# File 'lib/random_user.rb', line 3 def nationality @nationality end |
#password ⇒ Object
Returns the value of attribute password.
3 4 5 |
# File 'lib/random_user.rb', line 3 def password @password end |
#phone ⇒ Object
Returns the value of attribute phone.
3 4 5 |
# File 'lib/random_user.rb', line 3 def phone @phone end |
#picture ⇒ Object
Returns the value of attribute picture.
3 4 5 |
# File 'lib/random_user.rb', line 3 def picture @picture end |
#registered ⇒ Object
Returns the value of attribute registered.
3 4 5 |
# File 'lib/random_user.rb', line 3 def registered @registered end |
#salt ⇒ Object
Returns the value of attribute salt.
3 4 5 |
# File 'lib/random_user.rb', line 3 def salt @salt end |
#sha1 ⇒ Object
Returns the value of attribute sha1.
3 4 5 |
# File 'lib/random_user.rb', line 3 def sha1 @sha1 end |
#sha256 ⇒ Object
Returns the value of attribute sha256.
3 4 5 |
# File 'lib/random_user.rb', line 3 def sha256 @sha256 end |
#username ⇒ Object
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_name ⇒ Object
12 13 14 |
# File 'lib/random_user.rb', line 12 def first_name name[""] end |
#new ⇒ Object
5 6 |
# File 'lib/random_user.rb', line 5 def new end |
#valid? ⇒ Boolean
8 9 10 |
# File 'lib/random_user.rb', line 8 def valid? self.email end |