omni_exchange 1.1.1 → 1.2.0
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/Gemfile.lock +1 -1
- data/lib/omni_exchange/error.rb +4 -0
- data/lib/omni_exchange/providers/xe.rb +7 -1
- data/lib/omni_exchange/version.rb +1 -1
- data/lib/omni_exchange.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79069dcd87cf3788896dbc2093d114028b94592743a5fea03559cfce974b4d5c
|
4
|
+
data.tar.gz: 03a24de2dcfe6dca9ee1c0532e40b8bab6addbc14c9e4863ef644789a0a24adb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb380807a18d884f6ebef61b911e9a5301f6704577a15b8b4fc75cc11a4e0337ee1c911ea01c9a8269f919f6df62f86225cc9270bf24c8cad753eed0cefa8e2d
|
7
|
+
data.tar.gz: f0909dabbacc96857512b405cc590431ca9df724f622d0e59d589c62e2856e2d6193e992370f4a06d52df2eff7c3f6d1acca1741f5d6c12c9be20c9736b6eef0
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/lib/omni_exchange/error.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable Metrics/AbcSize
|
3
4
|
require 'omni_exchange'
|
4
5
|
|
5
6
|
module OmniExchange
|
@@ -36,7 +37,11 @@ module OmniExchange
|
|
36
37
|
raise e.class, 'xe.com has timed out.'
|
37
38
|
end
|
38
39
|
|
39
|
-
JSON.parse(response.body, symbolize_names: true)
|
40
|
+
body = JSON.parse(response.body, symbolize_names: true)
|
41
|
+
|
42
|
+
raise OmniExchange::XeMonthlyLimit, 'Xe.com monthly limit has been exceeded' if body[:code] == 3
|
43
|
+
|
44
|
+
body[:to][0][:mid].to_d
|
40
45
|
end
|
41
46
|
|
42
47
|
# when this file is required at the top of lib/omni_exchange.rb, this method call is run and allows
|
@@ -44,3 +49,4 @@ module OmniExchange
|
|
44
49
|
OmniExchange::Provider.register_provider(:xe, self)
|
45
50
|
end
|
46
51
|
end
|
52
|
+
# rubocop:enable Metrics/AbcSize
|
data/lib/omni_exchange.rb
CHANGED
@@ -74,7 +74,7 @@ module OmniExchange
|
|
74
74
|
exchanged_amount = rate.to_d * amount.to_d
|
75
75
|
|
76
76
|
return { converted_amount: exchanged_amount, exchange_rate: rate, provider_class: klass }
|
77
|
-
rescue Faraday::Error, Faraday::ConnectionFailed => e
|
77
|
+
rescue Faraday::Error, Faraday::ConnectionFailed, OmniExchange::XeMonthlyLimit => e
|
78
78
|
error_messages << e.inspect
|
79
79
|
end
|
80
80
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omni_exchange
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yun Chung
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|