arbolito 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/lib/arbolito.rb +7 -7
- data/lib/arbolito/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ff6f1a76f1000bf5d8b5538269128ac8c86e612
|
4
|
+
data.tar.gz: b03928212cfc737e58cc637f4f806b05e68ca278
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24bb5c6c42112c89f73bdb10810dfcaf8094808177feaeeb8d1f8e8d378c51c2a426e1e740f0c472191b7fdd0cbb9792638ffb23643750c53c8099a137627faa
|
7
|
+
data.tar.gz: 2f8285ad78e8008d1ec509ba5fa0aa3c0e7a13c4e6ce3a6be7be3df5e9775db5d74c93efc540e1d1c8d07c7a4658f940124cbad56762658e62cf4349b3b960d4
|
data/README.md
CHANGED
@@ -13,6 +13,7 @@ It's like your Florida street best companion!
|
|
13
13
|
* You implement your own exchange and configure it
|
14
14
|
* It stores in memory the rates fetched with a configurable expiration time
|
15
15
|
* You can implement your own store and configure it
|
16
|
+
* All the examples use the ISO 4217 code list for Currencies
|
16
17
|
|
17
18
|
## Motivation
|
18
19
|
There were two reason why I've developed this gem.
|
@@ -71,8 +72,21 @@ Arbolito.current_rate('UYU' => 'USD')
|
|
71
72
|
Arbolito.convert(BigDecimal.new(100), 'USD' => 'CLP')
|
72
73
|
=> #<BigDecimal:7f061f35e680,'0.689695E5',18(36)>
|
73
74
|
|
75
|
+
# We can configure Arbolito expiration in seconds
|
76
|
+
Arbolito.set(:expiration_time, 5 * 60)
|
77
|
+
|
78
|
+
# We can implement our own Exchange and configure it in Arbolito
|
79
|
+
Arbolito.set(:exchange, Exchange::FloridaStreet)
|
80
|
+
|
81
|
+
# We can implement our own Store and configure it in Arbolito
|
82
|
+
Arbolito.set(:store, Store::Mongo)
|
83
|
+
|
74
84
|
```
|
75
85
|
|
86
|
+
## Implementing Store and Exchange
|
87
|
+
|
88
|
+
Please take a look at the code to see how you can implement your own stores and exchanges.
|
89
|
+
|
76
90
|
## Contributing
|
77
91
|
|
78
92
|
Bug reports and pull requests are welcome on GitHub at https://github.com/jvillarjeo/arbolito. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
data/lib/arbolito.rb
CHANGED
@@ -27,12 +27,12 @@ module Arbolito
|
|
27
27
|
rate.convert(money)
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
31
|
-
|
30
|
+
def settings
|
31
|
+
@settings ||= {}
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
35
|
-
|
34
|
+
def set(config_key, value)
|
35
|
+
settings[config_key] = value
|
36
36
|
end
|
37
37
|
|
38
38
|
private
|
@@ -54,15 +54,15 @@ module Arbolito
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def store
|
57
|
-
|
57
|
+
settings[:store] ||= Store::Memory
|
58
58
|
end
|
59
59
|
|
60
60
|
def exchange
|
61
|
-
|
61
|
+
settings[:exchange] ||= Exchange::YahooFinance
|
62
62
|
end
|
63
63
|
|
64
64
|
def expiration_time
|
65
|
-
|
65
|
+
settings[:expiration_time] ||= 60
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
data/lib/arbolito/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arbolito
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jvillarejo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|