Class: MypageTools::CLI
- Inherits:
-
Object
- Object
- MypageTools::CLI
- Defined in:
- lib/mypage_tools/cli.rb
Class Method Summary collapse
Class Method Details
.help ⇒ Object
hahaha
34 35 36 37 38 39 40 41 |
# File 'lib/mypage_tools/cli.rb', line 34 def self.help # hahaha puts "" puts "The only implemented feature currently is getting your schedule" puts "" puts "USAGE:" puts "\tmypage schedule" puts "" end |
.parse_options(args = ARGV) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/mypage_tools/cli.rb', line 3 def self. args=ARGV case args[0] when "schedule" schedule when "help" self.help else puts "\nUnkown Argument\n" self.help end end |
.schedule ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/mypage_tools/cli.rb', line 15 def self.schedule print `clear` puts "In order to get your work schedule you need to provide your login and password for myPage." print "Login: " ARGV.clear login = gets.chomp password = get_password puts "\n" scrape_session = ScheduleScraper.new login, password scrape_session.schedule_page while scrape_session.schedule_available? scrape_session.generate_schedule scrape_session.next_week break if scrape_session.no_schedule_available? # Loop not breaking w/out this line. Need to investigate. end puts "\nNo further schedules available." print `open #{Dir.home}/myPage\\ Schedule` end |