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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6578546e1c600d31c863bb8595417a54c6f49e9
4
- data.tar.gz: 50f297829ff304dbe48516d5d4a6871aa4a04f7b
3
+ metadata.gz: 0ff6f1a76f1000bf5d8b5538269128ac8c86e612
4
+ data.tar.gz: b03928212cfc737e58cc637f4f806b05e68ca278
5
5
  SHA512:
6
- metadata.gz: a5bd4af63f45e6b0856c3aaddda4cc2bbf173dab8eef549adfdef49f6c8afea2643fabe548525af5cb756cac85f7dd0ef121b1c35d5aa13d5f72058f5ed7180e
7
- data.tar.gz: 67288a8b6a28bfb7393a265f572e9a3941539398f33c8afa86a514c4df400d84a9783f39422bb131ecaa2598283bb0c47ab2436049dbf795d00f2825e03df8e0
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.
@@ -27,12 +27,12 @@ module Arbolito
27
27
  rate.convert(money)
28
28
  end
29
29
 
30
- def exchange=(exchange)
31
- @@exchange = exchange
30
+ def settings
31
+ @settings ||= {}
32
32
  end
33
33
 
34
- def expiration_time=(seconds)
35
- @@expiration_time = seconds
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
- @@store ||= Store::Memory
57
+ settings[:store] ||= Store::Memory
58
58
  end
59
59
 
60
60
  def exchange
61
- @@exchange ||= Exchange::YahooFinance
61
+ settings[:exchange] ||= Exchange::YahooFinance
62
62
  end
63
63
 
64
64
  def expiration_time
65
- @@expiration_time ||= 60
65
+ settings[:expiration_time] ||= 60
66
66
  end
67
67
  end
68
68
  end
@@ -1,3 +1,3 @@
1
1
  module Arbolito
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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-22 00:00:00.000000000 Z
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler