Class: UserObject
- Inherits:
-
Object
- Object
- UserObject
- Includes:
- DataFactory, DateFactory, Foundry, StringFactory, Workflows
- Defined in:
- lib/sambal-cle/data_objects/user.rb
Instance Attribute Summary collapse
-
#created_by ⇒ Object
Returns the value of attribute created_by.
-
#creation_date ⇒ Object
Returns the value of attribute creation_date.
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#full_name ⇒ Object
Returns the value of attribute full_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#internal_id ⇒ Object
Returns the value of attribute internal_id.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#ln_fn_id ⇒ Object
Returns the value of attribute ln_fn_id.
-
#long_name ⇒ Object
Returns the value of attribute long_name.
-
#modified_by ⇒ Object
Returns the value of attribute modified_by.
-
#modified_date ⇒ Object
Returns the value of attribute modified_date.
-
#password ⇒ Object
Returns the value of attribute password.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #create ⇒ Object
- #delete ⇒ Object
- #edit(opts = {}) ⇒ Object
- #exist? ⇒ Boolean
-
#initialize(browser, opts = {}) ⇒ UserObject
constructor
A new instance of UserObject.
- #log_in ⇒ Object (also: #login)
- #log_out ⇒ Object
- #logged_in? ⇒ Boolean
- #view ⇒ Object
Methods included from Workflows
menu_link, #open_my_site_by_name, #reset
Constructor Details
#initialize(browser, opts = {}) ⇒ UserObject
Returns a new instance of UserObject.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sambal-cle/data_objects/user.rb', line 13 def initialize(browser, opts={}) @browser = browser defaults = { :id=>random_alphanums, :first_name=>random_alphanums, :last_name=>random_alphanums, :email=>random_email, :type=>"Student", :password=>random_alphanums, } = defaults.merge(opts) () @full_name="#{@first_name} #{last_name}" @long_name="#{@first_name} #{last_name} (#{@id})" @ln_fn_id="#{@last_name}, #{@first_name} (#{@id})" end |
Instance Attribute Details
#created_by ⇒ Object
Returns the value of attribute created_by.
9 10 11 |
# File 'lib/sambal-cle/data_objects/user.rb', line 9 def created_by @created_by end |
#creation_date ⇒ Object
Returns the value of attribute creation_date.
9 10 11 |
# File 'lib/sambal-cle/data_objects/user.rb', line 9 def creation_date @creation_date end |
#email ⇒ Object
Returns the value of attribute email.
9 10 11 |
# File 'lib/sambal-cle/data_objects/user.rb', line 9 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
9 10 11 |
# File 'lib/sambal-cle/data_objects/user.rb', line 9 def first_name @first_name end |
#full_name ⇒ Object
Returns the value of attribute full_name.
9 10 11 |
# File 'lib/sambal-cle/data_objects/user.rb', line 9 def full_name @full_name end |
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/sambal-cle/data_objects/user.rb', line 9 def id @id end |
#internal_id ⇒ Object
Returns the value of attribute internal_id.
9 10 11 |
# File 'lib/sambal-cle/data_objects/user.rb', line 9 def internal_id @internal_id end |
#last_name ⇒ Object
Returns the value of attribute last_name.
9 10 11 |
# File 'lib/sambal-cle/data_objects/user.rb', line 9 def last_name @last_name end |
#ln_fn_id ⇒ Object
Returns the value of attribute ln_fn_id.
9 10 11 |
# File 'lib/sambal-cle/data_objects/user.rb', line 9 def ln_fn_id @ln_fn_id end |
#long_name ⇒ Object
Returns the value of attribute long_name.
9 10 11 |
# File 'lib/sambal-cle/data_objects/user.rb', line 9 def long_name @long_name end |
#modified_by ⇒ Object
Returns the value of attribute modified_by.
9 10 11 |
# File 'lib/sambal-cle/data_objects/user.rb', line 9 def modified_by @modified_by end |
#modified_date ⇒ Object
Returns the value of attribute modified_date.
9 10 11 |
# File 'lib/sambal-cle/data_objects/user.rb', line 9 def modified_date @modified_date end |
#password ⇒ Object
Returns the value of attribute password.
9 10 11 |
# File 'lib/sambal-cle/data_objects/user.rb', line 9 def password @password end |
#type ⇒ Object
Returns the value of attribute type.
9 10 11 |
# File 'lib/sambal-cle/data_objects/user.rb', line 9 def type @type end |
Instance Method Details
#create ⇒ Object
31 32 33 |
# File 'lib/sambal-cle/data_objects/user.rb', line 31 def create # TODO end |
#delete ⇒ Object
43 44 45 |
# File 'lib/sambal-cle/data_objects/user.rb', line 43 def delete # TODO end |
#edit(opts = {}) ⇒ Object
35 36 37 |
# File 'lib/sambal-cle/data_objects/user.rb', line 35 def edit opts={} # TODO end |
#exist? ⇒ Boolean
47 48 49 |
# File 'lib/sambal-cle/data_objects/user.rb', line 47 def exist? # TODO end |
#log_in ⇒ Object Also known as: login
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/sambal-cle/data_objects/user.rb', line 51 def log_in if logged_in? # do nothing else # see if we're on the login screen if @browser.frame(:id, "ifrm").text_field(:id, "eid").present? userlogin else # Log the current user out, then log in log_out userlogin end end end |
#log_out ⇒ Object
74 75 76 |
# File 'lib/sambal-cle/data_objects/user.rb', line 74 def log_out @browser.link(:text=>"Logout").click end |
#logged_in? ⇒ Boolean
65 66 67 68 69 70 71 72 |
# File 'lib/sambal-cle/data_objects/user.rb', line 65 def logged_in? welcome=@browser.span(:class=>"welcome") if welcome.present? welcome.text=~/#{@first_name}/ ? true : false else return false end end |
#view ⇒ Object
39 40 41 |
# File 'lib/sambal-cle/data_objects/user.rb', line 39 def view # TODO end |