Class: BestMoviesNearMe::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/best_movies_near_me/cli.rb

Instance Method Summary collapse

Instance Method Details

#callObject



3
4
5
6
7
# File 'lib/best_movies_near_me/cli.rb', line 3

def call 
  BestMoviesNearMe::Scraper.new.create_movie
  puts "Welcome to GoodMovieFinder, where we cut out the bullshit and fake reviews to find *actual* quality movies *actually* playing near you."
  start 
end


41
42
43
44
45
46
47
48
49
50
51
# File 'lib/best_movies_near_me/cli.rb', line 41

def print_movie(movie)
  puts ""
  puts "Title: #{movie.title}"
  puts ""
  puts "Synopsis: #{movie.synopsis}"
  puts ""
  puts "Metascore: #{movie.metascore}"
  puts ""
  puts "Showtimes: #{movie.showtimes}"
  puts ""
end


53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/best_movies_near_me/cli.rb', line 53

def print_movies(caliber)
    puts ""
    puts "---- #{caliber} movies ----"
    puts ""
    
    
    caliber_array = WorldsBestRestaurants::Movie.all.select {|m| m['quality'] == caliber }
    
    
    caliber_array.each_with_index do |movie, index|
      puts "#{index+1}). #{movie.title} - #{movie.metascore}"
    end
  end

#startObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/best_movies_near_me/cli.rb', line 9

def start 
  puts ""
  puts "What caliber of movie would you like to see? Excellent, Good, So-So, or Shitty?"
  input = gets.strip.capitalize 
  
  print_movies(input)
  
  puts ""
  puts "Which movie would you like more info on?"
  input = gets.strip

movie = BestMoviesNearMe::Movie.find(input.to_i)

print_movie(movie)

puts ""
puts "Want to see another movie? Enter Y or N"

input = gets.strip.downcase
if input == "y"
  start 
  elsif input == "n"
  puts ""
  puts "See Ya"
  exit
else 
  puts ""
  puts "Invalid answer."
  start 
end 
end