currency_quote 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/currency_quote/currency.rb +8 -5
- data/lib/currency_quote/dolar.rb +13 -5
- data/lib/currency_quote/version.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: 497ba47e3157da48f395e426c66c2a08f1f1fc383d5de2ec45b9c677b33d4b78
|
4
|
+
data.tar.gz: 59f706e2f84045c6544df5f657a434d22c1408098737ddb805db2731475acd47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65f36c0830126a87310b1e2dee724b12fbb5cd4e6b1d4350762570e66cc97a285586d08396827a8658a5bf604717f1efe1c7c4f29416aafb729266681e103f85
|
7
|
+
data.tar.gz: 585b42b3b3b6ff2a3dcaeb307e52148494e2a45a5d3ead721a63e45cb5f9328ad003093feecba23c31ee65fc2152a19d8d15265d1b025342e4f7bf6cdb5d3570
|
data/Gemfile.lock
CHANGED
@@ -15,10 +15,13 @@ class CurrencyQuote::Currency
|
|
15
15
|
|
16
16
|
def get_quotation
|
17
17
|
if currency == "Dolar Estadounidense"
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
begin
|
19
|
+
get_dolar_quotation
|
20
|
+
make_get_to_bcra
|
21
|
+
get_currency_quotation
|
22
|
+
rescue Timeout::Error => e
|
23
|
+
@sell = @buy = @quote = 0
|
24
|
+
end
|
22
25
|
return struct
|
23
26
|
end
|
24
27
|
end
|
@@ -44,7 +47,7 @@ class CurrencyQuote::Currency
|
|
44
47
|
@sell = (dolar.sell * pass).to_f
|
45
48
|
@buy = (dolar.buy * pass).to_f
|
46
49
|
else
|
47
|
-
@sell = @buy = 0
|
50
|
+
@sell = @buy = @quote = 0
|
48
51
|
end
|
49
52
|
end
|
50
53
|
|
data/lib/currency_quote/dolar.rb
CHANGED
@@ -13,8 +13,12 @@ class CurrencyQuote::Dolar
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def get_quotation
|
16
|
-
|
17
|
-
|
16
|
+
begin
|
17
|
+
make_get_to_bna
|
18
|
+
extract_data
|
19
|
+
rescue Timeout::Error => e
|
20
|
+
@data = @sell = @buy = 0
|
21
|
+
end
|
18
22
|
return struct
|
19
23
|
end
|
20
24
|
|
@@ -35,9 +39,13 @@ class CurrencyQuote::Dolar
|
|
35
39
|
|
36
40
|
def extract_data
|
37
41
|
data = @doc.css("td").map(&:text)
|
38
|
-
|
39
|
-
|
40
|
-
|
42
|
+
if data.empty?
|
43
|
+
@data = @sell = @buy = 0
|
44
|
+
else
|
45
|
+
@date = data[data.size - 1]
|
46
|
+
@sell = data[data.size - 2].gsub(",", ".").to_f
|
47
|
+
@buy = data[data.size - 3].gsub(",", ".").to_f
|
48
|
+
end
|
41
49
|
end
|
42
50
|
|
43
51
|
def struct
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: currency_quote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Facundo A. Díaz Martínez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|