cryptostats-cli 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/cryptostats-cli-0.2.0.gem +0 -0
- data/cryptostats-cli-0.2.1.gem +0 -0
- data/lib/models/cryptostats.rb +14 -7
- data/lib/services/cli.rb +29 -20
- data/lib/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e9adec08faef3ea43e75a3f1d2c1ac2e382a3d2def050a86624d7903dad6d91
|
4
|
+
data.tar.gz: 5360e827280bb8b189a3e49bd3d8cc731b528191f206b4a74f09264c6fd8cee9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9865e202ccb2b20f467d883dcfb58a1ca43cf9c24273b8eaa5cdf581d93979d6ceca684c10ff99321bfa01614a68d96e6ee99744493ae0fe4d1d7580ef45a3f3
|
7
|
+
data.tar.gz: 53bedad048171e3e7473e34663d97c1367af4b2f18835a28ee3c041fd66e03812916db61af534ebbfb3a55dedb2fcd9e5a5c0dc7e96e40d25ebb7227a01d8102
|
Binary file
|
Binary file
|
data/lib/models/cryptostats.rb
CHANGED
@@ -1,22 +1,29 @@
|
|
1
1
|
class CryptoStats
|
2
|
+
attr_accessor :id, :symbol, :name, :image, :current_price, :market_cap, :market_cap_rank, :fully_diluted_valuation, :total_volume,
|
3
|
+
:high_24h, :low_24h, :price_change_24h, :price_change_percentage_24h, :market_cap_change_24h, :market_cap_change_percentage_24h,
|
4
|
+
:circulating_supply, :total_supply, :max_supply, :ath, :ath_change_percentage, :ath_date, :atl, :atl_change_percentage, :atl_date, :roi, :last_updated
|
5
|
+
|
2
6
|
@@all = []
|
3
7
|
|
4
8
|
def initialize(attributes)
|
5
|
-
attributes.each do |key, value|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
9
|
+
# attributes.each do |key, value|
|
10
|
+
# self.class.attr_accessor(key)
|
11
|
+
# self.send(("#{key}="), value)
|
12
|
+
# @@all << self
|
13
|
+
# end
|
14
|
+
|
15
|
+
attributes.each {|key, value| self.send(("#{key}="), value)}
|
16
|
+
@@all << self
|
10
17
|
end
|
11
18
|
|
12
19
|
def self.all
|
13
|
-
@@all
|
20
|
+
@@all
|
14
21
|
end
|
15
22
|
|
16
23
|
def display_stats
|
17
24
|
puts "-------------------------------------------- Crypto Stats --------------------------------------------"
|
18
25
|
#crypto_logo(self.image)
|
19
|
-
puts "
|
26
|
+
puts "Name: #{self.name}"
|
20
27
|
puts "Symbol: #{self.symbol.upcase}"
|
21
28
|
puts "Current Price: $#{self.current_price}"
|
22
29
|
puts "Market Cap: $#{self.market_cap}"
|
data/lib/services/cli.rb
CHANGED
@@ -40,19 +40,28 @@ class Cli
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def main_menu_options
|
43
|
-
print "Enter the Cryptocurrency number to view more details: ".green
|
43
|
+
print "Enter the Cryptocurrency number to view more details or type 'exit' to leave the program: ".green
|
44
44
|
option = get_input
|
45
|
-
option = option.to_i - 1
|
46
45
|
|
47
|
-
if option
|
46
|
+
if option == "exit"
|
47
|
+
puts ""
|
48
|
+
puts "Closing program..."
|
49
|
+
puts ""
|
50
|
+
elsif option.to_i - 1 < 0 || option.to_i - 1 > 99
|
48
51
|
puts "Invalid entry. Please try again...".red
|
49
52
|
puts ""
|
50
53
|
main_menu_options
|
51
54
|
else
|
52
55
|
puts ""
|
53
|
-
CryptoStats.all[option].display_stats
|
56
|
+
CryptoStats.all[option.to_i - 1].display_stats
|
54
57
|
puts ""
|
55
|
-
|
58
|
+
puts "Press the 'Enter' key to continue...".green
|
59
|
+
gets.chomp
|
60
|
+
puts " ~~> fetching data from CoinGecko...".blue
|
61
|
+
sleep(1)
|
62
|
+
puts " ~~> loading the top 100 cryptocurrencies...".blue
|
63
|
+
sleep(1)
|
64
|
+
main_menu
|
56
65
|
end
|
57
66
|
end
|
58
67
|
|
@@ -60,22 +69,22 @@ class Cli
|
|
60
69
|
gets.chomp
|
61
70
|
end
|
62
71
|
|
63
|
-
def exit?
|
64
|
-
|
65
|
-
|
72
|
+
# def exit?
|
73
|
+
# print "Would you like to exit the program? (Y/N) ".green
|
74
|
+
# exit_option = get_input
|
66
75
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
end
|
76
|
+
# if exit_option == "Y"
|
77
|
+
# puts ""
|
78
|
+
# puts "Closing program..."
|
79
|
+
# puts ""
|
80
|
+
# elsif exit_option == "N"
|
81
|
+
# main_menu
|
82
|
+
# else
|
83
|
+
# puts "Invalid entry! Please try again..".red
|
84
|
+
# puts ""
|
85
|
+
# exit?
|
86
|
+
# end
|
87
|
+
# end
|
79
88
|
|
80
89
|
def standardize_crypto_name_length
|
81
90
|
max_length = 25
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cryptostats-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Lai
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -87,6 +87,8 @@ files:
|
|
87
87
|
- bin/run
|
88
88
|
- bin/setup
|
89
89
|
- cryptostats-cli-0.1.0.gem
|
90
|
+
- cryptostats-cli-0.2.0.gem
|
91
|
+
- cryptostats-cli-0.2.1.gem
|
90
92
|
- cryptostats-cli.gemspec
|
91
93
|
- lib/environment.rb
|
92
94
|
- lib/models/cryptostats.rb
|