exchange-rates 0.0.5 → 0.0.6

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
- SHA1:
3
- metadata.gz: 9138d55047059c7bfeea076e1f8db9d81e8fa60f
4
- data.tar.gz: 2d5052c001791b2cb11dea3355a03e11b12a81f4
2
+ SHA256:
3
+ metadata.gz: 7c7563c4e66008860d08428e8f1b748f68c0184c8f350676b25f325b2fd46584
4
+ data.tar.gz: 0c06cec674c0c7040f5b681eeeb37300a97a091f4ff3fed6a657b1083f66de38
5
5
  SHA512:
6
- metadata.gz: ef5ee2cd127044b7a3856f89759c2c7e6727bd0f4ca56d0e7bcaf1837caa21626bcf442a6ac8e1a6bba0d202a1a934cd21ade038acba79240b7f2f3a816ce476
7
- data.tar.gz: 2db2837e68082b8233bf200fbcaeb0d6a752b3e86fc481d8d8c0f4f016074b614fdc3035872ce245bef23d3cda23f32e836089bce0ae0e9c3bcf9d090ffdd84a
6
+ metadata.gz: 6f577cca84cb2fc0df29c55522de0df8cbad879e7c084b5130cb75fb18837ff718a3e378703e5e632c3d4677995e7d4fb88f0525407ce7e9e2e6aa4b4969c3a5
7
+ data.tar.gz: 032b889cd456c9d609c0a38b0be2b0f19aa234de6f71c8adf6fc8ae8f7083719b66b790b6b67fffaae31787db509961a18c65e7d45ee07687accc21b220a8e15
@@ -8,19 +8,19 @@ module ExchangeRates
8
8
  # Country.all.map(&:currency_code).uniq - Money::Currency.table.map{|c| c[0].to_s.upcase}
9
9
  NOT_SUPPORTED_CURRENCIES = [nil, '', 'IMP', 'TVD'].freeze
10
10
 
11
- validates :from_currency, presence: true, length: { is: 3 }, format: { with: /\A[A-Z]+\z/}
11
+ validates :from_currency, presence: true, length: { is: 3 }, format: { with: /\A[A-Z]+\z/ }
12
12
  validates :rate_to_base_currency, presence: true, numericality: { greater_than: 0 }
13
13
 
14
14
  def self.convert(amount, from_currency, to_currency = BASE_CURRENCY)
15
15
  case
16
- when amount == 0
17
- 0
18
- when to_currency == from_currency
19
- amount
20
- when to_currency == BASE_CURRENCY
21
- amount * get_rate(from_currency)
22
- else
23
- amount * (get_rate(from_currency) / get_rate(to_currency))
16
+ when amount == 0
17
+ 0
18
+ when to_currency == from_currency
19
+ amount
20
+ when to_currency == BASE_CURRENCY
21
+ amount * get_rate(from_currency)
22
+ else
23
+ amount * (get_rate(from_currency) / get_rate(to_currency))
24
24
  end
25
25
  end
26
26
 
@@ -1,3 +1,3 @@
1
1
  module ExchangeRates
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,57 +1,63 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exchange-rates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - aloha
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-13 00:00:00.000000000 Z
11
+ date: 2019-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: money
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '6.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4.2'
26
+ version: '6.7'
27
27
  - !ruby/object:Gem::Dependency
28
- name: money
28
+ name: money-open-exchange-rates
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '6.7'
33
+ version: 1.2.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '6.7'
40
+ version: 1.2.2
41
41
  - !ruby/object:Gem::Dependency
42
- name: money-open-exchange-rates
42
+ name: rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 1.2.2
47
+ version: '4.2'
48
+ - - "<="
49
+ - !ruby/object:Gem::Version
50
+ version: '5.2'
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - "~>"
55
+ - - ">="
53
56
  - !ruby/object:Gem::Version
54
- version: 1.2.2
57
+ version: '4.2'
58
+ - - "<="
59
+ - !ruby/object:Gem::Version
60
+ version: '5.2'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: pg
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -143,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
149
  version: '0'
144
150
  requirements: []
145
151
  rubyforge_project:
146
- rubygems_version: 2.6.11
152
+ rubygems_version: 2.7.7
147
153
  signing_key:
148
154
  specification_version: 4
149
155
  summary: Rails ExchangeRates Helper