my_banner 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 27e190c7c040b7c94533087b3d9aa277ddb121c9e0b46e3ff8f87bdba337b171
4
+ data.tar.gz: 01dfd9ce9c4cb0d6fce7b7ba0429b52d095192c4fb56c2da394c65fb33f90846
5
+ SHA512:
6
+ metadata.gz: 286d1e2eec0726782cae619733819dad4aa93d0fe91badf5609f52555034fc19300a37b0dbfad646a8377b5456bfbac0713ff58139a27be783279b98c3732252
7
+ data.tar.gz: 7d12acd837e7bee876e2d66aad85238eb4ca9c02634860283151c7b3350d4772d02430372a54292f47d233813fcebd13dd2197205f536f6b43b030104e927be2
@@ -0,0 +1,12 @@
1
+ plugins:
2
+ rubocop:
3
+ enabled: false
4
+ checks:
5
+ #Rubocop/Metrics/ClassLength:
6
+ # enabled: false
7
+ Rubocop/Style/StringLiterals:
8
+ enabled: false
9
+ Rubocop/Layout/LeadingCommentSpace:
10
+ enabled: false
11
+ Rubocop/Layout/EmptyLinesAroundClassBody:
12
+ enabled: false
@@ -0,0 +1,22 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ # test coverage
14
+ coverage
15
+
16
+ # roster pages and schedule pages, which can contain PII
17
+ pages/*.html
18
+
19
+ # google auth credentials
20
+ .env
21
+ auth/*.json
22
+ auth/*.yaml
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1 @@
1
+ 2.5.3
@@ -0,0 +1,17 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.3
5
+ before_install: gem install bundler -v 1.17.1
6
+ env:
7
+ global:
8
+ - CC_TEST_REPORTER_ID=8f424c1882aec9c7bf8f1975801bf5913caa16ca31ecf859b2b4bd839bb362ca
9
+ - COVERAGE=true
10
+ before_script:
11
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
12
+ - chmod +x ./cc-test-reporter
13
+ - ./cc-test-reporter before-build
14
+ script:
15
+ - bundle exec rspec
16
+ after_script:
17
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
@@ -0,0 +1,25 @@
1
+ # Contributor's Guide
2
+
3
+ ## Development
4
+
5
+ ```sh
6
+ bin/console
7
+ ```
8
+
9
+ ## Testing
10
+
11
+ ```sh
12
+ bundle exec rspec spec/
13
+ ```
14
+
15
+ ## Generating Code Coverage Reports
16
+
17
+ ```sh
18
+ COVERAGE=true bundle exec rspec spec
19
+ ```
20
+
21
+ ## Releasing
22
+
23
+ ```sh
24
+ bundle exec rake release
25
+ ```
@@ -0,0 +1,86 @@
1
+ # Credits, Notes, and Reference
2
+
3
+ ## Ruby
4
+
5
+ + https://apidock.com/rails/String/to_datetime
6
+ + https://stackoverflow.com/a/5905875/670433
7
+ + https://apidock.com/ruby/DateTime/strftime
8
+ + [active model validation requirements too great?](https://stackoverflow.com/questions/37619583/how-to-load-only-activemodel-validations)
9
+
10
+ ## Rubygems
11
+
12
+ + http://data-creative.info/reference-docs/2015/07/03/how-to-make-a-ruby-gem/
13
+ + https://guides.rubygems.org/make-your-own-gem/#adding-an-executable
14
+ + https://github.com/rubygems/rubygems/issues/1267#issuecomment-196180872
15
+ + http://data-creative.info/reference-docs/2015/07/03/how-to-make-a-ruby-gem/
16
+
17
+ ### Rake Tasks
18
+
19
+ + http://andyatkinson.com/blog/2014/06/23/sharing-rake-tasks-in-gems
20
+ + https://github.com/ruby/rake
21
+
22
+ ## Banner
23
+
24
+ + https://myaccess.georgetown.edu
25
+
26
+ ## Google Calendar API
27
+
28
+ + https://developers.google.com/calendar/concepts/events-calendars
29
+ + https://developers.google.com/calendar/quickstart/ruby
30
+ + https://developers.google.com/api-client-library/ruby/apis/calendar/v3
31
+ + https://github.com/northworld/google_calendar
32
+ + https://developers.google.com/api-client-library/ruby/auth/installed-app#choosingredirecturi
33
+ + https://developers.google.com/calendar/v3/reference/calendarList/list#examples
34
+ + https://developers.google.com/calendar/v3/reference/calendars/insert
35
+ + https://developers.google.com/calendar/auth
36
+ + https://developers.google.com/calendar/v3/reference/calendars/delete
37
+ + [Auth scope constants](https://github.com/googleapis/google-api-ruby-client/blob/6773823e78266830a9a8a651d5fd52e307b63e97/generated/google/apis/calendar_v3.rb#L31-L43)
38
+ + https://developers.google.com/calendar/v3/reference/events/insert
39
+ + https://developers.google.com/calendar/v3/reference/events/update
40
+ + https://developers.google.com/calendar/v3/reference/events/delete
41
+ + So many events. They don't get deleted, they go into "cancelled" [status](https://developers.google.com/calendar/v3/reference/events#status)
42
+ + https://developers.google.com/calendar/v3/reference/events/list
43
+
44
+ ## Google Sheets and Drive APIs
45
+
46
+ + https://developers.google.com/sheets/api/quickstart/ruby
47
+ + https://developers.google.com/sheets/api/guides/migration#list_spreadsheets_for_the_authenticated_user
48
+ + https://developers.google.com/drive/api/v3/reference/files/list
49
+ + https://developers.google.com/drive/api/v3/quickstart/ruby
50
+ + https://stackoverflow.com/questions/37876423/get-the-list-of-all-spreadsheets-associated-with-google-account-using-sheets-api
51
+ + https://github.com/googleapis/google-api-ruby-client/blob/711dfb83b33c03535076917726956584d5c8bf9a/generated/google/apis/drive_v3/service.rb#L795-L847
52
+ + https://github.com/googleapis/google-api-ruby-client/blob/711dfb83b33c03535076917726956584d5c8bf9a/generated/google/apis/sheets_v4/service.rb#L481-L518
53
+ + https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/create
54
+ + https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#Spreadsheet
55
+ + https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets
56
+ + https://stackoverflow.com/questions/43207765/how-do-i-add-data-to-a-google-sheet-from-ruby
57
+ + https://github.com/googleapis/google-api-ruby-client/blob/711dfb83b33c03535076917726956584d5c8bf9a/generated/google/apis/sheets_v4/service.rb#L338-L406
58
+ + https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append
59
+ + https://github.com/googleapis/google-api-ruby-client/blob/711dfb83b33c03535076917726956584d5c8bf9a/generated/google/apis/drive_v3/service.rb#L604-L639
60
+ + https://developers.google.com/drive/api/v2/reference/files/delete
61
+ + https://stackoverflow.com/questions/46836393/how-do-i-delete-a-spreadsheet-file-using-google-spreadsheets-api
62
+
63
+ ## Parsing HTML with Nokogiri
64
+
65
+ + https://www.nokogiri.org/tutorials/searching_a_xml_html_document.html
66
+
67
+ ## Testing and Quality Control
68
+
69
+ + https://github.com/bblimke/webmock/wiki/Enabling-and-Disabling-WebMock
70
+ + https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
71
+ + https://relishapp.com/rspec/rspec-core/v/2-4/docs/command-line/tag-option
72
+ + [factory attributes for reserved words](https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#method-name--reserved-word-attributes)
73
+
74
+ ### Code Climate
75
+
76
+ + https://docs.codeclimate.com/docs/approve-code-climate-as-a-third-party-application-in-github-1
77
+ + https://docs.codeclimate.com/docs/my-repository-isnt-listed-when-i-try-to-add-it-to-code-climate
78
+ + https://docs.codeclimate.com/docs/finding-your-test-coverage-token#section-regenerating-a-repos-test-reporter-id
79
+ + https://docs.codeclimate.com/docs/configuring-test-coverage
80
+ + https://docs.codeclimate.com/docs/travis-ci-test-coverage
81
+
82
+ #### Test Coverage Reporting
83
+
84
+ + https://github.com/colszowka/simplecov
85
+ + https://github.com/chetan/simplecov-console/
86
+ + https://medium.com/the-code-review/display-your-ruby-test-coverage-using-simplecov-gem-and-codeclimate-6db6336fe409
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in my_banner.gemspec
6
+ gemspec
@@ -0,0 +1,128 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ my_banner (1.0.0)
5
+ activesupport (~> 5.2)
6
+ google-api-client (~> 0.27)
7
+ nokogiri (~> 1.9)
8
+ pry
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ activesupport (5.2.1)
14
+ concurrent-ruby (~> 1.0, >= 1.0.2)
15
+ i18n (>= 0.7, < 2)
16
+ minitest (~> 5.1)
17
+ tzinfo (~> 1.1)
18
+ addressable (2.5.2)
19
+ public_suffix (>= 2.0.2, < 4.0)
20
+ ansi (1.5.0)
21
+ coderay (1.1.2)
22
+ concurrent-ruby (1.0.5)
23
+ crack (0.4.3)
24
+ safe_yaml (~> 1.0.0)
25
+ declarative (0.0.10)
26
+ declarative-option (0.1.0)
27
+ diff-lcs (1.3)
28
+ docile (1.3.1)
29
+ factory_bot (4.11.1)
30
+ activesupport (>= 3.0.0)
31
+ faraday (0.15.4)
32
+ multipart-post (>= 1.2, < 3)
33
+ google-api-client (0.27.0)
34
+ addressable (~> 2.5, >= 2.5.1)
35
+ googleauth (>= 0.5, < 0.8.0)
36
+ httpclient (>= 2.8.1, < 3.0)
37
+ mime-types (~> 3.0)
38
+ representable (~> 3.0)
39
+ retriable (>= 2.0, < 4.0)
40
+ signet (~> 0.10)
41
+ googleauth (0.7.1)
42
+ faraday (~> 0.12)
43
+ jwt (>= 1.4, < 3.0)
44
+ memoist (~> 0.16)
45
+ multi_json (~> 1.11)
46
+ os (>= 0.9, < 2.0)
47
+ signet (~> 0.7)
48
+ hashdiff (0.3.7)
49
+ hirb (0.7.3)
50
+ httpclient (2.8.3)
51
+ i18n (1.1.0)
52
+ concurrent-ruby (~> 1.0)
53
+ json (2.1.0)
54
+ jwt (2.1.0)
55
+ memoist (0.16.0)
56
+ method_source (0.9.2)
57
+ mime-types (3.2.2)
58
+ mime-types-data (~> 3.2015)
59
+ mime-types-data (3.2018.0812)
60
+ mini_portile2 (2.4.0)
61
+ minitest (5.11.3)
62
+ multi_json (1.13.1)
63
+ multipart-post (2.0.0)
64
+ nokogiri (1.9.1)
65
+ mini_portile2 (~> 2.4.0)
66
+ os (1.0.0)
67
+ pry (0.12.2)
68
+ coderay (~> 1.1.0)
69
+ method_source (~> 0.9.0)
70
+ public_suffix (3.0.3)
71
+ rake (10.5.0)
72
+ representable (3.0.4)
73
+ declarative (< 0.1.0)
74
+ declarative-option (< 0.2.0)
75
+ uber (< 0.2.0)
76
+ retriable (3.1.2)
77
+ rspec (3.8.0)
78
+ rspec-core (~> 3.8.0)
79
+ rspec-expectations (~> 3.8.0)
80
+ rspec-mocks (~> 3.8.0)
81
+ rspec-core (3.8.0)
82
+ rspec-support (~> 3.8.0)
83
+ rspec-expectations (3.8.2)
84
+ diff-lcs (>= 1.2.0, < 2.0)
85
+ rspec-support (~> 3.8.0)
86
+ rspec-mocks (3.8.0)
87
+ diff-lcs (>= 1.2.0, < 2.0)
88
+ rspec-support (~> 3.8.0)
89
+ rspec-support (3.8.0)
90
+ safe_yaml (1.0.4)
91
+ signet (0.11.0)
92
+ addressable (~> 2.3)
93
+ faraday (~> 0.9)
94
+ jwt (>= 1.5, < 3.0)
95
+ multi_json (~> 1.10)
96
+ simplecov (0.16.1)
97
+ docile (~> 1.1)
98
+ json (>= 1.8, < 3)
99
+ simplecov-html (~> 0.10.0)
100
+ simplecov-console (0.4.2)
101
+ ansi
102
+ hirb
103
+ simplecov
104
+ simplecov-html (0.10.2)
105
+ thread_safe (0.3.6)
106
+ tzinfo (1.2.5)
107
+ thread_safe (~> 0.1)
108
+ uber (0.1.0)
109
+ webmock (3.4.2)
110
+ addressable (>= 2.3.6)
111
+ crack (>= 0.3.2)
112
+ hashdiff
113
+
114
+ PLATFORMS
115
+ ruby
116
+
117
+ DEPENDENCIES
118
+ bundler (~> 1.16)
119
+ factory_bot (~> 4.11)
120
+ my_banner!
121
+ rake (~> 10.0)
122
+ rspec (~> 3.0)
123
+ simplecov (~> 0.16)
124
+ simplecov-console (~> 0.4)
125
+ webmock (~> 3.4)
126
+
127
+ BUNDLED WITH
128
+ 1.17.1
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 MJ Rossetti <prof.mj.rossetti@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,116 @@
1
+ # MyBanner - Ruby
2
+
3
+ [![Build Status](https://travis-ci.com/prof-rossetti/my-banner-rb.svg?branch=master)](https://travis-ci.com/prof-rossetti/my-banner-rb)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/41968ec227c9b165cd82/maintainability)](https://codeclimate.com/github/prof-rossetti/my-banner-rb/maintainability)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/41968ec227c9b165cd82/test_coverage)](https://codeclimate.com/github/prof-rossetti/my-banner-rb/test_coverage)
6
+
7
+ This program processes detailed schedule information from your school's [Ellucian Banner](https://www.ellucian.com/solutions/ellucian-banner) information system to generate [Google Calendar](https://calendar.google.com) events and/or [Google Sheets](https://docs.google.com/spreadsheets) gradebook files for each of your scheduled classes.
8
+
9
+ ## Dependencies
10
+
11
+ This program requires Ruby (version 2.5) and Bundler (version 1.16).
12
+
13
+ ## Installation
14
+
15
+ To install the program, download or clone it [from GitHub](https://github.com/prof-rossetti/my-banner-rb):
16
+
17
+ ```sh
18
+ git clone git@github.com:prof-rossetti/my-banner-rb.git
19
+ ```
20
+
21
+ All subsequent usage commands assume you will be running them from the root directory of this repository, so navigate there now:
22
+
23
+ ```sh
24
+ cd my-banner-rb/
25
+ ```
26
+
27
+ ## Setup
28
+
29
+ Install the program's Ruby package dependencies by running the setup script:
30
+
31
+ ```sh
32
+ bin/setup
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ Before the program can generate Google Calendar events and/or Google Sheet gradebook files for all your scheduled classes, it needs access to your schedule. So follow the section below to [Download Schedule Page from Banner](#downloading-schedule-page-from-banner) before performing any of the other functionality.
38
+
39
+ ### Downloading Schedule Page from Banner
40
+
41
+ To access your schedule of classes for some specified term, login to your school's banner site (e.g. https://myaccess.georgetown.edu/), and navigate to one of the following schedule pages, depending on your role:
42
+
43
+ + *Home > Faculty Services > Faculty Detail Schedule*
44
+ + *Home > Student Services > Student Detail Schedule*
45
+
46
+ Download your schedule page as an HTML file and move it into this repo at: **pages/my-detail-schedule.html**.
47
+
48
+ To check the program's ability to parse that HTML content, run the schedule parser script and inspect its results:
49
+
50
+ ```sh
51
+ bundle exec rake parse_schedule
52
+ ```
53
+
54
+ Example results:
55
+
56
+ ```rb
57
+ {
58
+ :title=>"Intro to Programming",
59
+ :crn=>123456,
60
+ :course=>"INFO 101",
61
+ :section=>20,
62
+ :status=>"OPEN",
63
+ :registration=>"May 01, 2018 - Nov 02, 2018",
64
+ :college=>"School of Business and Technology",
65
+ :department=>"Information Systems",
66
+ :part_of_term=>"C04",
67
+ :credits=>1.5,
68
+ :levels=>["Graduate", "Juris Doctor", "Undergraduate"],
69
+ :campus=>"Main Campus",
70
+ :override=>"No",
71
+ :enrollment_counts=>{:maximum=>50, :actual=>45, :remaining=>5},
72
+ :scheduled_meeting_times=>{
73
+ :type=>"Lecture",
74
+ :time=>"11:00 am - 12:20 pm",
75
+ :days=>"TR",
76
+ :where=>"Science Building 111",
77
+ :date_range=>"Oct 29, 2018 - Dec 18, 2018",
78
+ :schedule_type=>"Lecture",
79
+ :instructors=>["Polly Professor"]
80
+ }
81
+ }
82
+ ```
83
+
84
+ As long as your schedule data resembles the structure above and reflects the contents of your schedule page, you are ready to use this program to [Generate Google Calendar Events](#Generating-Google-Calendar-Events) and/or [Generate Google Sheet Gradebook Files](#Generating-Google-Sheet-Gradebook-Files).
85
+
86
+ ### Generating Google Calendar Events
87
+
88
+ For the program to issue requests to the Google Calendar API, it needs the credentials of a Google APIs client application that has access to the Google Calendar API. From the [Google Calendar API quickstart guide](https://developers.google.com/calendar/quickstart/ruby), click "Enable the Calendar API" and follow the instructions to create a new app and generate new credentials. Download the resulting credentials file and move it into this repo at: **auth/calendar_credentials.json**.
89
+
90
+ Once the schedule page and calendar credentials are in place, you can create google calendars and events for your scheduled classes by running the calendar creation script:
91
+
92
+ ```sh
93
+ bundle exec rake create_calendars
94
+ ```
95
+
96
+ > NOTE: When running this command for the first time, you will be prompted to login to Google to get an authorization code. After supplying that code to this program, the program will store an access token which will be used to authorize subsequent requests on your behalf, so you don't need to login again.
97
+
98
+ ### Generating Google Sheet Gradebook Files
99
+
100
+ For the program to manage your gradebook files, it needs access to both the Google Sheets and Google Drive APIs.
101
+
102
+ For the program to issue requests to the Google Sheets API, it needs the credentials of a Google APIs client application that has access to the Google Sheets API. From the [Google Sheets API quickstart guide](https://developers.google.com/sheets/api/quickstart/ruby), click "Enable the Sheets API" and follow the instructions to create a new app or select an existing one, and generate new credentials. Download the resulting credentials file and move it into this repo at: **auth/spreadsheet_credentials.json**.
103
+
104
+ For the program to issue requests to the Google Drive API, it needs the credentials of a Google APIs client application that has access to the Google Drive API. From the [Google Drive API quickstart guide](https://developers.google.com/drive/api/v3/quickstart/ruby), click "Enable the Drive API" and follow the instructions to create a new app or select an existing one, and generate new credentials. Download the resulting credentials file and move it into this repo at: **auth/drive_credentials.json**.
105
+
106
+ Once the schedule page, spreadsheet credentials, and drive credentials are in place, you can create google sheet gradebooks for your scheduled classes by running the spreadsheet creation script:
107
+
108
+ ```sh
109
+ bundle exec rake create_spreadsheets
110
+ ```
111
+
112
+ > NOTE: When running this command for the first time, you will be prompted to login to Google to get an authorization codes for both the sheets and drive apis, respectively. After supplying each code to this program, the program will store an access token which will be used to authorize subsequent requests on your behalf, so you don't need to login again.
113
+
114
+ ## [Contributing](/CONTRIBUTING.md)
115
+
116
+ ## [License](/LICENSE.md)