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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48afb644b749c77c5d91985392c02ec7cb2d73e9
4
- data.tar.gz: 0a549abf09e60e168daa873e4bd20a51c020b88f
3
+ metadata.gz: bb82ff5947113e39fe9242747fbb0b70acb6c4a3
4
+ data.tar.gz: 7f2eb28c19dc95945331df905da3c752e8dbb638
5
5
  SHA512:
6
- metadata.gz: 36a0be9467da0a50418cf51073029bb359f8c1d57ab5755cf32944bd036d3547d2e7717fcb1c2a31ab567a19fc1e3952df8e989cc2bb0821a02a796227c68cac
7
- data.tar.gz: ea063153886a424481b31bccd2a1a0ce2264041a7a8adafe6b962d63cadf4b245a33e6f0b98bac21a37b866b7b1709d795ea4c738a19be460a29bdd5daf157b0
6
+ metadata.gz: 7e344c8367ddc64f25c73a6ed18dbf4f8aa1a1bf0dfec70d12971147152365d306f4e351c9af29acb80242967db55f9054a8373bb173ea595850dbbd3be74982
7
+ data.tar.gz: 64354fb02a28cab40199ef9ed1789bd16348ed2b44297f83bb47b4723595008988a22972e8a62a668de90ce1868478c382db7de6dec3fc5cc8ba44fa37ece869
data/.gitignore CHANGED
@@ -11,3 +11,4 @@
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
13
  store.*
14
+ *.gem
@@ -14,7 +14,7 @@ module ExchangeRateJt
14
14
  end
15
15
 
16
16
  def update
17
- rates = RatesSourceFactory.build(configuration.source).fetch_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
@@ -1,3 +1,3 @@
1
1
  module ExchangeRateJt
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -29,4 +29,8 @@ module ExchangeRateJt
29
29
  def self.at(date, base, counter)
30
30
  exchange_rates.at(date, base, counter)
31
31
  end
32
+
33
+ def self.currency_list
34
+ exchange_rates.currency_list
35
+ end
32
36
  end
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.0
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-02 00:00:00.000000000 Z
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
Binary file