cryptocoin_fanboi 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +3 -1
- data/lib/cryptocoin_fanboi.rb +33 -10
- metadata +23 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b01a628c230f7ecb7ba8d3a55a2f972ef0afcacb
|
4
|
+
data.tar.gz: 00b0c8d8f6d6c223d3b9749bcd708aad41290771
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19d0075ef5991cbf4153fd4d8d5fb400fb7fcde152d0fc604214f31fa13ddb8848d21f49bdb34a160772a6d016968f7c926b7bc4022f09f4076ec6194a179499
|
7
|
+
data.tar.gz: 07ccb00344da653e5fccbf41522eef5679a6093bc621ae9e8fc65ce110f1d463e5738029678aea32d7403ac8a350c7096b04057a7a7895158e543ce4e40d1a5a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
data/lib/cryptocoin_fanboi.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
# file: cryptocoin_fanboi.rb
|
4
4
|
|
5
5
|
|
6
|
+
require 'colored'
|
6
7
|
require 'coinmarketcap'
|
7
8
|
require 'table-formatter'
|
8
9
|
|
@@ -10,9 +11,11 @@ require 'table-formatter'
|
|
10
11
|
class CryptocoinFanboi
|
11
12
|
|
12
13
|
attr_reader :coins
|
14
|
+
attr_accessor :colored
|
13
15
|
|
14
|
-
def initialize(watch: [])
|
16
|
+
def initialize(watch: [], colored: true)
|
15
17
|
|
18
|
+
@colored = colored
|
16
19
|
@watch = watch.map(&:upcase)
|
17
20
|
|
18
21
|
@fields = %w(rank name price_usd price_btc percent_change_1h
|
@@ -33,18 +36,17 @@ class CryptocoinFanboi
|
|
33
36
|
# View the coins with the largest gains in the past hour
|
34
37
|
#
|
35
38
|
def now(limit: 5, markdown: false)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
+
|
40
|
+
build_table top_coins('1h', limit: limit), markdown: markdown
|
41
|
+
|
39
42
|
end
|
40
43
|
|
41
44
|
# View the coins with the largest gains this week (past 7 days)
|
42
45
|
#
|
43
46
|
def this_week(limit: 5, markdown: false)
|
44
47
|
|
45
|
-
|
46
|
-
|
47
|
-
#top_coins(limit: limit)
|
48
|
+
build_table top_coins(limit: limit), markdown: markdown
|
49
|
+
|
48
50
|
end
|
49
51
|
|
50
52
|
alias week this_week
|
@@ -53,8 +55,8 @@ class CryptocoinFanboi
|
|
53
55
|
#
|
54
56
|
def today(limit: 5, markdown: false)
|
55
57
|
|
56
|
-
|
57
|
-
|
58
|
+
build_table top_coins('24h', limit: limit), markdown: markdown
|
59
|
+
|
58
60
|
end
|
59
61
|
|
60
62
|
def to_s(limit: nil, markdown: false, watch: @watch)
|
@@ -65,11 +67,32 @@ class CryptocoinFanboi
|
|
65
67
|
|
66
68
|
end
|
67
69
|
|
68
|
-
|
70
|
+
build_table coins, markdown: markdown
|
69
71
|
|
70
72
|
end
|
71
73
|
|
72
74
|
private
|
75
|
+
|
76
|
+
def build_table(coins, markdown: markdown)
|
77
|
+
|
78
|
+
s = TableFormatter.new(source: coins, labels: @labels, markdown: markdown)\
|
79
|
+
.display
|
80
|
+
|
81
|
+
return s if @colored == false
|
82
|
+
|
83
|
+
a = s.lines
|
84
|
+
|
85
|
+
body = a[3..-2].map do |line|
|
86
|
+
|
87
|
+
fields = line.split('|')
|
73
88
|
|
89
|
+
a2 = fields[5..-2].map {|x|
|
74
90
|
x[/^ +-/] ? x.red : x.green
|
75
91
|
}
|
92
|
+
(fields[0..4] + a2 + ["\n"]).join('|')
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
(a[0..2] + body + [a[-1]]).join
|
97
|
+
|
98
|
+
end
|
76
99
|
|
77
100
|
def fetch_coinlist(limit: nil, watch: [])
|
78
101
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cryptocoin_fanboi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -32,6 +32,26 @@ cert_chain:
|
|
32
32
|
-----END CERTIFICATE-----
|
33
33
|
date: 2018-01-02 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: colored
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.2'
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '1.2'
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - "~>"
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '1.2'
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.2'
|
35
55
|
- !ruby/object:Gem::Dependency
|
36
56
|
name: coinmarketcap
|
37
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,6 +122,6 @@ rubyforge_project:
|
|
102
122
|
rubygems_version: 2.6.13
|
103
123
|
signing_key:
|
104
124
|
specification_version: 4
|
105
|
-
summary: A coinmarketcap wrapper which makes it convenient to display the top 5
|
106
|
-
|
125
|
+
summary: A coinmarketcap wrapper which makes it convenient to display the top 5 cryptocurrencies
|
126
|
+
as listed on https://coinmarketcap.com.
|
107
127
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|