class LeagueHelper::CLI

Attributes

input[RW]
summoner[RW]

Public Instance Methods

action() click to toggle source
# File lib/LeagueHelper/cli.rb, line 24
def action
    case @input
    when '1'
      soloQ
      puts ""
    when '2'
      champ_mastery
      puts ""
    when '3'
      puts "Here are your most played champs"
      puts ""
      @summoner.my_champs
    when '4'
      new_summoner
    when 'exit'
      puts "Thank You"
      puts "Goodbye"
    else
      puts "I dont understand that choice"
    end
end
call() click to toggle source
# File lib/LeagueHelper/cli.rb, line 6
def call
  puts "Welcome to League Helper"
  new_summoner
end
champ_mastery() click to toggle source
# File lib/LeagueHelper/cli.rb, line 57
def champ_mastery
  puts "Which champions would you like a build for?"
  summoner.champ_builds
  summoner.champions.each {|champ| puts champ.name}
  puts ""
  @input= gets.chomp
  champ = summoner.champ_find(@input)
  if champ
    puts "Here are the most popular items"
    puts ""
    champ.build.each_with_index {|item, idx| puts "#{idx+1}. #{item}"}
  else
    puts "That champion is not in your champ pool"
  end
end
get_summoner() click to toggle source
# File lib/LeagueHelper/cli.rb, line 87
def get_summoner
  @summoner = Summoner.find_create_by_name(@input)
  LolScraper.scrape_summoner_page(@summoner)
  LolScraper.summ_champ_stats(@summoner)
end
new_summoner() click to toggle source
# File lib/LeagueHelper/cli.rb, line 73
def new_summoner
  puts "Please enter your summoner name"
  @input = gets.chomp
  get_summoner
  puts ""
  if @summoner.champions.count != 0
    @summoner.stats
    options
  else
    puts "Please try again when you are ranked"
    puts "Goodbye"
  end
end
options() click to toggle source
# File lib/LeagueHelper/cli.rb, line 11
def options
  while @input != 'exit'
    puts ""
    puts "Please enter the number for the area of game play you would like to improve"
    puts "Or enter 'exit' to quit"
    puts  "1.Rank Solo Q       3.Most played Champs"
    puts  "2.Champion Build    4.New summoner lookup"
    puts ""
    @input = gets.chomp.downcase
    action
  end
end
soloQ() click to toggle source
# File lib/LeagueHelper/cli.rb, line 46
def soloQ
  puts "Here is a list of your best champions"
  puts "with win percent and avareage cs for each"
  c=@summoner.best_champs
  puts "#{c[0].name} CS:#{c[0].cs} #{c[0].my_winpercent}"
  puts "#{c[1].name} CS:#{c[1].cs} #{c[1].my_winpercent}"
  puts "I suggest focusing on these two to climb in Rank"
  puts "The easist way to improve win percent is to improve cs"
  puts "Aim for about 90 cs for every 10 minutes of in game time."
end