class LocalRealEstate::CLI
Public Instance Methods
call()
click to toggle source
# File lib/local_real_estate/cli.rb, line 2 def call greeting menu end
detailed_view(selection)
click to toggle source
# File lib/local_real_estate/cli.rb, line 46 def detailed_view(selection) home = LocalRealEstate::Listing.all[selection.to_i - 1] puts '-------------------------------------------' puts "Address: #{home.address}. #{home.city},#{home.state}." puts "Price: #{home.price}" puts "Bedrooms:#{home.bedrooms}" puts "Bathrooms: #{home.bathrooms}" unless home.sqft == '' then puts "Square Feet: #{home.sqft}" end unless home.lot_size == '' then puts "Lot Size #{home.lot_size}" end unless home.cars == '' then puts "Garage: #{home.cars}" end puts '-------------------------------------------' end
goodbye()
click to toggle source
# File lib/local_real_estate/cli.rb, line 79 def goodbye puts 'See you next time!' end
greeting()
click to toggle source
# File lib/local_real_estate/cli.rb, line 7 def greeting system 'clear' puts '-------------------------------------------' puts '-------------------------------------------' puts 'Welcome to the Local Real Estate Listing app' puts 'This will display local real estate listings by' puts 'zip code and allow you to see expanded details on each listing' puts '' end
invalid_input()
click to toggle source
# File lib/local_real_estate/cli.rb, line 71 def invalid_input puts ' - - - - - - - - - - - - - ' puts 'Input not recognized, please try again:' puts ' - - - - - - - - - - - - - ' sleep 2 detail_menu end
new_search()
click to toggle source
# File lib/local_real_estate/cli.rb, line 40 def new_search LocalRealEstate::Listing.all.clear puts 'Please type in the Zip code in which you would like to search' zip_method end
print_listings()
click to toggle source
# File lib/local_real_estate/cli.rb, line 63 def print_listings puts "--------Listings in #{LocalRealEstate::Listing.current_city}--------" LocalRealEstate::Listing.all.each_with_index do |listing, i| puts "#{i + 1}. #{listing.address} - #{listing.bedrooms} #{listing.price}" end puts '-------------------------------------------' end
zip_method()
click to toggle source
# File lib/local_real_estate/cli.rb, line 59 def zip_method LocalRealEstate::Scraper.new(gets.strip).create_listings end