-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
25 lines (21 loc) · 734 Bytes
/
Rakefile
File metadata and controls
25 lines (21 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
load 'lib/dominion-power-scraper.rb'
namespace :scraper do
task :scrape do
# navigate to the correct page
d = DominionPower::Driver.new
d.visit_dominion_power
d.login(ENV['username'], ENV['password'])
d.goto_payment_history
# scraper bill info
scraper = DominionPower::Scraper.new d.driver
scraper.get_latest_bill_info
# get energy info
d.goto_energy_usage
scraper.get_energy_usage
# output everything
puts "Energy usage was #{scraper.usage[:usage]}"
puts "This was measured from #{scraper.usage[:service_start_date]} to #{scraper.bill[:service_end_date]}"
puts "Your bill is #{scraper.bill[:bill_amount]}"
puts "It is due on #{scraper.bill[:due_date]}"
end
end