swot-ruby 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c4d6bc77cb526656be8cfd79b2617c57f59cd03a5d3b0ab10ebd8acdebc70d04
4
+ data.tar.gz: 50bc525d978231cba12d9ab1bb45ab1a81bf88688da2a14001b65fcd5c6a2aa1
5
+ SHA512:
6
+ metadata.gz: 0f58f873100c5091f7c0189fe240ff6143952a17f2d80f9b363c4f5ab9b75d1a65e11ffa410dd3c6a396dd37b8141889542cab1f0465dd7875d37b9365a9d4f5
7
+ data.tar.gz: e568e25362a5506b3b3df13c2ee28d8a815f3d1d59123bd64f9106d971e248c0454aee9023099cf75d5fcefd35225f7b793af105f3fc9e456ee24b547a5998a3
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
@@ -0,0 +1,24 @@
1
+ #### Institution/School Name
2
+ {Name Here}
3
+
4
+ #### Instiution/School Website
5
+ {Website URL}
6
+
7
+ #### Email Users
8
+
9
+ *Please place an x between the square brackets if yes*
10
+ - [ ] Students
11
+ - [ ] Academic/Teaching Staff
12
+ - [ ] Other/Support Staff
13
+ - [ ] Alumni
14
+
15
+ #### Education Levels
16
+
17
+ *Please place an x between the square brackets if yes*
18
+
19
+ - [ ] Post-graduate research
20
+ - [ ] Graduate School
21
+ - [ ] College (University) or Undergraduate School or equivalent
22
+ - [ ] Community College or equivalent
23
+ - [ ] High School or equivalent
24
+ - [ ] Elementary School or equivalent
@@ -0,0 +1,40 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ "main" ]
13
+ pull_request:
14
+ branches: [ "main" ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+
22
+ runs-on: ubuntu-latest
23
+ strategy:
24
+ matrix:
25
+ ruby-version: ['2.7', '3.0', '3.1', '3.2']
26
+
27
+ steps:
28
+ - uses: actions/checkout@v3
29
+ with:
30
+ submodules: 'recursive' # Fetches all submodules recursively
31
+ - name: Set up Ruby
32
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
33
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
34
+ # uses: ruby/setup-ruby@v1
35
+ uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
36
+ with:
37
+ ruby-version: ${{ matrix.ruby-version }}
38
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
39
+ - name: Run tests
40
+ run: bundle exec rake
@@ -0,0 +1,31 @@
1
+ name: Update Submodules
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '0 0 * * *' # Runs every day at midnight
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: write
10
+
11
+ jobs:
12
+ update:
13
+
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - name: Checkout repository
18
+ uses: actions/checkout@v2
19
+ with:
20
+ submodules: 'recursive'
21
+
22
+ - name: Update submodules
23
+ run: |
24
+ git submodule update --remote
25
+ git config --global user.name 'Dave Kimura'
26
+ git config --global user.email 'dave@k-innovations.net'
27
+
28
+ - name: Commit and push changes
29
+ run: |
30
+ git commit -am "Updated submodules"
31
+ git push
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ .DS_Store
2
+ Gemfile.lock
3
+ *.gem
4
+ .bundle
5
+ .idea
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "data"]
2
+ path = data
3
+ url = https://github.com/JetBrains/swot.git
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.1
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,18 @@
1
+ # Contributing to Swot
2
+
3
+ ##### Updating the database
4
+
5
+ https://github.com/jetbrains/swot is the canonical source of truth for the list of domains.
6
+ If you want to add a new domain, please submit a pull request there. This database is updated
7
+ periodically based on the information in that repository.
8
+
9
+ ##### What will not be accepted
10
+
11
+ Any pull request that is touching the `lib/domains` directory will be
12
+ rejected. This is because the contents of that directory are automatically generated
13
+ from the canonical source of truth.
14
+
15
+ ##### What will be accepted
16
+
17
+ A pull request that improves the parsing functionality or adds new features to the
18
+ gem will be accepted. Please make sure to include tests for any new functionality.
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'public_suffix'
4
+ gem 'naughty_or_nice', "~> 2.0"
5
+
6
+ group :development do
7
+ gem "nokogiri", "~> 1.5"
8
+ gem "rake", "~> 13.0"
9
+ gem "rdoc", "~> 3.12"
10
+ gem "bundler", "~> 2.2"
11
+ gem "minitest", "~> 4.7.5"
12
+ end
13
+
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Lee Reilly, JetBrains, Dave Kimura
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.
data/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # Swot :apple:
2
+
3
+ [![Ruby](https://github.com/kobaltz/swot/actions/workflows/ruby.yml/badge.svg?branch=main)](https://github.com/kobaltz/swot/actions/workflows/ruby.yml) [![Update Submodules](https://github.com/kobaltz/swot/actions/workflows/update_domains.yml/badge.svg?branch=main)](https://github.com/kobaltz/swot/actions/workflows/update_domains.yml) [![Gem Version](https://badge.fury.io/rb/swot.svg)](http://badge.fury.io/rb/swot)
4
+
5
+ If you have a product or service and offer **academic discounts**, there's a good chance there's some manual component to the approval process. Perhaps `.edu` email addresses are automatically approved because, for the most part at least, they're associated with American post-secondary educational institutions. Perhaps `.ac.uk` email addresses are automatically approved because they're guaranteed to belong to British universities and colleges. Unfortunately, not every country has an education-specific TLD (Top Level Domain) and plenty of schools use `.com` or `.net`.
6
+
7
+ Swot is a community-driven or crowdsourced library for verifying that domain names and email addresses are tied to a legitimate university of college - more specifically, an academic institution providing higher education in tertiary, quaternary or any other kind of post-secondary education in any country in the world.
8
+
9
+ **Pop quiz:** Which of the following domain names should be eligible for an academic discount? `stanford.edu`, `america.edu`, `duep.edu`, `gla.ac.uk`, `unizar.es`, `usask.ca`, `hil.no`, `unze.ba`, `fu-berlin.de`, `ecla.de`, `bvb.de`, `lsmu.com`. Answers at the foot of the page.
10
+
11
+ ### Installation
12
+
13
+ Swot is a Ruby gem, so you'll need a little Ruby-fu to get it working. Simply
14
+
15
+ `gem install swot`
16
+
17
+ Or add this to your `Gemfile` before doing a `bundle install`:
18
+
19
+ `gem 'swot'`
20
+
21
+ ## Requirements
22
+
23
+ - Ruby >= 2.0
24
+
25
+ ### Usage
26
+
27
+ #### Verify Email Addresses
28
+
29
+ ```ruby
30
+ Swot::is_academic? 'lreilly@stanford.edu' # true
31
+ Swot::is_academic? 'lreilly@strath.ac.uk' # true
32
+ Swot::is_academic? 'lreilly@soft-eng.strath.ac.uk' # true
33
+ Swot::is_academic? 'pedro@ugr.es' # true
34
+ Swot::is_academic? 'lee@uottawa.ca' # true
35
+ Swot::is_academic? 'lee@leerilly.net' # false
36
+ ```
37
+
38
+ #### Verify Domain Names
39
+
40
+ ```ruby
41
+ Swot::is_academic? 'harvard.edu' # true
42
+ Swot::is_academic? 'www.harvard.edu' # true
43
+ Swot::is_academic? 'http://www.harvard.edu' # true
44
+ Swot::is_academic? 'http://www.github.com' # false
45
+ Swot::is_academic? 'http://www.rangers.co.uk' # false
46
+ ```
47
+
48
+ #### Find School Names
49
+
50
+ ```ruby
51
+ Swot::school_name 'lreilly@cs.strath.ac.uk'
52
+ # => "University of Strathclyde"
53
+
54
+ Swot::school_name 'http://www.stanford.edu'
55
+ # => "Stanford University"
56
+ ```
57
+
58
+ ### Contributing to Swot
59
+
60
+ Contributions welcome! Please see the [contribution guidelines](CONTRIBUTING.md) for details on how to add, update, or delete schools. Code contributions and ports to different languages welcome too.
61
+
62
+ **Thanks** to the following people for their contributions:
63
+ @blutack, @captn3m0, @chrishunt, @johndbritton, @johnotander, @pborreli, @rcurtis, @vikhyat,.
64
+
65
+ **Special thanks** to @weppos for the [public_suffix](https://github.com/weppos/publicsuffix-ruby) gem :metal:
66
+
67
+ ### Known Issues
68
+
69
+ * You can search by email and domain names only. You cannot search by IP.
70
+ * You don't know if the email address belongs to a student, faculty, staff member, alumni, or a contractor.
71
+ * There may be a few false positives, missing institutions... maybe even a couple of typos. Contributions welcome!
72
+
73
+ **Please note:** just because someone has verified that they own `lreilly@stanford.edu` does *not* mean that they're a student. They could be faculty, staff, alumnni, or maybe even an external contractor. If you're suddenly getting a lot of traffic from websites like [FatWallet](http://www.fatwallet.com) or [SlickDeals](http://www.slickdeals.net), you might want to find out why. If you're suddenly getting a lot of requests from a particular school, you should look into that too. It may be good business, word of mouth, or someone may have found a loophole. Swot gives you a *high confidence level* - not a guarantee. I recommend putting some controls in place or at least monitor how it's doing from time to time.
74
+
75
+ ### What is a swot?
76
+
77
+ According to [UrbanDictionary](http://www.urbandictionary.com/define.php?term=swot) :blue_book:
78
+
79
+ > A word used by morons to insult a person of superior academic abilities.
80
+
81
+ or
82
+
83
+ > [verb] To Swot; Revision undertaken preceding an examination.
84
+
85
+ or
86
+
87
+ > [backronym] Stupid Waste of Time
88
+
89
+ ### Pop Quiz Answers
90
+
91
+ Hopefully, you'll be surprised by some of this:
92
+
93
+ | Domain | Academic? | Comments |
94
+ |--------|-----------|----------|
95
+ |`stanford.edu`|:heavy_check_mark:|OK, this was an easy one so you could get at least *one* right|
96
+ |`america.edu`|:heavy_multiplication_x:| Prior to October 29th 2001, anyone could register a `.edu` domain name ([details](https://en.wikipedia.org/wiki/.edu#Grandfathered_uses)) |
97
+ |`duep.edu`|:heavy_check_mark:| Alfred Nobel University is a *Ukranian* University *in the Ukraine* i.e. not in the USA :us: |
98
+ |`gla.ac.uk`|:heavy_check_mark:|Glasgow University in Scotland|
99
+ |`unizar.es`|:heavy_check_mark:|The University of Zaragoza in Spain|
100
+ |`usask.ca`|:heavy_check_mark:|The University of Saskatchewan in Canada|
101
+ |`hil.no`|:heavy_check_mark:|Lillehammer University College in Norway|
102
+ |`unze.ba`|:heavy_check_mark:|University of Zenica in Bosnia and Herzegovina|
103
+ |`fu-berlin.de`|:heavy_check_mark:|Free University of Berlin in Germany|
104
+ |`ecla.de`|:heavy_check_mark:|ECLA of Bard is a state recognized liberal arts university in Berlin, Germany |
105
+ |`bvb.de`|:heavy_multiplication_x:|It's a soccer team from Germany|
106
+ |`lsmu.com`|:heavy_check_mark:| Lugansk State Medical University in the Ukraine |
107
+
108
+ If you verified this by visiting all of the websites, how long did it take you? Did you have fun? Imagine you had to do this 10 - 100 times every day. Now you know a little something about the inspiration for Swot. Swot can verify them all in a fraction of a second and remove a :poop: part of someone's job.
109
+
110
+ ### See Also
111
+
112
+ * [gman](https://github.com/benbalter/gman) - like swot, but for government emails
113
+ * [swotphp](https://github.com/mdwheele/swotphp) - PHP port of Swot
114
+ * [swot-js](https://github.com/theotow/swot-js) - JS port of Swot
115
+ * [swot-simple](https://github.com/mapbox/swot-simple) - JS port of Swot
116
+ * [swot-clj](https://github.com/ipavl/swot-clj) - Clojure port of Swot
117
+ * [swot](https://github.com/abadojack/swot) - Go port of Swot
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'rake/testtask'
15
+ Rake::TestTask.new(:test) do |test|
16
+ test.libs << 'lib' << 'test'
17
+ test.pattern = 'test/**/test_*.rb'
18
+ test.verbose = true
19
+ end
20
+
21
+ task :default => :test
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0