Class: FinancialDataPull::CLI

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#tickerObject

Returns the value of attribute ticker.



4
5
6
# File 'lib/financial_data_pull/cli.rb', line 4

def ticker
  @ticker
end

Instance Method Details

#callObject



6
7
8
9
10
# File 'lib/financial_data_pull/cli.rb', line 6

def call
  
  initialprint
  start
end

#initialprintObject



12
13
14
# File 'lib/financial_data_pull/cli.rb', line 12

def initialprint
  puts "~~~ Welcome to Tylor's CLI GEM ~~~\n"
end

#startObject



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
# File 'lib/financial_data_pull/cli.rb', line 16

def start

  input = nil
  while input != "exit"

  puts "Please select your desired option:"
  puts "1. GOOG - Alphabet, Inc."
  puts "2. TSLA - Tesla Motors, Inc."
  puts "3. AAPL - Apple, Inc."
  puts "4. FB - Facebook, Inc."
  puts "5. Type in ticker manually"
  puts "6. EXIT\n"
  input = gets.strip.downcase 

  case input
      when "1"
        puts "Google was selected, printing Google:"
        @ticker = "goog"
        FinancialDataPull::Scraper.scrape(ticker)
      when "2"
        puts "Tesla was slected, printing Tesla:"
        @ticker = "tsla"
        FinancialDataPull::Scraper.scrape(ticker)
      when "3"
        puts "Apple was selected, printing Apple:"
        @ticker = "aapl"
        FinancialDataPull::Scraper.scrape(ticker)
      when "4"
        puts "Facebook was selected, printing Facebook:"
        @ticker = "fb"
        FinancialDataPull::Scraper.scrape(ticker)
      when "5"
        puts "Enter your ticker:"
        @ticker = gets.strip.downcase
        FinancialDataPull::Scraper.scrape(ticker)
      when "6"
        puts "Exiting the program..."
        input = "exit"
      else
      end
    end

end