cdc_notices 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f81b82186124e3040c8f49bf31375ed2dc9a5edc
4
- data.tar.gz: 6e4e7bc22462f83f216e30a242ef78ed4274a2af
3
+ metadata.gz: 19a37f0cff6a488733f73d3b5a7b1ec620f8ef07
4
+ data.tar.gz: f2ce615ae6400a2d6f110c53b176e9b7f8fb6928
5
5
  SHA512:
6
- metadata.gz: 2f715312af5d62af1012d8cb94543a92f956e35beb15342beaeee4a8c6196581c297b906f3274dc015169fbb92e76c9aa9bb6ad997596a8c31d36ae9a354f501
7
- data.tar.gz: 40c9bcb169a5622f08cb3f268f01972c85087639f73e6997450b74a2924eaefa37962e0631b3a9de42802dbb1f497dd412099e8299a08b361960f966c5419fe2
6
+ metadata.gz: 161d159acabb31e91f2d64ab61b87fb987ba3a98f0e2c213f1d022a47d57c0fcc70f1ebd108202954d6add3abaa0f0f6ce95d260b9fdeba928a51d88909a8695
7
+ data.tar.gz: 30cdf5325fd0c513865b9b785fd75bd16374a70dd5a540163b07ad2e9a3b306c45dd7afb81413b30fdb5d9832f718ab0b210a56e54c4303891a6a2b1d1050553
data/.gitignore CHANGED
@@ -1,12 +1,12 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- # rspec failure tracking
12
- .rspec_status
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --format documentation
2
- --color
1
+ --format documentation
2
+ --color
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.3.3
5
- before_install: gem install bundler -v 1.14.6
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.14.6
data/10.0 CHANGED
@@ -1,2 +1,2 @@
1
- Updating installed gems
2
- Nothing to update
1
+ Updating installed gems
2
+ Nothing to update
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,74 +1,74 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at tahbristol@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at tahbristol@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
2
-
3
-
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+
4
+ gemspec
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 tahbristol
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.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 tahbristol
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 CHANGED
@@ -1,41 +1,41 @@
1
- # CdcNotices
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/cdc_notices`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'cdc_notices'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install cdc_notices
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cdc_notices. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
-
37
-
38
- ## License
39
-
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
1
+ # CdcNotices
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/cdc_notices`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'cdc_notices'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install cdc_notices
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cdc_notices. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/cdc-notices CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env ruby
2
-
3
- require './lib/cdc_notices.rb'
4
-
5
- CdcNotices::CLI.new.call
1
+ #!/usr/bin/env ruby
2
+
3
+ require './lib/cdc_notices.rb'
4
+
5
+ CdcNotices::CLI.new.call
data/bin/console CHANGED
@@ -1,14 +1,14 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "cdc_notices"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "cdc_notices"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/cdc_notices.gemspec CHANGED
@@ -1,40 +1,40 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'cdc_notices/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "cdc_notices"
8
- spec.version = CdcNotices::VERSION
9
- spec.authors = ["tahbristol"]
10
- spec.email = ["tahbristol@gmail.com"]
11
-
12
- spec.summary = "Displays currrent infectious disease travel notices from the Centers for Disease Control."#%q{TODO: Write a short summary, because Rubygems requires one.}
13
- # spec.description = %q{TODO: Write a longer description or delete this line.}
14
- #spec.homepage = "TODO: Put your gem's website or public repo URL here."
15
- spec.license = "MIT"
16
-
17
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
- # to allow pushing to a single host or delete this section to allow pushing to any host.
19
- if spec.respond_to?(:metadata)
20
- # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
- else
22
- raise "RubyGems 2.0 or newer is required to protect against " \
23
- "public gem pushes."
24
- end
25
-
26
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
- f.match(%r{^(test|spec|features)/})
28
- end
29
- spec.bindir = "exe"
30
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
- spec.require_paths = ["lib"]
32
-
33
- spec.add_development_dependency "bundler", "~> 1.14"
34
- spec.add_development_dependency "rake", "~> 12.0"
35
- spec.add_development_dependency "rspec", "~> 3.0"
36
- spec.add_development_dependency "nokogiri", "~> 1.7.1"
37
- spec.add_development_dependency "rubysl-open-uri"
38
- spec.add_development_dependency "launchy"
39
- # spec.add_development_dependency "openssl", "~> 2.0.3"
40
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cdc_notices/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "cdc_notices"
8
+ spec.version = CdcNotices::VERSION
9
+ spec.authors = ["tahbristol"]
10
+ spec.email = ["tahbristol@gmail.com"]
11
+
12
+ spec.summary = "Displays currrent infectious disease travel notices from the Centers for Disease Control."#%q{TODO: Write a short summary, because Rubygems requires one.}
13
+ # spec.description = %q{TODO: Write a longer description or delete this line.}
14
+ #spec.homepage = "TODO: Put your gem's website or public repo URL here."
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.14"
34
+ spec.add_development_dependency "rake", "~> 12.0"
35
+ spec.add_development_dependency "rspec", "~> 3.0"
36
+ spec.add_development_dependency "nokogiri", "~> 1.7.1"
37
+ spec.add_development_dependency "rubysl-open-uri"
38
+ spec.add_development_dependency "launchy"
39
+ # spec.add_development_dependency "openssl", "~> 2.0.3"
40
+ end
data/exe/cdc-notices ADDED
@@ -0,0 +1,3 @@
1
+ require './lib/cdc_notices.rb'
2
+
3
+ CdcNotices::CLI.new.call
data/lib/alert.rb CHANGED
@@ -1,6 +1,6 @@
1
- class Alert
2
-
3
- attr_accessor :title, :summary, :readmore
4
-
5
-
6
- end
1
+ class Alert
2
+
3
+ attr_accessor :title, :summary, :readmore
4
+
5
+
6
+ end
@@ -1,82 +1,82 @@
1
- require_relative '../scrape_notice'
2
- require_relative '../notice.rb'
3
- require 'launchy'
4
- class CdcNotices::CLI
5
-
6
-
7
-
8
- def initialize
9
- puts "Welcome to the CDC Notice Library."
10
- site = Scraper.new("https://wwwnc.cdc.gov/travel/notices")
11
- @notice = site.set_attributes
12
-
13
- end
14
-
15
- def call
16
-
17
- input = ""
18
- while input != "exit"
19
- puts "What would you like to do?"
20
- puts "Press help for a list of commands"
21
- input = gets.strip
22
- case input
23
- when "help"
24
- puts "*****************************"
25
- puts "all: Display all notices"
26
- puts "alerts: Display alerts only."
27
- puts "warnings: Display warnings only."
28
- puts "watches: Display watches only."
29
- puts "readmore: open readmore in browser. 'readmore' press enter then enter the number corresponding to the notice you want"
30
- puts "exit: exit the application"
31
- puts "******************************"
32
- when "all"
33
- all_notices
34
- when "alerts"
35
- alert_notices
36
- when "warnings"
37
- warning_notices
38
- when "watches"
39
- watch_notices
40
- when "readmore"
41
- readmore
42
- when "exit"
43
- puts "Goodbye"
44
- break
45
- else
46
- end
47
- end
48
- end
49
-
50
-
51
- def readmore
52
- puts "Which notice would you like to read?"
53
- input = gets.strip
54
- input = input.to_i - 1
55
- Launchy.open("#{@notice.notices[input].readmore}")
56
-
57
-
58
- end
59
-
60
- def all_notices
61
- @notice.display_notices
62
- end
63
-
64
- def alert_notices
65
- @notice.display_alerts
66
- end
67
-
68
- def warning_notices
69
- @notice.display_warnings
70
- end
71
-
72
- def watch_notices
73
- @notice.display_watches
74
- end
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
- end
1
+ require_relative '../scrape_notice'
2
+ require_relative '../notice.rb'
3
+ require 'launchy'
4
+ class CdcNotices::CLI
5
+
6
+
7
+
8
+ def initialize
9
+ puts "Welcome to the CDC Notice Library."
10
+ site = Scraper.new("https://wwwnc.cdc.gov/travel/notices")
11
+ @notice = site.set_attributes
12
+
13
+ end
14
+
15
+ def call
16
+
17
+ input = ""
18
+ while input != "exit"
19
+ puts "What would you like to do?"
20
+ puts "Press help for a list of commands"
21
+ input = gets.strip
22
+ case input
23
+ when "help"
24
+ puts "*****************************"
25
+ puts "all: Display all notices"
26
+ puts "alerts: Display alerts only."
27
+ puts "warnings: Display warnings only."
28
+ puts "watches: Display watches only."
29
+ puts "readmore: open readmore in browser. 'readmore' press enter then enter the number corresponding to the notice you want"
30
+ puts "exit: exit the application"
31
+ puts "******************************"
32
+ when "all"
33
+ all_notices
34
+ when "alerts"
35
+ alert_notices
36
+ when "warnings"
37
+ warning_notices
38
+ when "watches"
39
+ watch_notices
40
+ when "readmore"
41
+ readmore
42
+ when "exit"
43
+ puts "Goodbye"
44
+ break
45
+ else
46
+ end
47
+ end
48
+ end
49
+
50
+
51
+ def readmore
52
+ puts "Which notice would you like to read?"
53
+ input = gets.strip
54
+ input = input.to_i - 1
55
+ Launchy.open("#{@notice.notices[input].readmore}")
56
+
57
+
58
+ end
59
+
60
+ def all_notices
61
+ @notice.display_notices
62
+ end
63
+
64
+ def alert_notices
65
+ @notice.display_alerts
66
+ end
67
+
68
+ def warning_notices
69
+ @notice.display_warnings
70
+ end
71
+
72
+ def watch_notices
73
+ @notice.display_watches
74
+ end
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+ end
@@ -1,3 +1,3 @@
1
- module CdcNotices
2
- VERSION = "0.1.1" #still working, but pushed to ruby gems.
3
- end
1
+ module CdcNotices
2
+ VERSION = "0.1.2" #still working, but pushed to ruby gems.
3
+ end
data/lib/cdc_notices.rb CHANGED
@@ -1,7 +1,7 @@
1
- require_relative "./cdc_notices/version"
2
- require_relative "./cdc_notices/cli"
3
- module CdcNotices
4
-
5
-
6
-
7
- end
1
+ require_relative "./cdc_notices/version"
2
+ require_relative "./cdc_notices/cli"
3
+ module CdcNotices
4
+
5
+
6
+
7
+ end
data/lib/notice.rb CHANGED
@@ -1,109 +1,109 @@
1
- require_relative 'scrape_notice.rb'
2
- class Notice
3
-
4
- attr_accessor :notice_date
5
-
6
- def initialize
7
- @notices = []
8
- @alert_notices = []
9
- @warning_notices = []
10
- @watch_notices = []
11
- end
12
-
13
- def display_notices
14
- if self.notices.empty?
15
- puts "***************************"
16
- puts "There are no current notices."
17
- puts "***************************"
18
- else
19
- self.notices.each.with_index(1) do |notice,i|
20
- puts "**************************"
21
- puts "#{i}. #{notice.title}"
22
- puts notice.summary
23
- puts notice.readmore
24
- end
25
- end
26
- end
27
-
28
- def display_alerts
29
- if self.alerts.empty?
30
- puts "***************************"
31
- puts "There are no current alerts."
32
- puts "***************************"
33
- else
34
- self.alerts.each.with_index(1) do |notice,i|
35
- puts "**************************"
36
- puts "#{i}. #{notice.title}"
37
- puts notice.summary
38
- puts notice.readmore
39
- end
40
- end
41
- end
42
-
43
- def display_warnings
44
- if self.warnings.empty?
45
- puts "***************************"
46
- puts "There are no current warnings."
47
- puts "***************************"
48
- else
49
- self.warnings.each.with_index(1) do |notice,i|
50
- puts "**************************"
51
- puts "#{i}. #{notice.title}"
52
- puts notice.summary
53
- puts notice.readmore
54
- end
55
- end
56
- end
57
-
58
- def display_watches
59
- if self.watches.empty?
60
- puts "***************************"
61
- puts "There are no current watches."
62
- puts "***************************"
63
- else
64
- self.watches.each.with_index(1) do |notice,i|
65
- puts "**************************"
66
- puts "#{i}. #{notice.title}"
67
- puts notice.summary
68
- puts notice.readmore
69
- end
70
- end
71
- end
72
-
73
-
74
-
75
- def notices
76
- @notices
77
- end
78
-
79
- def alerts
80
- @alert_notices
81
- end
82
-
83
- def warnings
84
- @warning_notices
85
- end
86
-
87
- def watches
88
- @watch_notices
89
- end
90
-
91
-
92
- def add_alert(alert)
93
- @notices << alert
94
- @alert_notices << alert
95
- end
96
-
97
- def add_watch(watch)
98
- @notices << watch
99
- @watch_notices << watch
100
- end
101
-
102
- def add_warning(warning)
103
- @notices << warning
104
- @warning_notices << warning
105
- end
106
-
107
-
108
-
109
- end
1
+ require_relative 'scrape_notice.rb'
2
+ class Notice
3
+
4
+ attr_accessor :notice_date
5
+
6
+ def initialize
7
+ @notices = []
8
+ @alert_notices = []
9
+ @warning_notices = []
10
+ @watch_notices = []
11
+ end
12
+
13
+ def display_notices
14
+ if self.notices.empty?
15
+ puts "***************************"
16
+ puts "There are no current notices."
17
+ puts "***************************"
18
+ else
19
+ self.notices.each.with_index(1) do |notice,i|
20
+ puts "**************************"
21
+ puts "#{i}. #{notice.title}"
22
+ puts notice.summary
23
+ puts notice.readmore
24
+ end
25
+ end
26
+ end
27
+
28
+ def display_alerts
29
+ if self.alerts.empty?
30
+ puts "***************************"
31
+ puts "There are no current alerts."
32
+ puts "***************************"
33
+ else
34
+ self.alerts.each.with_index(1) do |notice,i|
35
+ puts "**************************"
36
+ puts "#{i}. #{notice.title}"
37
+ puts notice.summary
38
+ puts notice.readmore
39
+ end
40
+ end
41
+ end
42
+
43
+ def display_warnings
44
+ if self.warnings.empty?
45
+ puts "***************************"
46
+ puts "There are no current warnings."
47
+ puts "***************************"
48
+ else
49
+ self.warnings.each.with_index(1) do |notice,i|
50
+ puts "**************************"
51
+ puts "#{i}. #{notice.title}"
52
+ puts notice.summary
53
+ puts notice.readmore
54
+ end
55
+ end
56
+ end
57
+
58
+ def display_watches
59
+ if self.watches.empty?
60
+ puts "***************************"
61
+ puts "There are no current watches."
62
+ puts "***************************"
63
+ else
64
+ self.watches.each.with_index(1) do |notice,i|
65
+ puts "**************************"
66
+ puts "#{i}. #{notice.title}"
67
+ puts notice.summary
68
+ puts notice.readmore
69
+ end
70
+ end
71
+ end
72
+
73
+
74
+
75
+ def notices
76
+ @notices
77
+ end
78
+
79
+ def alerts
80
+ @alert_notices
81
+ end
82
+
83
+ def warnings
84
+ @warning_notices
85
+ end
86
+
87
+ def watches
88
+ @watch_notices
89
+ end
90
+
91
+
92
+ def add_alert(alert)
93
+ @notices << alert
94
+ @alert_notices << alert
95
+ end
96
+
97
+ def add_watch(watch)
98
+ @notices << watch
99
+ @watch_notices << watch
100
+ end
101
+
102
+ def add_warning(warning)
103
+ @notices << warning
104
+ @warning_notices << warning
105
+ end
106
+
107
+
108
+
109
+ end
data/lib/scrape_notice.rb CHANGED
@@ -1,93 +1,93 @@
1
- require 'open-uri'
2
- require 'nokogiri'
3
- require 'openssl'
4
-
5
- require_relative 'notice.rb'
6
- require_relative 'alert.rb'
7
- require_relative 'watch.rb'
8
- require_relative 'warning.rb'
9
- class Scraper
10
-
11
- attr_accessor :url
12
-
13
- def initialize(url)
14
- @url = url
15
- @notice = Notice.new
16
-
17
- end
18
-
19
- def get_page
20
- html = open(@url, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE)
21
- doc = Nokogiri::HTML(html)
22
-
23
- end
24
-
25
- def set_attributes
26
- array_alert = []
27
- array_watch = []
28
- array_warning = []
29
- main_content = self.get_page.css('#contentArea')
30
-
31
- notice_hash = {:alert => main_content.css('#alert'), :watch => main_content.css('#watch'), :warning => main_content.css('#warning')}
32
-
33
- alerts = notice_hash[:alert].collect {|alert| alert.css('li')}
34
-
35
- if alerts[0] != nil
36
- alerts[0].each do |alert|
37
- array_alert << alert
38
- end
39
- end
40
-
41
-
42
- watches = notice_hash[:watch].collect {|watch| watch.css('li')}
43
- if watches[0] != nil
44
- watches[0].each do |watch|
45
- array_watch << watch
46
- end
47
- end
48
-
49
- warnings = notice_hash[:warning].collect {|warning| warning.css('li')}
50
- if warnings[0] != nil
51
- warnings[0].each do |warning|
52
- array_warning << warning
53
- end
54
- end
55
-
56
- array_alert.each do |alert|
57
- new_alert = Alert.new
58
- new_alert.title = alert.css('a:not(.readmore)').text
59
- new_alert.summary = alert.css('span').text
60
- new_alert.readmore = "#{@url.gsub(/\/travel\/notices/, "")}#{alert.css('a').attr('href').text}"
61
-
62
- @notice.add_alert(new_alert)
63
- end
64
-
65
- array_watch.each do |watch|
66
- new_watch = Watch.new
67
- new_watch.title = watch.css('a:not(.readmore)').text
68
- new_watch.summary = watch.css('span').text
69
- new_watch.readmore = "#{@url.gsub(/\/travel\/notices/, "")}#{watch.css('a').attr('href').text}"
70
- @notice.add_watch(new_watch)
71
- end
72
-
73
- array_warning.each do |warn|
74
- new_warning = Warning.new
75
- new_warning.title = warn.css('a:not(.readmore)').text
76
- new_warning.summary = warn.css('span').text
77
- new_warning.readmore = "#{@url.gsub(/\/travel\/notices/, "")}#{warn.css('a').attr('href').text}"
78
- @notice.add_warning(new_warning)
79
- end
80
-
81
- @notice
82
-
83
-
84
-
85
- end
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
- end
1
+ require 'open-uri'
2
+ require 'nokogiri'
3
+ require 'openssl'
4
+
5
+ require_relative 'notice.rb'
6
+ require_relative 'alert.rb'
7
+ require_relative 'watch.rb'
8
+ require_relative 'warning.rb'
9
+ class Scraper
10
+
11
+ attr_accessor :url
12
+
13
+ def initialize(url)
14
+ @url = url
15
+ @notice = Notice.new
16
+
17
+ end
18
+
19
+ def get_page
20
+ html = open(@url, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE)
21
+ doc = Nokogiri::HTML(html)
22
+
23
+ end
24
+
25
+ def set_attributes
26
+ array_alert = []
27
+ array_watch = []
28
+ array_warning = []
29
+ main_content = self.get_page.css('#contentArea')
30
+
31
+ notice_hash = {:alert => main_content.css('#alert'), :watch => main_content.css('#watch'), :warning => main_content.css('#warning')}
32
+
33
+ alerts = notice_hash[:alert].collect {|alert| alert.css('li')}
34
+
35
+ if alerts[0] != nil
36
+ alerts[0].each do |alert|
37
+ array_alert << alert
38
+ end
39
+ end
40
+
41
+
42
+ watches = notice_hash[:watch].collect {|watch| watch.css('li')}
43
+ if watches[0] != nil
44
+ watches[0].each do |watch|
45
+ array_watch << watch
46
+ end
47
+ end
48
+
49
+ warnings = notice_hash[:warning].collect {|warning| warning.css('li')}
50
+ if warnings[0] != nil
51
+ warnings[0].each do |warning|
52
+ array_warning << warning
53
+ end
54
+ end
55
+
56
+ array_alert.each do |alert|
57
+ new_alert = Alert.new
58
+ new_alert.title = alert.css('a:not(.readmore)').text
59
+ new_alert.summary = alert.css('span').text
60
+ new_alert.readmore = "#{@url.gsub(/\/travel\/notices/, "")}#{alert.css('a').attr('href').text}"
61
+
62
+ @notice.add_alert(new_alert)
63
+ end
64
+
65
+ array_watch.each do |watch|
66
+ new_watch = Watch.new
67
+ new_watch.title = watch.css('a:not(.readmore)').text
68
+ new_watch.summary = watch.css('span').text
69
+ new_watch.readmore = "#{@url.gsub(/\/travel\/notices/, "")}#{watch.css('a').attr('href').text}"
70
+ @notice.add_watch(new_watch)
71
+ end
72
+
73
+ array_warning.each do |warn|
74
+ new_warning = Warning.new
75
+ new_warning.title = warn.css('a:not(.readmore)').text
76
+ new_warning.summary = warn.css('span').text
77
+ new_warning.readmore = "#{@url.gsub(/\/travel\/notices/, "")}#{warn.css('a').attr('href').text}"
78
+ @notice.add_warning(new_warning)
79
+ end
80
+
81
+ @notice
82
+
83
+
84
+
85
+ end
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+ end
data/lib/warning.rb CHANGED
@@ -1,4 +1,4 @@
1
- class Warning
2
-
3
- attr_accessor :title, :summary, :readmore
4
- end
1
+ class Warning
2
+
3
+ attr_accessor :title, :summary, :readmore
4
+ end
data/lib/watch.rb CHANGED
@@ -1,5 +1,5 @@
1
- class Watch
2
-
3
- attr_accessor :title, :summary, :readmore
4
-
5
- end
1
+ class Watch
2
+
3
+ attr_accessor :title, :summary, :readmore
4
+
5
+ end
data/spec.md CHANGED
@@ -1,6 +1,6 @@
1
- # Specifications for the CLI Assessment
2
-
3
- Specs:
4
- - [x] Have a CLI for interfacing with the application
5
- - [x] Pull data from an external source
6
- - [x] Implement both list and detail views
1
+ # Specifications for the CLI Assessment
2
+
3
+ Specs:
4
+ - [x] Have a CLI for interfacing with the application
5
+ - [x] Pull data from an external source
6
+ - [x] Implement both list and detail views
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cdc_notices
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - tahbristol
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-06 00:00:00.000000000 Z
11
+ date: 2017-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -97,7 +97,8 @@ dependencies:
97
97
  description:
98
98
  email:
99
99
  - tahbristol@gmail.com
100
- executables: []
100
+ executables:
101
+ - cdc-notices
101
102
  extensions: []
102
103
  extra_rdoc_files: []
103
104
  files:
@@ -114,6 +115,7 @@ files:
114
115
  - bin/console
115
116
  - bin/setup
116
117
  - cdc_notices.gemspec
118
+ - exe/cdc-notices
117
119
  - lib/alert.rb
118
120
  - lib/cdc_notices.rb
119
121
  - lib/cdc_notices/cli.rb
@@ -143,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
145
  version: '0'
144
146
  requirements: []
145
147
  rubyforge_project:
146
- rubygems_version: 2.5.2
148
+ rubygems_version: 2.6.11
147
149
  signing_key:
148
150
  specification_version: 4
149
151
  summary: Displays currrent infectious disease travel notices from the Centers for