stockticker_cli 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/stockticker_cli/api.rb +4 -6
- data/lib/stockticker_cli/cli.rb +4 -2
- data/lib/stockticker_cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7f59902974bc4a3e11c828f1196ece22610dad661f04baf750bbdc85570ce69
|
4
|
+
data.tar.gz: fe28a2b45d9d314f2ce5f0459b24aa84bc2638b7613492d1e2fbc959bf2a5fa9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e8cbaeddfb64814cd74b95d30073f04dc85391f9df71f828f497749b3803e8077d6a943c02d8c4b3f8aad8720f47a8730f07310713d4ea27389513b91975e13
|
7
|
+
data.tar.gz: c045172ee4d6bb945d6c2b833c5cb0681beed211c3bba7fd11713fbcb7071279f50fe1181c218258133f90729ce4cd7b6a04f06a85ec07e82cc729e6508db4d8
|
data/Gemfile.lock
CHANGED
data/lib/stockticker_cli/api.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
class StocktickerCli::API
|
2
2
|
BASE_URL = 'https://fmpcloud.io/api/v3/'
|
3
|
-
KEY = ENV["API_KEY"]
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
# KEY = ENV["API_KEY"]
|
4
|
+
|
7
5
|
# Api call
|
8
6
|
def self.query
|
9
7
|
# https://fmpcloud.io/api/v3/actives?apikey=4b31fc84cd3248a0f61868b96f531bde
|
10
|
-
results = RestClient.get("#{BASE_URL}actives?apikey=#{KEY}")
|
8
|
+
results = RestClient.get("#{BASE_URL}actives?apikey=#{$KEY}")
|
11
9
|
json = JSON.parse(results)
|
12
10
|
|
13
11
|
|
@@ -18,7 +16,7 @@ class StocktickerCli::API
|
|
18
16
|
end
|
19
17
|
|
20
18
|
def self.info_query(stock_obj)
|
21
|
-
results = RestClient.get("#{BASE_URL}profile/#{stock_obj.ticker}?apikey=#{KEY}")
|
19
|
+
results = RestClient.get("#{BASE_URL}profile/#{stock_obj.ticker}?apikey=#{$KEY}")
|
22
20
|
json = JSON.parse(results)
|
23
21
|
stock_obj.set_attributes(json[0])
|
24
22
|
end
|
data/lib/stockticker_cli/cli.rb
CHANGED
@@ -8,7 +8,10 @@ class StocktickerCli::CLI
|
|
8
8
|
def welcome
|
9
9
|
puts "Welcome to the stock ticker cli app!"
|
10
10
|
puts ""
|
11
|
+
puts "Please sign-up for a free account to use this app here: https://fmpcloud.io/register"
|
11
12
|
sleep(1)
|
13
|
+
puts "Please enter your api key to continue."
|
14
|
+
$KEY = gets.strip
|
12
15
|
menu
|
13
16
|
end
|
14
17
|
|
@@ -53,8 +56,7 @@ class StocktickerCli::CLI
|
|
53
56
|
|
54
57
|
if (input.between?(0, 10))
|
55
58
|
s = StocktickerCli::STOCK.all[input - 1]
|
56
|
-
StocktickerCli::API.info_query(s)
|
57
|
-
binding.pry
|
59
|
+
StocktickerCli::API.info_query(s)
|
58
60
|
puts ""
|
59
61
|
puts "#{s.symbol} - #{s.companyName} - $#{s.price}"
|
60
62
|
puts ""
|