Class: MTGCardFinder::CLI

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

Class Method Summary collapse

Class Method Details

.options_inputObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/mtg_card_finder/cli.rb', line 49

def self.options_input
  input = gets.strip.to_i
  if input == 1
    puts "Please select your price trend Format:"
    self.set_choosing
  elsif input == 2
    Parser.csv
    sleep(2)
    self.options_text
    self.options_input
  elsif input == 3
    puts "Please type out the #{"number".fg COLORS[4]} from one of the above searched cards:"
    Parser.purchase
    sleep(2.5)
    self.options_text
    self.options_input
  elsif input == 4
    puts ""
    puts ""
    puts "Thank you for using #{"MTG".fg COLORS[6]} #{"CARD".fg COLORS[5]} #{"FINDER".fg COLORS[4]}"
    puts "-----------------------------------"
    exit
  else
    puts "That is not a valid option"
    self.options_input
  end
end

.options_textObject



22
23
24
25
26
27
28
29
# File 'lib/mtg_card_finder/cli.rb', line 22

def self.options_text
  puts "Would you like to?"
  puts "#{"[1]".fg COLORS[3]} search for a different format's market?"
  puts "#{"[2]".fg COLORS[3]} save the current card search listing into a CSV file?"
  puts "#{"[3]".fg COLORS[3]} purchase one of the queried cards in the open market?"
  puts "#{"[4]".fg COLORS[3]} exit the program?"
  puts "-------------------------------------------------"
end

.set_choosingObject



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/mtg_card_finder/cli.rb', line 31

def self.set_choosing
  self.set_text
  self.set_input
  Parser.scrape_cards
  Parser.display_cards
  puts ""
  puts "-------------------------------------------------"
  puts ""
  self.options_text
  self.options_input
end

.set_inputObject



43
44
45
46
47
# File 'lib/mtg_card_finder/cli.rb', line 43

def self.set_input
  sleep(1)
  puts "Please type out the #{"number".fg COLORS[3]} of the format you would like to see from above..."
  Parser.select_format
end

.set_textObject



14
15
16
17
18
19
20
# File 'lib/mtg_card_finder/cli.rb', line 14

def self.set_text
  puts "#{"[1]".fg COLORS[3]} Standard: #{"rising".fg COLORS[4]} cards today"
  puts "#{"[2]".fg COLORS[3]} Modern: #{"rising".fg COLORS[4]} cards today"
  puts "#{"[3]".fg COLORS[3]} Standard: #{"crashing".fg COLORS[6]} cards today"
  puts "#{"[4]".fg COLORS[3]} Modern: #{"crashing".fg COLORS[6]} cards today"
  puts "-------------------------------------------------"
end

.startObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/mtg_card_finder/cli.rb', line 3

def self.start
  Parser.reset_query_info
  puts "Powered by MTG$ (mtgprice.com)"; sleep(0.5);
  puts "-------------------------------------------------"
  puts "Please select your price trend Format:"
  puts "-------------------------------------------------"
  puts "#{"|Last Update|".fg COLORS[6]}#{Parser.update_date}"
  puts "-------------------------------------------------"
  self.set_choosing
end