dolar-bna 1.2.3 → 1.2.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/dolar/app/models/dolar_cotization.rb +1 -1
- data/lib/dolar/bna/exchange.rb +7 -22
- data/lib/dolar/bna/version.rb +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09c7fa999263bd1bc6d50756a2d3723e362ba365636f94226cd3acb93e6a00d0'
|
4
|
+
data.tar.gz: 993c6a6bd96dc9d149312116cf7f029de8dfa19a311963b146e01a9c0d6171b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57085edeee6ad272dd25a9a6bc4a9cb80dccac92f90185297969462f1752a93e0f48ec7ca9df54fed4a4de793cadd8b42bf9e8fa1272af4d284877d0b95cd71f
|
7
|
+
data.tar.gz: cebdd94e9f7fec3c170f7d4dc26802af512f12b1ad9266ffd87fadd900f44bc891d0134e796bfacd0a378168ee12568e8c1130de7fcad43ab5053b3eb334a02a
|
@@ -9,7 +9,7 @@ module Dolar
|
|
9
9
|
validates_numericality_of :dolar_buy, greater_than: 0, message: 'La cotizacion debe ser mayor a 0'
|
10
10
|
validates_numericality_of :dolar_sell, greater_than: 0, message: 'La cotizacion debe ser mayor a 0'
|
11
11
|
validates_uniqueness_of :date, scope: [:dolar_type, :dolar_sell], message: 'Ya existe una cotización de ese tipo para la fecha ingresada'
|
12
|
-
DOLAR_TYPES = ["Divisa", "Billete"]
|
12
|
+
DOLAR_TYPES = ["Divisa", "Billete", "Blue"]
|
13
13
|
|
14
14
|
validates_inclusion_of :dolar_type, in: DOLAR_TYPES, message: 'Tipo de cotización inválido'
|
15
15
|
|
data/lib/dolar/bna/exchange.rb
CHANGED
@@ -38,8 +38,8 @@ module Dolar
|
|
38
38
|
def variation_billete
|
39
39
|
begin
|
40
40
|
Timeout.timeout(15) do
|
41
|
-
today_dolar =
|
42
|
-
yesterday_dolar =
|
41
|
+
today_dolar = check_cotization("Billete", @fecha)
|
42
|
+
yesterday_dolar = check_cotization("Billete", (@fecha - 1.days))
|
43
43
|
unless (today_dolar.nil? || yesterday_dolar.nil?)
|
44
44
|
porcentual_variation = ((today_dolar[:venta] - yesterday_dolar[:venta]) / (yesterday_dolar[:venta]))
|
45
45
|
porcentual_variation = "#{(porcentual_variation * 100).round(2)}%"
|
@@ -57,32 +57,17 @@ module Dolar
|
|
57
57
|
private
|
58
58
|
|
59
59
|
def check_cotization dolar_type, date
|
60
|
-
query = Dolar::Bna::DolarCotization.where(date: date.to_date, dolar_type: dolar_type).
|
60
|
+
# query = Dolar::Bna::DolarCotization.where(date: date.to_date, dolar_type: dolar_type).first
|
61
61
|
ddolar = nil
|
62
|
-
if query.nil?
|
62
|
+
# if query.nil?
|
63
63
|
if dolar_type == "Divisa"
|
64
64
|
ddolar = get_dolar_divisa()
|
65
65
|
else
|
66
66
|
ddolar = get_dolar()
|
67
67
|
end
|
68
|
-
|
69
|
-
|
70
|
-
end
|
71
|
-
return ddolar
|
72
|
-
end
|
73
|
-
|
74
|
-
def check_cotization_for_variations dolar_type, date
|
75
|
-
query = Dolar::Bna::DolarCotization.where(date: date.to_date, dolar_type: dolar_type).first
|
76
|
-
ddolar = nil
|
77
|
-
if query.nil?
|
78
|
-
if dolar_type == "Divisa"
|
79
|
-
ddolar = get_dolar_divisa()
|
80
|
-
else
|
81
|
-
ddolar = get_dolar()
|
82
|
-
end
|
83
|
-
else
|
84
|
-
ddolar = {compra: query.dolar_buy, venta: query.dolar_sell}
|
85
|
-
end
|
68
|
+
#ddolar = {compra: query.dolar_buy, venta: query.dolar_sell}
|
69
|
+
# else
|
70
|
+
# end
|
86
71
|
return ddolar
|
87
72
|
end
|
88
73
|
|
data/lib/dolar/bna/version.rb
CHANGED
metadata
CHANGED
@@ -1,53 +1,53 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dolar-bna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.3
|
4
|
+
version: 1.2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- LITECODE
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: factory_bot
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 5.0.2
|
20
|
-
- - "
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 5.0.2
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "
|
27
|
+
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 5.0.2
|
30
|
-
- - "
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 5.0.2
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: shoulda-matchers
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 4.0.1
|
40
|
-
- - "
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 4.0.1
|
43
43
|
type: :development
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "
|
47
|
+
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 4.0.1
|
50
|
-
- - "
|
50
|
+
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 4.0.1
|
53
53
|
- !ruby/object:Gem::Dependency
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
|
-
rubygems_version: 3.
|
133
|
+
rubygems_version: 3.3.7
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: Cotizador de USD/ARS
|