convertator 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/convertator.rb +6 -1
- data/lib/convertator/converter.rb +4 -10
- data/lib/convertator/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: 6c1a1c529927924720595fed8a68974586039bba
|
4
|
+
data.tar.gz: a6e16262347e9e634696c054de15ec471cabd932
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3bd34ead3b144c42786fcbff44efb29165eb61ab93a9dc88fb64b3f0a1e155241c917d15fb42cf0a53a7deadd119f8c322639ff11b36724ca850d2488e20c92
|
7
|
+
data.tar.gz: de84c39003a37f5df0eb6654ea6783b064d850f7f089a1794a3262a05f43bcf1c9b3301de12367d9976cd7fc52cdde5b6895058223225695af03a2939612e410
|
data/lib/convertator.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
require 'convertator/version'
|
2
|
+
require 'convertator/utils'
|
3
|
+
require 'convertator/middleware'
|
4
|
+
require 'convertator/converter'
|
5
|
+
require 'convertator/providers/cbr_provider'
|
6
|
+
require 'convertator/providers/static_provider'
|
7
|
+
require 'convertator/middlewares/file_cache_middleware'
|
2
8
|
|
3
9
|
module Convertator
|
4
|
-
# Your code goes here...
|
5
10
|
end
|
@@ -1,10 +1,14 @@
|
|
1
1
|
require 'bigdecimal'
|
2
2
|
require 'bigdecimal/util'
|
3
|
+
require 'convertator/utils'
|
4
|
+
require 'convertator/middleware'
|
3
5
|
|
4
6
|
module Convertator
|
5
7
|
class Converter
|
6
8
|
class UnknownCurrencyError < StandardError; end
|
7
9
|
|
10
|
+
include Convertator::Utils
|
11
|
+
|
8
12
|
attr_reader :provider
|
9
13
|
|
10
14
|
def initialize(provider = :cbr, accuracy = 10)
|
@@ -56,16 +60,6 @@ module Convertator
|
|
56
60
|
|
57
61
|
private
|
58
62
|
|
59
|
-
def symbolize_keys(array)
|
60
|
-
array.each_with_object({}) do |(k, v), memo|
|
61
|
-
memo[normalize_currency(k)] = v
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def normalize_currency(currency)
|
66
|
-
currency.to_sym.upcase
|
67
|
-
end
|
68
|
-
|
69
63
|
def round(value)
|
70
64
|
BigDecimal.save_rounding_mode do
|
71
65
|
BigDecimal.mode(BigDecimal::ROUND_MODE, :half_up)
|
data/lib/convertator/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: convertator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Zinovyev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|