Class: NewGameScores::CLI

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

Instance Method Summary collapse

Instance Method Details

#callObject



3
4
5
# File 'lib/new_game_scores/cli.rb', line 3

def call 
  start
end

#list(name, url, score) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/new_game_scores/cli.rb', line 63

def list(name, url, score)
  puts ""
  puts "  Newest Game Releases for #{name}."
  list = NewGameScores::CollectionScraper.new(url, score)
  list.clear
  list.scrape_list
  list.display_list
  sleep(3)
  puts ""
  start
end

#startObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/new_game_scores/cli.rb', line 24

def start
  welcome
  input = nil
  while input != 'exit' 
    puts ""
    puts "  Please type the number or the name of the platform that you would like to see the latest reviews for."
    puts ""
    puts "  If you would like to exit the program please type 'Exit'."
    puts ""
    input = gets.strip.upcase
    if input != 'EXIT' 
      puts "  What is the minimum score you would like to see a list of? (1-100)"
      puts ""
      score = gets.strip.upcase
    end 
    score

    if input == "PS4" || input == "1"
      list("PS4", "http://www.metacritic.com/browse/games/release-date/new-releases/ps4/metascore", score)

    elsif input == "XBOX ONE" || input == "2"
      list("Xbox One", "http://www.metacritic.com/browse/games/release-date/new-releases/xboxone/metascore", score)

    elsif input == "PC" || input == "3"
      list("PC", "http://www.metacritic.com/browse/games/release-date/new-releases/pc/metascore", score)

    elsif input == "WII U" || input == "4"
      list("Wii U", "http://www.metacritic.com/browse/games/release-date/new-releases/wii-u/metascore", score) 

    elsif input == "3DS" || input ==  "5"
      list("3ds", "http://www.metacritic.com/browse/games/release-date/new-releases/3ds/metascore", score) 

    elsif input == "EXIT"
      puts "  Goodbye!"
      exit == true
    end
  end
end

#welcomeObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/new_game_scores/cli.rb', line 7

def welcome
  puts ""
  puts ""
  puts ""
  puts ":::::::::::::: Find The Newest Video Game Reviews Here ::::::::::::::"
  puts ""
  puts ""
  puts "Please choose your platform of choice."
  puts ""
  puts "1. PS4"
  puts "2. Xbox One"
  puts "3. PC"
  puts "4. Wii U"
  puts "5. 3ds"
  puts ""
end