class DslrShop::CLI
Constants
- LIST_PAGE
Public Instance Methods
add_attributes_from_detail(camera)
click to toggle source
# File lib/dslr_shop/cli.rb, line 17 def add_attributes_from_detail(camera) camera.add_attributes end
goodbye()
click to toggle source
# File lib/dslr_shop/cli.rb, line 77 def goodbye puts " THANK YOU FOR VISITING THE DSLR SHOP!!!! ".blue puts " HOPE TO SEE YOU AGAIN!!!! ".blue puts " HAVE A GREAT DAY!!! ".blue puts "*********************************************************************************************".green exit end
list_cameras()
click to toggle source
# File lib/dslr_shop/cli.rb, line 21 def list_cameras puts "*******************************************************".green puts " Welcome to the DSLR Shop".red puts " Your one stop shop for the most popular DSLR cameras".red puts "*******************************************************".green puts " List of the most popular cameras ".blue puts "*******************************************************".green DslrShop::Camera.all.each.with_index(1) {|camera, index| puts "#{index}. #{camera.brand} #{camera.name} - #{camera.price}" } puts "*********************************************************************************************".green end
make_cameras()
click to toggle source
# File lib/dslr_shop/cli.rb, line 13 def make_cameras DslrShop::Scraper.scrape_from_list(LIST_PAGE) end
run()
click to toggle source
# File lib/dslr_shop/cli.rb, line 5 def run make_cameras # add_attributes_from_detail list_cameras display_menu goodbye end