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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ba171ee523fae2d20df4baeb3dc539f69386fe08b3122fb761d02b627f015ab
4
- data.tar.gz: d3bbd5b6a3fc19baba6aad04c8b1dfa57038dbfc2bc9c8d4f9a92d04130d4249
3
+ metadata.gz: 7e9adec08faef3ea43e75a3f1d2c1ac2e382a3d2def050a86624d7903dad6d91
4
+ data.tar.gz: 5360e827280bb8b189a3e49bd3d8cc731b528191f206b4a74f09264c6fd8cee9
5
5
  SHA512:
6
- metadata.gz: 3d959b1ef92050619e441214686807ce386bb2962e9e7e0b2bebeeae53d9e4d48e258d21c95bad498ab9e1fdb46dc72f51cf8fa051fe192d7103e0de2d73be5f
7
- data.tar.gz: 49f52788a16aa5cb8eb3a05029b1262c936d63d517821aa6e32509f725ba09a8f6a6b86efa567c6fb49cf76ae1cc5b03e12e146d59dc88ae9c9c20ce6ffa3f0e
6
+ metadata.gz: 9865e202ccb2b20f467d883dcfb58a1ca43cf9c24273b8eaa5cdf581d93979d6ceca684c10ff99321bfa01614a68d96e6ee99744493ae0fe4d1d7580ef45a3f3
7
+ data.tar.gz: 53bedad048171e3e7473e34663d97c1367af4b2f18835a28ee3c041fd66e03812916db61af534ebbfb3a55dedb2fcd9e5a5c0dc7e96e40d25ebb7227a01d8102
Binary file
Binary file
@@ -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
- self.class.attr_accessor(key)
7
- self.send(("#{key}="), value)
8
- @@all << self
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.uniq
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 "ID: #{self.id.capitalize}"
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}"
@@ -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 < 0 || option > 99
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
- exit?
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
- print "Would you like to exit the program? (Y/N) ".green
65
- exit_option = get_input
72
+ # def exit?
73
+ # print "Would you like to exit the program? (Y/N) ".green
74
+ # exit_option = get_input
66
75
 
67
- if exit_option == "Y"
68
- puts ""
69
- puts "Closing program..."
70
- puts ""
71
- elsif exit_option == "N"
72
- main_menu
73
- else
74
- puts "Invalid entry! Please try again..".red
75
- puts ""
76
- exit?
77
- end
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
@@ -1,3 +1,3 @@
1
1
  module CryptoStats
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
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.1
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-03 00:00:00.000000000 Z
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