Class: PortalModule::Client
- Inherits:
-
Object
- Object
- PortalModule::Client
- Defined in:
- lib/portal_module/client.rb
Instance Attribute Summary collapse
- #page_factory ⇒ Object
-
#password ⇒ Object
writeonly
Sets the attribute password.
-
#user ⇒ Object
writeonly
Override credentials.
Instance Method Summary collapse
- #dts ⇒ Object
- #env ⇒ Object
- #env=(environment) ⇒ Object
- #loan_entry ⇒ Object
-
#login(user = nil, pass = nil) ⇒ Object
Login to the portal.
-
#logout ⇒ Object
Logout of the portal.
-
#quit ⇒ Object
Logout of the portal and quit the browser.
Instance Attribute Details
#page_factory ⇒ Object
38 39 40 |
# File 'lib/portal_module/client.rb', line 38 def page_factory @page_factory ||= PortalModule::PageFactory.new end |
#password=(value) ⇒ Object (writeonly)
Sets the attribute password
18 19 20 |
# File 'lib/portal_module/client.rb', line 18 def password=(value) @password = value end |
#user=(value) ⇒ Object (writeonly)
Override credentials
17 18 19 |
# File 'lib/portal_module/client.rb', line 17 def user=(value) @user = value end |
Instance Method Details
#dts ⇒ Object
33 34 35 36 |
# File 'lib/portal_module/client.rb', line 33 def dts login Dts.new page_factory end |
#env ⇒ Object
24 25 26 |
# File 'lib/portal_module/client.rb', line 24 def env PortalModule.configuration.current_env end |
#env=(environment) ⇒ Object
20 21 22 |
# File 'lib/portal_module/client.rb', line 20 def env=(environment) PortalModule.configuration.current_env = environment end |
#loan_entry ⇒ Object
28 29 30 31 |
# File 'lib/portal_module/client.rb', line 28 def loan_entry login LoanEntry.new page_factory end |
#login(user = nil, pass = nil) ⇒ Object
Login to the portal
If no credentials are provided, try to get credentials from the config object.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/portal_module/client.rb', line 48 def login(user = nil, pass = nil) if @logged_in return true end user, pass = verify_credentials user, pass logout page_factory.login_page(true).login_as(user, pass) @logged_in = true end |
#logout ⇒ Object
Logout of the portal
64 65 66 67 |
# File 'lib/portal_module/client.rb', line 64 def logout page_factory.login_page(true).logout @logged_in = false end |
#quit ⇒ Object
Logout of the portal and quit the browser
73 74 75 76 |
# File 'lib/portal_module/client.rb', line 73 def quit logout page_factory.login_page(false).browser.close end |