Class: FantasyCompare::CLI

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

Instance Method Summary collapse

Instance Method Details

#callObject



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

def call
  inputs
end

#inputsObject

Takes input to parse proper JSON Position data by returing proper url link Mai CLI functionality



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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/fantasyCompare/cli.rb', line 9

def inputs
  positions = ["QB","RB","WR","TE","K","DEF"]

  # Select position to look at
  puts "Please pick a position (1-6) \n1.QB\n2.RB\n3.WR\n4.Te\n5.K\n6.DEF"
  pos_input = gets.chomp
  pos_input = pos_input.to_i-1

  # Validate position data
  while !pos_input.between?(0,5)
    puts "Invalid Input\n"
    puts "Please pick a position (1-6) \n1.QB\n2.RB\n3.WR\n4.Te\n5.K\n6.DEF"
    pos_input = gets.chomp
    pos_input = pos_input.to_i-1
  end
    position = positions[pos_input]

    # Select week
    puts "Please select a week for stats (1-17)"
    week = gets.chomp
    week = week.to_i

  # Validate week data
  while !week.between?(1,17)
    puts "Invalid Input\n"
    puts "Please select a week for stats (1-17)"
    week = gets.chomp
    week = week.to_i
  end

  FantasyCompare::NFLJSON.url(position, week)
  FantasyCompare::NFLJSON.players
    puts "Please select a team to find out more info (1-10)\n\n"
  FantasyCompare::NFLJSON.list

  #Select player for detail veiw
  info = gets.chomp
  info = info.to_i

  #Validate input
  while !info.between?(1,10)
    puts "Invalid Input\n"
    puts "Please select a player to find out more info (1-10)\n\n"
  FantasyCompare::NFLJSON.list
  info = gets.chomp
  info = info.to_i
  end

  FantasyCompare::NFLJSON.detail_player_view(info)
    puts "Information for this team is as follows\n\n"
  FantasyCompare::NFLJSON.detail_url
  puts FantasyCompare::NFLJSON.show_detail_veiw
  FantasyCompare::NFLJSON.next_note

end