cns 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.reek.yml +64 -0
- data/.rubocop.yml +4 -3
- data/Gemfile.lock +19 -13
- data/cns.gemspec +1 -0
- data/lib/cns/apibc.rb +34 -48
- data/lib/cns/apice1.rb +22 -72
- data/lib/cns/apice2.rb +82 -39
- data/lib/cns/bigquery1.rb +5 -4
- data/lib/cns/bigquery3.rb +62 -47
- data/lib/cns/bigquery4.rb +51 -54
- data/lib/cns/bitcoinde.rb +21 -20
- data/lib/cns/etherscan1.rb +21 -19
- data/lib/cns/etherscan2.rb +7 -7
- data/lib/cns/greymass1.rb +23 -18
- data/lib/cns/greymass2.rb +8 -26
- data/lib/cns/kraken.rb +21 -20
- data/lib/cns/paymium.rb +15 -15
- data/lib/cns/therock.rb +16 -15
- data/lib/cns/version.rb +1 -1
- metadata +17 -2
data/lib/cns/paymium.rb
CHANGED
@@ -27,7 +27,7 @@ module Cns
|
|
27
27
|
|
28
28
|
# @return [Array<Hash>] lista ledger paymium novos
|
29
29
|
def ledger
|
30
|
-
@ledger ||= exd[:kl].map { |
|
30
|
+
@ledger ||= exd[:kl].map { |map| map[:account_operations].select { |obj| kyl.include?(obj[:uuid]) } }.flatten
|
31
31
|
end
|
32
32
|
|
33
33
|
# @return [String] texto saldos & transacoes & ajuste dias
|
@@ -40,7 +40,7 @@ module Cns
|
|
40
40
|
mostra_ledger
|
41
41
|
return unless ledger.count.positive?
|
42
42
|
|
43
|
-
puts("\nstring ajuste dias da ledger\n-h=#{kyl.map { |
|
43
|
+
puts("\nstring ajuste dias da ledger\n-h=#{kyl.map { |obj| "#{obj}:0" }.join(' ')}")
|
44
44
|
end
|
45
45
|
|
46
46
|
# @return [Hash] dados exchange paymium - saldos & transacoes ledger
|
@@ -53,22 +53,22 @@ module Cns
|
|
53
53
|
|
54
54
|
# @return [Array<String>] lista txid dos ledger novos
|
55
55
|
def kyl
|
56
|
-
@kyl ||= exd[:kl].map { |
|
57
|
-
(ops[:t] ? [] : bqd[:nl].map { |
|
56
|
+
@kyl ||= exd[:kl].map { |oex| oex[:account_operations].map { |obj| obj[:uuid] } }.flatten -
|
57
|
+
(ops[:t] ? [] : bqd[:nl].map { |obq| obq[:txid] })
|
58
58
|
end
|
59
59
|
|
60
60
|
# @example (see Apice#account_fr)
|
61
61
|
# @param [Symbol] bqm symbol paymium da moeda
|
62
62
|
# @return [String] texto formatado saldos
|
63
63
|
def formata_saldos(bqm)
|
64
|
-
|
65
|
-
|
64
|
+
vbq = bqd[:sl][bqm].to_d
|
65
|
+
vkr = exd[:sl]["balance_#{bqm}".to_sym].to_d
|
66
66
|
format(
|
67
67
|
'%<mo>-5.5s %<kr>21.9f %<bq>21.9f %<ok>3.3s',
|
68
68
|
mo: bqm.upcase,
|
69
|
-
kr:
|
70
|
-
bq:
|
71
|
-
ok:
|
69
|
+
kr: vkr,
|
70
|
+
bq: vbq,
|
71
|
+
ok: vkr == vbq ? 'OK' : 'NOK'
|
72
72
|
)
|
73
73
|
end
|
74
74
|
|
@@ -90,16 +90,16 @@ module Cns
|
|
90
90
|
# @param [Integer] max chars a mostrar
|
91
91
|
# @return [String] texto formatado identificacor da ledger
|
92
92
|
def formata_uuid(uid, max)
|
93
|
-
|
94
|
-
max < 7 ? 'erro' : "#{uid[0,
|
93
|
+
int = Integer(max / 2)
|
94
|
+
max < 7 ? 'erro' : "#{uid[0, int]}#{uid[-int..]}"
|
95
95
|
end
|
96
96
|
|
97
97
|
# @return [String] texto totais numero de transacoes
|
98
98
|
def mostra_totais
|
99
|
-
|
100
|
-
|
99
|
+
vkl = exd[:kl].map { |obj| obj[:account_operations].count }.flatten.inject(:+)
|
100
|
+
vnl = bqd[:nl].count
|
101
101
|
|
102
|
-
puts("LEDGER #{format('%<c>20i %<d>21i %<o>3.3s', c:
|
102
|
+
puts("LEDGER #{format('%<c>20i %<d>21i %<o>3.3s', c: vkl, d: vnl, o: vkl == vnl ? 'OK' : 'NOK')}")
|
103
103
|
end
|
104
104
|
|
105
105
|
# @return [String] texto transacoes ledger
|
@@ -107,7 +107,7 @@ module Cns
|
|
107
107
|
return unless ops[:v] && ledger.count.positive?
|
108
108
|
|
109
109
|
puts("\nledger data hora tipo moeda quantidade")
|
110
|
-
ledger.sort { |
|
110
|
+
ledger.sort { |ant, prx| prx[:created_at_int] <=> ant[:created_at_int] }.each { |obj| puts(formata_ledger(obj)) }
|
111
111
|
end
|
112
112
|
end
|
113
113
|
end
|
data/lib/cns/therock.rb
CHANGED
@@ -27,19 +27,19 @@ module Cns
|
|
27
27
|
|
28
28
|
# @return [Array<Hash>] lista ledger therock novos
|
29
29
|
def ledger
|
30
|
-
@ledger ||= exd[:kl].select { |
|
30
|
+
@ledger ||= exd[:kl].select { |obj| kyl.include?(obj[:id]) }
|
31
31
|
end
|
32
32
|
|
33
33
|
# @return [String] texto saldos & transacoes & ajuste dias
|
34
34
|
def mostra_resumo
|
35
35
|
puts("\nTHEROCK\ntipo therock bigquery")
|
36
|
-
exd[:sl].each { |
|
36
|
+
exd[:sl].each { |obj| puts(formata_saldos(obj)) }
|
37
37
|
mostra_totais
|
38
38
|
|
39
39
|
mostra_ledger
|
40
40
|
return unless ledger.count.positive?
|
41
41
|
|
42
|
-
puts("\nstring ajuste dias da ledger\n-h=#{kyl.map { |
|
42
|
+
puts("\nstring ajuste dias da ledger\n-h=#{kyl.map { |obj| "#{obj}:0" }.join(' ')}")
|
43
43
|
end
|
44
44
|
|
45
45
|
# @return [Hash] dados exchange therock - saldos & transacoes ledger
|
@@ -52,21 +52,22 @@ module Cns
|
|
52
52
|
|
53
53
|
# @return [Array<String>] lista txid dos ledger novos
|
54
54
|
def kyl
|
55
|
-
@kyl ||= exd[:kl].map { |
|
55
|
+
@kyl ||= exd[:kl].map { |oex| oex[:id] } - (ops[:t] ? [] : bqd[:nl].map { |obq| obq[:txid] })
|
56
56
|
end
|
57
57
|
|
58
58
|
# @example (see Apice#account_mt)
|
59
59
|
# @param [Hash] hsl saldo therock da moeda
|
60
60
|
# @return [String] texto formatado saldos
|
61
61
|
def formata_saldos(hsl)
|
62
|
-
|
63
|
-
|
62
|
+
cur = hsl[:currency]
|
63
|
+
vbq = bqd[:sl][cur.downcase.to_sym].to_d
|
64
|
+
vkr = hsl[:balance].to_d
|
64
65
|
format(
|
65
66
|
'%<mo>-5.5s %<kr>21.9f %<bq>21.9f %<ok>3.3s',
|
66
|
-
mo:
|
67
|
-
kr:
|
68
|
-
bq:
|
69
|
-
ok:
|
67
|
+
mo: cur.upcase,
|
68
|
+
kr: vkr,
|
69
|
+
bq: vbq,
|
70
|
+
ok: vkr == vbq ? 'OK' : 'NOK'
|
70
71
|
)
|
71
72
|
end
|
72
73
|
|
@@ -86,18 +87,18 @@ module Cns
|
|
86
87
|
|
87
88
|
# @return [String] texto totais numero de transacoes
|
88
89
|
def mostra_totais
|
89
|
-
|
90
|
-
|
90
|
+
vkl = exd[:kl].count
|
91
|
+
vnl = bqd[:nl].count
|
91
92
|
|
92
|
-
puts("LEDGER #{format('%<c>20i %<d>21i %<o>3.3s', c:
|
93
|
+
puts("LEDGER #{format('%<c>20i %<d>21i %<o>3.3s', c: vkl, d: vnl, o: vkl == vnl ? 'OK' : 'NOK')}")
|
93
94
|
end
|
94
95
|
|
95
96
|
# @return [String] texto transacoes ledger
|
96
97
|
def mostra_ledger
|
97
98
|
return unless ops[:v] && ledger.count.positive?
|
98
99
|
|
99
|
-
puts("\nledger data hora tipo moeda
|
100
|
-
ledger.sort { |
|
100
|
+
puts("\nledger data hora tipo moeda quantidade")
|
101
|
+
ledger.sort { |ant, prx| prx[:id] <=> ant[:id] }.each { |obj| puts(formata_ledger(obj)) }
|
101
102
|
end
|
102
103
|
end
|
103
104
|
end
|
data/lib/cns/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hernâni Rodrigues Vaz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: solargraph
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,6 +174,7 @@ extensions: []
|
|
160
174
|
extra_rdoc_files: []
|
161
175
|
files:
|
162
176
|
- ".gitignore"
|
177
|
+
- ".reek.yml"
|
163
178
|
- ".rubocop.yml"
|
164
179
|
- ".travis.yml"
|
165
180
|
- CODE_OF_CONDUCT.md
|