UrgentcareCLI 0.1.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/data.txt DELETED
@@ -1,4 +0,0 @@
1
- def get_page #page that lists clinics in Boston and surrounding area
2
- @doc = Nokogiri::HTML(open("https://www.carewellurgentcare.com/locations/"))
3
- end
4
- get_page
@@ -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.