power_school 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ebf80e632e74d0cd6fc635be69cc336ebf1827aa
4
+ data.tar.gz: 594c5e7fe4250fad892165e8a09e5666d1bcbfb4
5
+ SHA512:
6
+ metadata.gz: d95d71a431d899b6c45fbbd4a3982b43c346312f2127074a5733dba1d881253f88b0868e30bf9cc7e2021b4de7f203b3a52e7ea121a8d36bf02cfc506b10116c
7
+ data.tar.gz: 849e3247abcc6aef107cf80a4ae236ce19d6d3d4a4f3604d75adfa09cf2fff3060e4658dea735b9da15c3afd565732658c27fe846779aea72dd43d210294bea6
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ chromedriver.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0-p0
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rake"
4
+
5
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Mauro Morales
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # PowerSchool
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'power_school'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install power_school
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,42 @@
1
+ require 'watir-webdriver'
2
+ require 'selenium-webdriver'
3
+
4
+ module PowerSchool
5
+ module Configuration
6
+ VALID_OPTION_KEYS = %w(host username password browser).freeze
7
+
8
+ HOST = nil
9
+ USERNAME = nil
10
+ PASSWORD = nil
11
+
12
+ attr_accessor *VALID_OPTION_KEYS
13
+
14
+ def self.extend(base)
15
+ base.reset
16
+ end
17
+
18
+ def reset
19
+ self.host = HOST
20
+ self.username = USERNAME
21
+ self.password = PASSWORD
22
+ end
23
+
24
+ def configure
25
+ yield self
26
+
27
+ download_directory = "#{Dir.pwd}/downloads"
28
+
29
+ profile = Selenium::WebDriver::Firefox::Profile.new
30
+ profile["browser.download.useDownloadDir"] = true
31
+ profile['browser.download.dir'] = download_directory
32
+ profile['browser.helperApps.neverAsk.saveToDisk'] = "Document, text/plain"
33
+ profile['browser.helperApps.neverAsk.openFile'] = "Document, text/plain"
34
+ puts profile.inspect
35
+ driver = Selenium::WebDriver.for :firefox, :profile => profile
36
+ self.browser ||= Watir::Browser.new(driver)
37
+
38
+ #self.browser ||= Watir::Browser.new :firefox, :profile => profile
39
+
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,79 @@
1
+ module PowerSchool
2
+ class Connection
3
+
4
+ def self.login
5
+ PowerSchool.browser.goto PowerSchool.host + "pw.html"
6
+ credentials = PowerSchool.username + ';' + PowerSchool.password
7
+ PowerSchool.browser.text_field(:name => 'password').set credentials
8
+ PowerSchool.browser.button(:id => "btnEnter").click
9
+ end
10
+
11
+ def self.logout
12
+ PowerSchool.browser.link(:id => "btnLogout")
13
+ PowerSchool.browser.close
14
+ end
15
+
16
+
17
+ def self.welcome_message
18
+ PowerSchool.browser.li(:id, "userName").text
19
+ end
20
+
21
+ def self.go_home( additional_info = "" )
22
+ PowerSchool.browser.goto PowerSchool.host + "home.html" + additional_info
23
+ end
24
+
25
+ def self.go_to( url )
26
+ PowerSchool.browser.goto PowerSchool.host + url
27
+ end
28
+
29
+ def self.select_school( school_name )
30
+ go_home
31
+ unless current_school == school_name
32
+ PowerSchool.browser.link(:id, "schoolContext").click
33
+ PowerSchool.browser.wait_until{ PowerSchool.browser.select_list(:name, 'Schoolid').exists? }
34
+ PowerSchool.browser.wait_until { PowerSchool.browser.select_list(:name, "Schoolid").select school_name }
35
+ end
36
+ end
37
+
38
+ def self.current_school
39
+ PowerSchool.browser.span(:id, "schoolText").text
40
+ end
41
+
42
+ def self.clear_form
43
+ PowerSchool.browser.text_fields.each do |text|
44
+ text.clear
45
+ end
46
+ end
47
+
48
+ def self.quick_import( table_name, file_name)
49
+ PowerSchool::Connection.go_to "importexport/quickimport/quickimport1.html"
50
+ PowerSchool.browser.select_list(:id, "filenumber").select table_name
51
+ PowerSchool.browser.select_list(:id, "fielddelim").select "Other:"
52
+ PowerSchool.browser.text_field(:id => 'custfielddelim').set ','
53
+ PowerSchool.browser.select_list(:id, "recdelim").select "LF"
54
+ PowerSchool.browser.file_field(:id, "filename").set( file_name )
55
+ PowerSchool.browser.button(:id => "btnImport").click
56
+
57
+ PowerSchool.browser.checkbox(:name, "skipFirstRow").set
58
+
59
+ if table_name == 'Teachers'
60
+ PowerSchool.browser.checkbox(:name, "updaterecordsmode").set
61
+
62
+ elsif table_name == 'Students'
63
+ PowerSchool.browser.radio(:value, "createnew").set
64
+ PowerSchool.browser.checkbox(:name, "AllowEnrollStatusUpdate").set
65
+ end
66
+
67
+ PowerSchool.browser.button(:id => "btnSubmit").click
68
+ end
69
+
70
+ def self.last_staff_id
71
+ PowerSchool::Connection.go_to "tech/dde/"
72
+ PowerSchool.browser.select_list(:name, "filenum").select_value "5"
73
+ PowerSchool.browser.button(:name => "searchselectall").click
74
+ PowerSchool::Connection.go_to "tech/dde/exportrecords.html"
75
+ PowerSchool.browser.text_field(:id => "tt").set("ID")
76
+ PowerSchool.browser.button(:id => "btnSubmit").click
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,19 @@
1
+ module PowerSchool
2
+ class Students
3
+
4
+ def self.find( full_name )
5
+ PowerSchool::Connection.go_home
6
+ PowerSchool.browser.text_field(:id => "ss").set full_name
7
+ PowerSchool.browser.button(:id => "btnSearch").click
8
+ if PowerSchool.browser.frame(:id => "frameContent").exists?
9
+ PowerSchool.browser.frame(:id => "frameContent").div(:id => "content-main").p.text
10
+ else
11
+ false
12
+ end
13
+ end
14
+
15
+ def self.import(file_path)
16
+ PowerSchool::Connection.quick_import('Students', file_path)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,26 @@
1
+ module PowerSchool
2
+ class Teachers
3
+
4
+ def self.find( full_name )
5
+ PowerSchool::Connection.go_to 'faculty/search.html'
6
+ PowerSchool.browser.text_field(:id => "ss").set full_name
7
+ PowerSchool.browser.button(:id => "btnSearch").click
8
+ if PowerSchool.browser.frame(:id => "frameContent").exists?
9
+ PowerSchool.browser.frame(:id => "frameContent").div(:id => "content-main").h1.text
10
+ else
11
+ false
12
+ end
13
+ end
14
+
15
+ def self.import(file_path)
16
+ PowerSchool::Connection.quick_import('Teachers', file_path)
17
+ end
18
+
19
+ def self.delete(full_name)
20
+ find(full_name)
21
+ PowerSchool.browser.frame(:id => "frameMenu").a(:text => "Security Settings").click
22
+ PowerSchool.browser.frame(:id => "frameContent").button(:id => "btnConfirmDeleteProxy").click
23
+ PowerSchool.browser.frame(:id => "frameContent").a(:id => "btnDelete").click
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module PowerSchool
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,14 @@
1
+ require "power_school/version"
2
+ require "power_school/configuration"
3
+ require "power_school/connection"
4
+ require "power_school/teachers"
5
+ require "power_school/students"
6
+ require "watir"
7
+
8
+ require 'nokogiri'
9
+ require 'open-uri'
10
+
11
+ module PowerSchool
12
+ extend Configuration
13
+
14
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'power_school/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "power_school"
8
+ spec.version = PowerSchool::VERSION
9
+ spec.authors = ["Mauro Morales"]
10
+ spec.email = ["contact@mauromorales.com"]
11
+ spec.description = "Interact with PowerSchool"
12
+ spec.summary = "Interact with PowerSchool by using capybara"
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "watir", "~>4.0"
22
+ spec.add_dependency "nokogiri"
23
+ spec.add_dependency "capybara"
24
+
25
+ spec.add_development_dependency "rspec", "~> 2.6"
26
+ spec.add_development_dependency "bundler", "~> 1.3"
27
+ spec.add_development_dependency "rake"
28
+ end
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: power_school
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mauro Morales
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-03-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: watir
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: capybara
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.6'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '2.6'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '1.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Interact with PowerSchool
98
+ email:
99
+ - contact@mauromorales.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - .rspec
106
+ - .ruby-version
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - lib/power_school.rb
112
+ - lib/power_school/configuration.rb
113
+ - lib/power_school/connection.rb
114
+ - lib/power_school/students.rb
115
+ - lib/power_school/teachers.rb
116
+ - lib/power_school/version.rb
117
+ - power_school.gemspec
118
+ homepage: ''
119
+ licenses:
120
+ - MIT
121
+ metadata: {}
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 2.0.0
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: Interact with PowerSchool by using capybara
142
+ test_files: []