UrgentcareCLI 0.2.5 → 0.2.6
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 +11 -10
- data/lib/UrgentCare/Scraper.rb +28 -15
- data/lib/UrgentCare/version.rb +1 -1
- data/lib/UrgentCare.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bddaa4f1acd7c513c6416f936fb9274a9539357ce79e2bf042197040ab7fd360
|
4
|
+
data.tar.gz: 457704c574b44fb44e63545a52e8f851c702ab58429997060897e5675f8e53b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f18f00d2644fd64c8e062c4acec31f48b595a7b419cb5e166ad3028bf90236a5b3ac6757d12e9eb938dda55ca469c1c7f86d13878976e16271fdd6c9374c3f32
|
7
|
+
data.tar.gz: a15fa89db3c04862c6e5af34df56c46f8eec21925104e7c43dd7d0872d539f7b22093a01b8df1ffa8605a6294830e38180a767f4814bbe52108be5828262838d
|
data/lib/UrgentCare/CLI.rb
CHANGED
@@ -26,6 +26,14 @@ class Urgentcare::CLI
|
|
26
26
|
office_list
|
27
27
|
end
|
28
28
|
|
29
|
+
def loading_message
|
30
|
+
puts " "
|
31
|
+
puts "Retrieving data...."
|
32
|
+
puts "Loading......"
|
33
|
+
puts "............."
|
34
|
+
puts " "
|
35
|
+
end
|
36
|
+
|
29
37
|
def office_list
|
30
38
|
@scraper.get_office_list
|
31
39
|
puts "Please choose a number from the following list for details on
|
@@ -35,7 +43,7 @@ class Urgentcare::CLI
|
|
35
43
|
puts "#{i + 1}. #{office.name}"
|
36
44
|
end
|
37
45
|
list
|
38
|
-
|
46
|
+
end
|
39
47
|
|
40
48
|
def list
|
41
49
|
puts " "
|
@@ -46,6 +54,7 @@ class Urgentcare::CLI
|
|
46
54
|
location = location.to_i
|
47
55
|
$index = location - 1
|
48
56
|
loading_message
|
57
|
+
@scraper.get_clinic_site
|
49
58
|
office_details
|
50
59
|
else
|
51
60
|
puts "Invalid response"
|
@@ -60,7 +69,7 @@ class Urgentcare::CLI
|
|
60
69
|
puts "---"
|
61
70
|
puts "Office Name: #{@offices[$index].name}"
|
62
71
|
puts "Office Number: #{@offices[$index].phone_number}"
|
63
|
-
puts "
|
72
|
+
puts "Appointment URL: #{@offices[$index].url}"
|
64
73
|
puts "Office Next Available Appointment: #{@offices[$index].next_available}"
|
65
74
|
puts "---"
|
66
75
|
puts " "
|
@@ -84,12 +93,4 @@ class Urgentcare::CLI
|
|
84
93
|
list
|
85
94
|
end
|
86
95
|
|
87
|
-
def loading_message
|
88
|
-
puts " "
|
89
|
-
puts "Retrieving data...."
|
90
|
-
puts "Loading......"
|
91
|
-
puts "............."
|
92
|
-
puts " "
|
93
|
-
end
|
94
|
-
|
95
96
|
end
|
data/lib/UrgentCare/Scraper.rb
CHANGED
@@ -16,7 +16,7 @@ class Urgentcare::Scraper
|
|
16
16
|
end
|
17
17
|
|
18
18
|
@@client = Selenium::WebDriver::Remote::Http::Default.new #class variable
|
19
|
-
@@client.read_timeout =
|
19
|
+
@@client.read_timeout = 6000 # seconds – default is 60
|
20
20
|
|
21
21
|
@@browser = Watir::Browser.new :chrome, headless: true, http_client: @@client
|
22
22
|
send_cmd(@@browser.driver, "Network.setBlockedURLs", {'urls': ["*careuc.netmng.com*"]}) #url pending when page loads
|
@@ -32,35 +32,48 @@ class Urgentcare::Scraper
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def get_office_list #called first in CLI
|
35
|
-
@new_page = get_page.css('
|
35
|
+
@new_page = get_page.css('div.centers-list')
|
36
36
|
office_url
|
37
37
|
end
|
38
38
|
|
39
39
|
def office_url
|
40
40
|
@new_page.each do |office_details| #does not create additional objects. returns original object
|
41
|
-
@@url << office_details
|
42
41
|
@office_details = office_details
|
43
42
|
make_office
|
44
43
|
end
|
45
44
|
end
|
46
45
|
|
46
|
+
def get_clinic_site
|
47
|
+
if @@url[$index].url != "Not available"
|
48
|
+
@@browser.goto(@@url[$index].url)
|
49
|
+
@js_doc = @@browser.iframe.wait_until(&:present?)
|
50
|
+
get_appttime_date
|
51
|
+
else
|
52
|
+
get_appttime_date
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
47
56
|
def make_office
|
48
57
|
@off = @office.new
|
49
|
-
@off.name = @office_details.css('
|
50
|
-
|
51
|
-
|
58
|
+
@off.name = @office_details.css('div.center-name').text
|
59
|
+
if @office_details.css('div.center-appointment').css('a').count > 1
|
60
|
+
@off.url = @office_details.css('div.center-appointment').css('a[href]')[1].values[1]
|
61
|
+
else
|
62
|
+
@off.url = "Not available"
|
63
|
+
end
|
64
|
+
@off.phone_number = @office_details.css('div.center-address').css('a').text
|
65
|
+
@@url << @off
|
52
66
|
end
|
53
67
|
|
54
68
|
def get_appttime_date #retrieve waittime and add to new office model
|
55
|
-
sleep(
|
56
|
-
|
57
|
-
|
58
|
-
@wait_day = iframe_info.css('div.
|
59
|
-
@wait_time = iframe_info.css('div.time-slot
|
60
|
-
|
61
|
-
else
|
62
|
-
|
63
|
-
@office.all[$index].next_available = "#{@wait_time}"
|
69
|
+
sleep(5);
|
70
|
+
if @@url[$index].url != "Not available"
|
71
|
+
iframe_info = Nokogiri::HTML(@js_doc.html)
|
72
|
+
@wait_day = iframe_info.css('div.calendar').css('div.header').text
|
73
|
+
@wait_time = iframe_info.css('div.row').css('div.time-slot')[0].text
|
74
|
+
@@url[$index].next_available = "#{@wait_day} #{@wait_time}"
|
75
|
+
else
|
76
|
+
@@url[$index].next_available = "Not available"
|
64
77
|
end
|
65
78
|
end
|
66
79
|
|
data/lib/UrgentCare/version.rb
CHANGED
data/lib/UrgentCare.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: UrgentcareCLI
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PamelaTorres-Rocca
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|