mycoins 0.2.2 → 0.2.3

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
  SHA1:
3
- metadata.gz: ea88002b9657502cadc020c5b79b6fe502afe54f
4
- data.tar.gz: a1c6d6a6052a58145716e88fedf219d56e1d40b3
3
+ metadata.gz: 8928e60128a76148d009d196ef2286ed57d50880
4
+ data.tar.gz: 85dcc24bcdd9bd1f374403f2c01483adba3822cc
5
5
  SHA512:
6
- metadata.gz: aec15d42a4b70c89f1f1d96afeb3fd32f2d9820814fe2a8f075736318facdb2a40f11b554f3ec8cfb09bde16513b1e6db1f9d6a9768040fd63ff644fa947e5a1
7
- data.tar.gz: 00fefa8ebf679cf303bea290ec5c56901d96f779bbdfd830f63053281e611721a7b93ead0a064be84eb766b5f80fba650eb4c1c6336c2a75285cb70b1066e477
6
+ metadata.gz: e82115cd34552785b099128be98d1bb6486e03f2cf89cd0b15092006b6bc713ebee09e1f5c336809995901b49ea55e0a816c41c90cb519494600d73d30e63e8c
7
+ data.tar.gz: ea5d21181fbbe559c1528870ae538c375b0e06f0698d075c13c9fcce7364c679b898472fd45a5082b578f674d16c71a2ae7d9b528faf487a04a787d33e0d74d4
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -67,10 +67,10 @@ class MyCoins
67
67
  @mycurrency]
68
68
  end
69
69
 
70
- def portfolio()
71
-
70
+ def portfolio(order_by: :rank)
71
+
72
72
  r = build_portfolio(@dx.title)
73
- format_portfolio(r)
73
+ format_portfolio(r, order_by: order_by)
74
74
 
75
75
  end
76
76
 
@@ -94,7 +94,7 @@ class MyCoins
94
94
 
95
95
  if @portfolio and \
96
96
  DateTime.parse(@portfolio.datetime) + 60 > DateTime.now then
97
- return @portfolio
97
+ return @portfolio
98
98
  end
99
99
 
100
100
  a = build_records()
@@ -117,7 +117,7 @@ class MyCoins
117
117
  net_profit: sum(a, :profit).round(2)
118
118
  }
119
119
 
120
- @portfolio = OpenStruct.new(h).freeze
120
+ @portfolio = OpenStruct.new(h)
121
121
 
122
122
  end
123
123
 
@@ -173,9 +173,10 @@ class MyCoins
173
173
 
174
174
  end
175
175
 
176
- def format_portfolio(r)
176
+ def format_portfolio(r, order_by: :rank)
177
177
 
178
- coins = r.records.sort_by{|x| x[:rank]}.map {|x| x.values}
178
+ coins = r.records.sort_by {|x| -x[order_by].to_f}.map {|x| x.values}
179
+ coins.reverse! if order_by == :rank
179
180
 
180
181
  labels = %w(Rank Name Qty btc_price) \
181
182
  + ["paid(#{@mycurrency}):", 'value(USD):']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mycoins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -30,7 +30,7 @@ cert_chain:
30
30
  sCz5KsiHA9vj8OfrxhYrEb+ML4+J28Umdki7V1vgnQWmnI+Ok2SWlkScgzcmGXF6
31
31
  TJ4=
32
32
  -----END CERTIFICATE-----
33
- date: 2018-01-07 00:00:00.000000000 Z
33
+ date: 2018-01-08 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: dynarex
metadata.gz.sig CHANGED
Binary file