phl-covid-testing 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5dde0b3b4fc6898cabb7ef68703a106e1c2f903f20b4a02f759e738fd607a993
4
- data.tar.gz: fd5e61d6a36bace6597630fa969af059915bb0697ec50c45e9986ec6a870cedd
3
+ metadata.gz: 3e3564c1aeb3e879da656d32bae2358d1da71e17f4ac25f35c416de1a16ca6b5
4
+ data.tar.gz: e5c101a4c4788b938d148479873c02dbe18239044655766185bb6ae3435fcfe9
5
5
  SHA512:
6
- metadata.gz: 63a17b46ba002c6e8415660690d7045771c7fdcb4093d23bd48ec20c903df33d79b72dccd9d0f3e6350d9b903782595a631ba91da3f838ceb736f57711e8a156
7
- data.tar.gz: 950dfcf491ed47481a67c6bf0bc928969a40d805da3d9c1a83473c3875b30337eec4ac6dda2dbd2c3f316a907c8e4c2b3f8521b2a07824977397654fa8b00c79
6
+ metadata.gz: 4fc1a6cd34c3c649228c3c675862d800c96d41e7d255695c1b59d313f77db56ef7cb505f967318de9a641ae093ce82c5630bedadd8925cd654b319e4e6b8d456
7
+ data.tar.gz: 140ad762cf157d2fde9d5b2c2897a3b68e9f5ffa5a7e4b32b98eea276b816df2fe0eb885de39929589213b240eee582bf8c59849e22dc398dbb5a17a8b67a4f0
data/README.md CHANGED
@@ -11,7 +11,7 @@ Find and view details about COVID-19 testing locations located in Philadelphia,
11
11
  Add this line to your application's Gemfile:
12
12
 
13
13
  ```ruby
14
- gem 'phl_covid_testing'
14
+ gem 'phl-covid-testing'
15
15
  ```
16
16
 
17
17
  And then execute:
@@ -20,7 +20,12 @@ And then execute:
20
20
 
21
21
  Or install it yourself as:
22
22
 
23
- $ gem install phl_covid_testing
23
+ $ gem install phl-covid-testing
24
+
25
+ You can then begin the application by executing:
26
+
27
+ $ phl-covid-testing
28
+
24
29
 
25
30
  ## Usage
26
31
 
@@ -46,12 +51,6 @@ Enter 'walk' to view all testing locations offering walk-up services, and 'drive
46
51
 
47
52
  Enter 'all' to view a list of all testing locations.
48
53
 
49
- ## Development
50
-
51
- 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.
52
-
53
- 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).
54
-
55
54
  ## Contributing
56
55
 
57
56
  Bug reports and pull requests are welcome on GitHub at https://github.com/bfirestone23/phl_covid_testing. 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.
data/bin/console CHANGED
@@ -1,14 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "./lib/environment"
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
3
+ require "phl-covid-testing"
12
4
 
13
5
  require "irb"
14
6
  IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -4,5 +4,3 @@ IFS=$'\n\t'
4
4
  set -vx
5
5
 
6
6
  bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -3,7 +3,9 @@ module Displayable
3
3
  def display_all
4
4
  PHLCovidTesting::TestingLocation.all.each.with_index(1) {|x, i| puts "\n#{i}. #{x.name}"}
5
5
  all_sites = PHLCovidTesting::TestingLocation.all
6
- puts "\nEnter a number to learn more about a testing location, 'main' to return to the main menu, or 'exit' to end the program.\n".colorize(:yellow)
6
+ puts "\nEnter a number to learn more about a testing location,
7
+ 'main' to return to the main menu,
8
+ or 'exit' to end the program.\n".colorize(:yellow)
7
9
  get_input_all(all_sites)
8
10
  end
9
11
 
@@ -1,9 +1,9 @@
1
1
  module Findable
2
2
  module InstanceMethods
3
3
  def search_by_zipcode(input)
4
- results = PHLCovidTesting::TestingLocation.all.map.with_index(1) do |x, i|
5
- x if x.zipcode.to_s == input
6
- end.compact
4
+ results = PHLCovidTesting::TestingLocation.all.select do |location|
5
+ location.zipcode.to_s == input
6
+ end
7
7
 
8
8
  if results.length == 0
9
9
  puts "\nNo match found. Please try again.\n".colorize(:red)
@@ -14,15 +14,17 @@ module Findable
14
14
  get_input_main_options
15
15
  else
16
16
  results.each.with_index(1) {|x, i| puts "\n#{i}. #{x.name}"}
17
- puts "\nEnter another number to see location details, 'all' to see the full list of locations, 'main' to return to the main menu,\nor 'exit' to end the program.\n".colorize(:yellow)
17
+ puts "\nEnter another number to see location details,
18
+ 'all' to see the full list of locations,
19
+ 'main' to return to the main menu,
20
+ \nor 'exit' to end the program.\n".colorize(:yellow)
18
21
  get_input_sub(results)
19
22
  end
20
23
  end
21
24
 
22
25
  def search_by_name(input)
23
- results = []
24
- PHLCovidTesting::TestingLocation.all.each.with_index(1) do |x, i|
25
- results << x if x.name.downcase.include?(input)
26
+ results = PHLCovidTesting::TestingLocation.all.select do |location|
27
+ location.name.downcase[input.downcase]
26
28
  end
27
29
 
28
30
  if results.length == 0
@@ -34,7 +36,10 @@ module Findable
34
36
  get_input_main_options
35
37
  else
36
38
  results.each.with_index(1) {|x, i| puts "\n#{i}. #{x.name}"}
37
- puts "\nEnter another number to see location details, 'all' to see the full list of locations, 'main' to return to the main menu,\nor 'exit' to end the program.\n".colorize(:yellow)
39
+ puts "\nEnter another number to see location details,
40
+ 'all' to see the full list of locations,
41
+ 'main' to return to the main menu,
42
+ \nor 'exit' to end the program.\n".colorize(:yellow)
38
43
  get_input_sub(results)
39
44
  end
40
45
  end
@@ -48,9 +53,8 @@ module Findable
48
53
  end
49
54
 
50
55
  def search_by_access(input)
51
- results = []
52
- PHLCovidTesting::TestingLocation.all.each.with_index(1) do |x, i|
53
- results << x if x.access_type.downcase.include?(input)
56
+ results = PHLCovidTesting::TestingLocation.all.select do |location|
57
+ location.access_type.downcase[input.downcase]
54
58
  end
55
59
 
56
60
  if results.length == 0
@@ -62,7 +66,10 @@ module Findable
62
66
  get_input_main_options
63
67
  else
64
68
  results.each.with_index(1) {|x, i| puts "\n#{i}. #{x.name}"}
65
- puts "\nEnter another number to see location details, 'all' to see the full list of locations, 'main' to return to the main menu,\nor 'exit' to end the program.\n".colorize(:yellow)
69
+ puts "\nEnter another number to see location details,
70
+ 'all' to see the full list of locations,
71
+ 'main' to return to the main menu,
72
+ \nor 'exit' to end the program.\n".colorize(:yellow)
66
73
  get_input_sub(results)
67
74
  end
68
75
  end
@@ -54,7 +54,10 @@ module Inputable
54
54
  get_input_sub(result_array)
55
55
  else
56
56
  display_detail(result_array[input.to_i - 1])
57
- puts "\nEnter another number to see location details, 'all' to see the full list, 'main' to return to the main menu,\nor 'exit' to end the program.\n".colorize(:yellow)
57
+ puts "\nEnter another number to see location details,
58
+ 'all' to see the full list,
59
+ 'main' to return to the main menu,
60
+ \nor 'exit' to end the program.\n".colorize(:yellow)
58
61
  get_input_sub(result_array)
59
62
  end
60
63
  end
@@ -75,7 +78,10 @@ module Inputable
75
78
  display_all
76
79
  else
77
80
  display_detail(all_sites[input.to_i - 1])
78
- puts "\nEnter another number to see location details, 'all' to see the full list again, 'main' to return to the main menu,\nor 'exit' to end the program.\n".colorize(:yellow)
81
+ puts "\nEnter another number to see location details,
82
+ 'all' to see the full list again,
83
+ 'main' to return to the main menu,
84
+ \nor 'exit' to end the program.\n".colorize(:yellow)
79
85
  get_input_sub(all_sites)
80
86
  end
81
87
  end
@@ -4,16 +4,5 @@ require 'open-uri'
4
4
  require 'json'
5
5
  require 'net/http'
6
6
 
7
- require_relative "./concerns/Displayable"
8
- require_relative "./concerns/Findable"
9
- require_relative "./concerns/Inputable"
10
-
11
- require_relative "./phl_covid_testing/version"
12
- require_relative "./phl_covid_testing/cli"
13
- require_relative "./phl_covid_testing/api"
14
- require_relative "./phl_covid_testing/testing_location"
15
-
16
-
17
- module PHLCovidTesting
18
- class Error < StandardError; end
19
- end
7
+ require_relative "./concerns"
8
+ require_relative "./phl_covid_testing"
@@ -5,7 +5,9 @@ class PHLCovidTesting::CLI
5
5
 
6
6
  def call
7
7
  create_sites
8
- puts "\nWelcome to the Philadelphia COVID-19 Testing Finder!\nAll data provided by OpenDataPhilly at: https://www.opendataphilly.org/dataset/covid-19-test-sites".colorize(:yellow)
8
+ puts "\nWelcome to the Philadelphia COVID-19 Testing Finder!
9
+ \nAll data provided by OpenDataPhilly at:
10
+ https://www.opendataphilly.org/dataset/covid-19-test-sites".colorize(:yellow)
9
11
  get_input_main_options
10
12
  end
11
13
 
@@ -8,6 +8,7 @@ class PHLCovidTesting::TestingLocation
8
8
  @@all = []
9
9
 
10
10
  def initialize(hash)
11
+ binding.pry
11
12
  hash.each do |k, v|
12
13
  self.send(("#{k}="), v)
13
14
  end
@@ -1,3 +1,3 @@
1
1
  module PHLCovidTesting
2
- VERSION = "0.1.9"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phl-covid-testing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Firestone
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-02 00:00:00.000000000 Z
11
+ date: 2021-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler