exchange_rate_jt 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/exchange_rate_jt/exchange_rates.rb +13 -1
- data/lib/exchange_rate_jt/rates_source/ecb.rb +5 -0
- data/lib/exchange_rate_jt/version.rb +1 -1
- data/lib/exchange_rate_jt.rb +4 -0
- metadata +2 -3
- data/exchange_rate_jt-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb82ff5947113e39fe9242747fbb0b70acb6c4a3
|
4
|
+
data.tar.gz: 7f2eb28c19dc95945331df905da3c752e8dbb638
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e344c8367ddc64f25c73a6ed18dbf4f8aa1a1bf0dfec70d12971147152365d306f4e351c9af29acb80242967db55f9054a8373bb173ea595850dbbd3be74982
|
7
|
+
data.tar.gz: 64354fb02a28cab40199ef9ed1789bd16348ed2b44297f83bb47b4723595008988a22972e8a62a668de90ce1868478c382db7de6dec3fc5cc8ba44fa37ece869
|
data/.gitignore
CHANGED
@@ -14,7 +14,7 @@ module ExchangeRateJt
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def update
|
17
|
-
rates =
|
17
|
+
rates = rates_source.fetch_rates
|
18
18
|
rates.each { |date, values| data_store.persist(date, values) }
|
19
19
|
true
|
20
20
|
rescue => exception
|
@@ -33,6 +33,10 @@ module ExchangeRateJt
|
|
33
33
|
{ status: :success, rate: BigDecimal.new(rate, 5) }
|
34
34
|
end
|
35
35
|
|
36
|
+
def currency_list
|
37
|
+
rates_source.currency_list
|
38
|
+
end
|
39
|
+
|
36
40
|
private
|
37
41
|
|
38
42
|
attr_reader :configuration
|
@@ -41,6 +45,14 @@ module ExchangeRateJt
|
|
41
45
|
@data_store ||= build_data_store
|
42
46
|
end
|
43
47
|
|
48
|
+
def rates_source
|
49
|
+
@rates_source ||= build_rates_source
|
50
|
+
end
|
51
|
+
|
52
|
+
def build_rates_source
|
53
|
+
RatesSourceFactory.build(configuration.source)
|
54
|
+
end
|
55
|
+
|
44
56
|
def build_data_store
|
45
57
|
DataStoreFactory
|
46
58
|
.build(configuration.data_store_type, configuration.data_store)
|
@@ -8,12 +8,17 @@ module ExchangeRateJt
|
|
8
8
|
|
9
9
|
class ECB
|
10
10
|
REPOSITORY_URL = 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml'.freeze
|
11
|
+
CURRENCY_LIST = %w(AUD BGN BRL CAD CHF CNY CZK DKK GBP HKD HRK HUF IDR ILS INR JPY KRW MXN MYR NOK NZD PHP PLN RON RUB SEK SGD THB TRY USD ZAR).freeze
|
11
12
|
|
12
13
|
def fetch_rates
|
13
14
|
doc = fetch_source
|
14
15
|
parse(doc)
|
15
16
|
end
|
16
17
|
|
18
|
+
def currency_list
|
19
|
+
CURRENCY_LIST
|
20
|
+
end
|
21
|
+
|
17
22
|
private
|
18
23
|
|
19
24
|
def fetch_source
|
data/lib/exchange_rate_jt.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exchange_rate_jt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Toper
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,7 +84,6 @@ files:
|
|
84
84
|
- Rakefile
|
85
85
|
- bin/console
|
86
86
|
- bin/setup
|
87
|
-
- exchange_rate_jt-0.1.0.gem
|
88
87
|
- lib/exchange_rate_jt.rb
|
89
88
|
- lib/exchange_rate_jt/configuration.rb
|
90
89
|
- lib/exchange_rate_jt/data_store/p_store_adaptor.rb
|
data/exchange_rate_jt-0.1.0.gem
DELETED
Binary file
|