class PortalModule::Client
Attributes
page_factory[W]
password[W]
user[W]
Override credentials
Public Instance Methods
dts()
click to toggle source
# File lib/portal_module/client.rb, line 33 def dts login Dts.new page_factory end
env()
click to toggle source
# File lib/portal_module/client.rb, line 24 def env PortalModule.configuration.current_env end
env=(environment)
click to toggle source
# File lib/portal_module/client.rb, line 20 def env=(environment) PortalModule.configuration.current_env = environment end
loan_entry()
click to toggle source
# File lib/portal_module/client.rb, line 28 def loan_entry login LoanEntry.new page_factory end
login(user = nil, pass = nil)
click to toggle source
Login to the portal
If no credentials are provided, try to get credentials from the config object.
# 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()
click to toggle source
Logout of the portal
# File lib/portal_module/client.rb, line 64 def logout page_factory.login_page(true).logout @logged_in = false end
page_factory()
click to toggle source
# File lib/portal_module/client.rb, line 38 def page_factory @page_factory ||= PortalModule::PageFactory.new end
quit()
click to toggle source
Logout of the portal and quit the browser
# File lib/portal_module/client.rb, line 73 def quit logout page_factory.login_page(false).browser.close end
Private Instance Methods
valid_user_and_pass?(user, pass)
click to toggle source
# File lib/portal_module/client.rb, line 98 def valid_user_and_pass? user, pass if user.nil? || user.empty? return false end if pass.nil? || pass.empty? return false end true end
verify_credentials(user, pass)
click to toggle source
If credential args are empty, attempt to look them up,
first in the client attributes, then in the config obj.
# File lib/portal_module/client.rb, line 84 def verify_credentials user, pass return [user, pass] if valid_user_and_pass? user, pass # Pull values stored in this client. user, pass = @user, @password return [user, pass] if valid_user_and_pass? user, pass # Pull values stored in the config. user, pass = PortalModule.configuration.user_credentials return [user, pass] if valid_user_and_pass? user, pass fail AuthenticationRequired.new("Missing credentials for #{env}") end