Class: PortalModule::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#page_factoryObject



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

Parameters:

  • value

    the value to set the attribute password to.



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

#dtsObject



33
34
35
36
# File 'lib/portal_module/client.rb', line 33

def dts
  
  Dts.new page_factory
end

#envObject



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_entryObject



28
29
30
31
# File 'lib/portal_module/client.rb', line 28

def loan_entry
  
  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 (user = nil, pass = nil)
  if @logged_in
    return true
  end

  user, pass = verify_credentials user, pass

  logout
  page_factory.(true).(user, pass)
  @logged_in = true
end

#logoutObject

Logout of the portal



64
65
66
67
# File 'lib/portal_module/client.rb', line 64

def logout
  page_factory.(true).logout
  @logged_in = false
end

#quitObject

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.(false).browser.close
end