UrgentcareCLI 0.1.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/UrgentCare/CLI.rb +56 -17
- data/lib/UrgentCare/Office.rb +1 -5
- data/lib/UrgentCare/Scraper.rb +78 -0
- data/lib/UrgentCare/version.rb +2 -2
- data/lib/UrgentCare.rb +5 -1
- metadata +19 -34
- data/.gitignore +0 -11
- data/.rspec +0 -3
- data/.travis.yml +0 -5
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -9
- data/Gemfile.lock +0 -49
- data/LICENSE.txt +0 -21
- data/Notes +0 -41
- data/README.md +0 -41
- data/Rakefile +0 -6
- data/UrgentCare.gemspec +0 -39
- data/data.txt +0 -4
- data/lib/Urgentcare/Scraper.rb +0 -36
- data/spec.md +0 -6
- data/test.data +0 -2110
data/data.txt
DELETED
data/lib/Urgentcare/Scraper.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
class Urgentcare::Scraper
|
2
|
-
|
3
|
-
def get_page # page that lists clinics in Boston and surrounding area
|
4
|
-
@doc = Nokogiri::HTML(open('https://www.carewellurgentcare.com/locations/'))
|
5
|
-
end
|
6
|
-
|
7
|
-
def get_clinics
|
8
|
-
url_array = []
|
9
|
-
digits_array = []
|
10
|
-
get_page.css('.et_pb_column_1_4').each_with_index do |location, index|
|
11
|
-
if index.odd?
|
12
|
-
url_array.push(location)
|
13
|
-
else
|
14
|
-
digits_array.push(location)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
merge_arrays(digits_array, url_array)
|
18
|
-
end
|
19
|
-
|
20
|
-
def merge_arrays(digits_array, url_array)
|
21
|
-
digits_array[0..16].zip(url_array[0..16]).each_with_index do |office_details, index|
|
22
|
-
make_office(office_details)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def make_office(office_details)
|
27
|
-
office = Urgentcare::Office.new
|
28
|
-
office.name = office_details[0].css('strong').text.strip.tr("\n", ' ').gsub('Next Available:', ', ').gsub(' MA, ', ' ').gsub(' MA ,', ' ').gsub(' RI, ', ', ').strip.split(',')[0]
|
29
|
-
office.url = office_details[1].css('a')[1]['href']
|
30
|
-
office.phone_number = office_details[0].css('a[href]').text
|
31
|
-
doc_d = Nokogiri::HTML(open("https://www.carewellurgentcare.com#{office.url}"))
|
32
|
-
doc_i = doc_d.css('.locat').attr('src').text
|
33
|
-
doc_n = Nokogiri::HTML(open(doc_i.to_s))
|
34
|
-
office.next_available = doc_n.css('.panel-heading').text.strip.gsub("\r\n", ' ').split(',')[0]
|
35
|
-
end
|
36
|
-
end
|
data/spec.md
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
Specifications for the CLI Assessment
|
2
|
-
Specs:
|
3
|
-
|
4
|
-
X Have a CLI for interfacing with the application - CLI accesses list and detail view based on user input.
|
5
|
-
X Pull data from an external source - pulls data from the Carewell Urgentcare website with locations across Massachusetts. Pulls data from main page and individual office pages.
|
6
|
-
X Implement both list and detail views - the list view displays all available offices and the detail view gives specific details on one individual office.
|