lib/congress.rb in my-congress-0.2.0 vs lib/congress.rb in my-congress-0.2.1
- old
+ new
@@ -5,11 +5,11 @@
# require 'open-uri'
# require 'pry'
# require 'selenium-webdriver'
-class MyCongress
+class MCongress
def call
Header.new
HeaderQuote.new
@@ -20,11 +20,11 @@
puts "Type 'exit' to leave My Congress.".colorize(:blue)
choice = gets.chomp
if choice != "1" && choice != "2" && choice.upcase != "EXIT"
puts "Invalid input. Press 'Enter to return to Main Menu.".colorize(:blue)
nothing = gets.chomp
- MyCongress.new.call
+ MCongress.new.call
elsif choice.upcase == "EXIT"
ProgramEnd.new
end
puts "Enter the name of your city: ".colorize(:blue)
@city_input = gets.chomp
@@ -38,11 +38,10 @@
@@street_input = gets.chomp
if choice == "1"
puts " "
puts "Please wait while we locate your congressional district...".colorize(:red)
GetURL.new(@@street_input, @@zip_input, @@state_input)
- #MyCongress.get_url(@@street_input, @@zip_input)
else
UpcomingElections.new(@@state_input)
end
end
@@ -72,11 +71,11 @@
end
address_string += address_array[address_array.length-1]
site = "https://secure.everyaction.com/p/VRl-GNlm_0mCSWaMc4d6_w2?pc=#{zip}&add1=#{address_string}&results=True"
- MyCongress.selenium(site)
+ MCongress.selenium(site)
end
def self.selenium(site)
options = Selenium::WebDriver::Chrome::Options.new(args: ['headless'])
@@ -89,21 +88,21 @@
#Error for not locating address / invalid address
if info[3] == nil
puts " "
puts "Could not locate address. Press 'Enter' to return to Main Menu.".colorize(:blue)
nothing = gets.chomp
- MyCongress.new.call
+ MCongress.new.call
end
elements = Nokogiri::HTML(open(driver.current_url))
sen1 = info[3].text.split("\n")
sen2 = info[4].text.split("\n")
rep = info[5].text.split("\n")
driver.quit
- MyCongress.find_representatives(sen1, sen2, rep, elements)
+ MCongress.find_representatives(sen1, sen2, rep, elements)
end
def self.find_representatives(sen1, sen2, rep, elements)
@@ -133,8 +132,6 @@
CongressOutput.new(senator1, senator2, representative, @district, @@state_input)
end
-end
-
-#MyCongress.new
+end
\ No newline at end of file