danconia 0.2.6 → 0.2.7
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/Gemfile.lock +13 -13
- data/lib/danconia/exchanges/exchange.rb +4 -2
- data/lib/danconia/money.rb +1 -7
- data/lib/danconia/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: baded88d58c693935472d8cc00e274384505ffd9859bca99c1accf4780f7cdf3
|
|
4
|
+
data.tar.gz: 50150e40b421805ff2f383250bb77f741932f66b4f324c9bb935388628521c77
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5c936191102548a99cc30fddd737e95df0e9319adcfe6fbd12cd1d2a6b6b0228566c0f000da74125fbefa47ce63fe13e61417fce00ac69b3da531c71f7de9bb8
|
|
7
|
+
data.tar.gz: '09dffba5565f6c5207a396b943fd23bebe30eec94122ea4c86ade7ebeeebaa12294aa9378eb7cf2c7f7ab99ced0fcc424f81349f1d0c840b44e2cd2038be7733'
|
data/Gemfile.lock
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
danconia (0.2.
|
|
4
|
+
danconia (0.2.7)
|
|
5
5
|
activerecord (>= 3.0.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
activemodel (
|
|
11
|
-
activesupport (=
|
|
12
|
-
activerecord (
|
|
13
|
-
activemodel (=
|
|
14
|
-
activesupport (=
|
|
15
|
-
|
|
16
|
-
activesupport (5.2.0)
|
|
10
|
+
activemodel (6.0.0)
|
|
11
|
+
activesupport (= 6.0.0)
|
|
12
|
+
activerecord (6.0.0)
|
|
13
|
+
activemodel (= 6.0.0)
|
|
14
|
+
activesupport (= 6.0.0)
|
|
15
|
+
activesupport (6.0.0)
|
|
17
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
18
17
|
i18n (>= 0.7, < 2)
|
|
19
18
|
minitest (~> 5.1)
|
|
20
19
|
tzinfo (~> 1.1)
|
|
20
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
|
21
21
|
addressable (2.5.2)
|
|
22
22
|
public_suffix (>= 2.0.2, < 4.0)
|
|
23
|
-
arel (9.0.0)
|
|
24
23
|
coderay (1.1.2)
|
|
25
|
-
concurrent-ruby (1.
|
|
24
|
+
concurrent-ruby (1.1.5)
|
|
26
25
|
crack (0.4.3)
|
|
27
26
|
safe_yaml (~> 1.0.0)
|
|
28
27
|
diff-lcs (1.3)
|
|
@@ -43,7 +42,7 @@ GEM
|
|
|
43
42
|
guard-compat (~> 1.1)
|
|
44
43
|
rspec (>= 2.99.0, < 4.0)
|
|
45
44
|
hashdiff (0.3.7)
|
|
46
|
-
i18n (1.0
|
|
45
|
+
i18n (1.7.0)
|
|
47
46
|
concurrent-ruby (~> 1.0)
|
|
48
47
|
listen (3.1.5)
|
|
49
48
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
@@ -51,7 +50,7 @@ GEM
|
|
|
51
50
|
ruby_dep (~> 1.2)
|
|
52
51
|
lumberjack (1.0.13)
|
|
53
52
|
method_source (0.9.0)
|
|
54
|
-
minitest (5.
|
|
53
|
+
minitest (5.13.0)
|
|
55
54
|
nenv (0.3.0)
|
|
56
55
|
notiffany (0.1.1)
|
|
57
56
|
nenv (~> 0.1)
|
|
@@ -80,7 +79,7 @@ GEM
|
|
|
80
79
|
ruby_dep (1.5.0)
|
|
81
80
|
safe_yaml (1.0.4)
|
|
82
81
|
shellany (0.0.1)
|
|
83
|
-
sqlite3 (1.
|
|
82
|
+
sqlite3 (1.4.1)
|
|
84
83
|
thor (0.20.0)
|
|
85
84
|
thread_safe (0.3.6)
|
|
86
85
|
tzinfo (1.2.5)
|
|
@@ -89,6 +88,7 @@ GEM
|
|
|
89
88
|
addressable (>= 2.3.6)
|
|
90
89
|
crack (>= 0.3.2)
|
|
91
90
|
hashdiff
|
|
91
|
+
zeitwerk (2.1.10)
|
|
92
92
|
|
|
93
93
|
PLATFORMS
|
|
94
94
|
ruby
|
|
@@ -8,7 +8,9 @@ module Danconia
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def rate from, to
|
|
11
|
-
if from ==
|
|
11
|
+
if from == to
|
|
12
|
+
1.0
|
|
13
|
+
elsif from == 'USD' and direct_rate = @store.direct_rate(from, to)
|
|
12
14
|
direct_rate
|
|
13
15
|
elsif to == 'USD' and inverse_rate = @store.direct_rate(to, from)
|
|
14
16
|
(1.0 / inverse_rate).round 6
|
|
@@ -28,4 +30,4 @@ module Danconia
|
|
|
28
30
|
end
|
|
29
31
|
end
|
|
30
32
|
end
|
|
31
|
-
end
|
|
33
|
+
end
|
data/lib/danconia/money.rb
CHANGED
|
@@ -47,16 +47,10 @@ module Danconia
|
|
|
47
47
|
|
|
48
48
|
def exchange_to other_currency
|
|
49
49
|
other_currency = other_currency.presence && Currency.find(other_currency, exchange) || currency
|
|
50
|
-
rate =
|
|
50
|
+
rate = exchange.rate currency.code, other_currency.code
|
|
51
51
|
clone_with amount * rate, other_currency
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
def exchange_rate_to to
|
|
55
|
-
from = currency.code
|
|
56
|
-
return 1 if from == to
|
|
57
|
-
exchange.rate from, to
|
|
58
|
-
end
|
|
59
|
-
|
|
60
54
|
%w(+ - * /).each do |op|
|
|
61
55
|
class_eval <<-EOR, __FILE__, __LINE__ + 1
|
|
62
56
|
def #{op} other
|
data/lib/danconia/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: danconia
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Emmanuel Nicolau
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-11-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|