Module: PowerSchool::Configuration

Included in:
PowerSchool
Defined in:
lib/power_school/configuration.rb

Constant Summary collapse

VALID_OPTION_KEYS =
%w(host username password browser).freeze
HOST =
nil
USERNAME =
nil
PASSWORD =
nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extend(base) ⇒ Object



14
15
16
# File 'lib/power_school/configuration.rb', line 14

def self.extend(base)
    base.reset
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/power_school/configuration.rb', line 24

def configure
    yield self

    download_directory = "#{Dir.pwd}/downloads"
     
    profile = Selenium::WebDriver::Firefox::Profile.new
    profile["browser.download.useDownloadDir"] = true
    profile['browser.download.dir'] = download_directory
    profile['browser.helperApps.neverAsk.saveToDisk'] = "Document, text/plain"
    profile['browser.helperApps.neverAsk.openFile'] = "Document, text/plain"
 #           puts profile.inspect
    #driver = Selenium::WebDriver.for :firefox, :profile => profile
    #self.browser ||= Watir::Browser.new(driver)
     
    self.browser ||= Watir::Browser.new :firefox, :profile => profile
end

#resetObject



18
19
20
21
22
# File 'lib/power_school/configuration.rb', line 18

def reset
    self.host = HOST
    self.username = USERNAME
    self.password = PASSWORD
end