currency_quote 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1445f01c79f6c6c01212e23d903b698fd6e0df3ef8ecff16b4be35beae436f35
4
- data.tar.gz: 0361676c60c807d0ca818df20e727fc6564ccd61fa1ac5c4886af584f550b054
3
+ metadata.gz: 403e17ea3aacaa228865ab8672a3187971105d9e9ca988ba872151078564896f
4
+ data.tar.gz: d8d0b773152e7fffe3013a56f70def54d2d3d6d2eb8959d3d1e07da73a91e5bf
5
5
  SHA512:
6
- metadata.gz: cb3e9f08a61b26e866ff2f5271affc5e497defd88c8d22d1304be914b5e99220a7d7f3dbe2b112df9a551348249b1848341c58f7b9faa147a66786a9a4be12de
7
- data.tar.gz: 80c1a02737311812074bd7977d6409e06aea639408e7fe42ae7bf6b40dfa0e98e9c74fe89ad3f560703004d57241a726fadce46ce5aaac65e884f9a317361035
6
+ metadata.gz: 65ac6aa4c42c94321596240aacb69015e4e4f469c0e1246ef6f8fc342e256d2e6f63bc884fc4422aa3cf678b65f345e4d690bbae75c5fe460fb460ca3cdfbcce
7
+ data.tar.gz: 7a66cada67f6c9ae1369d8870afc650dc298b095a97efc349ebbc01b0c365138e8e402442b347afa9b72903b667119e3749a0ff1c8920ef669fa652fdfebd915
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- currency_quote (0.1.9)
4
+ currency_quote (0.2.0)
5
5
  addressable
6
6
  nokogiri
7
7
 
@@ -3,7 +3,7 @@ class CurrencyQuote::Currency
3
3
  require 'nokogiri'
4
4
  require 'date'
5
5
 
6
- attr_accessor :currency, :date, :dolar, :doc, :sell, :buy
6
+ attr_accessor :currency, :date, :dolar, :doc, :sell, :buy, :quote
7
7
 
8
8
  BASE_URL = "https://www.bcra.gob.ar/publicacionesestadisticas/Cotizaciones_por_fecha_2.asp"
9
9
 
@@ -15,8 +15,7 @@ class CurrencyQuote::Currency
15
15
 
16
16
  def get_quotation
17
17
  if currency == "Dolar Estadounidense"
18
- return get_dolar_quotation
19
- else
18
+ get_dolar_quotation
20
19
  get_dolar_quotation
21
20
  make_get_to_bcra
22
21
  get_currency_quotation
@@ -39,17 +38,18 @@ class CurrencyQuote::Currency
39
38
  data = @doc.css("td").map(&:text).collect(&:strip!)
40
39
  index = data.index(currency)
41
40
  if index
42
- quote = data[index + 1].gsub(",", ".").to_f
43
- quote = 1.0 if quote == 0
44
- @sell = (dolar.sell * quote).to_f
45
- @buy = (dolar.buy * quote).to_f
41
+ pass = data[index + 1].gsub(",", ".").to_f
42
+ @quote = data[index + 2].gsub(",", ".").to_f
43
+ pass = 1.0 if pass == 0
44
+ @sell = (dolar.sell * pass).to_f
45
+ @buy = (dolar.buy * pass).to_f
46
46
  else
47
47
  @sell = @buy = 0
48
48
  end
49
49
  end
50
50
 
51
51
  def struct
52
- s = Struct.new(:currency, :date, :sell, :buy)
53
- s.new(currency, date, sell, buy)
52
+ s = Struct.new(:currency, :date, :sell, :buy, :quote)
53
+ s.new(currency, date, sell, buy, quote)
54
54
  end
55
55
  end
@@ -1,3 +1,3 @@
1
1
  module CurrencyQuote
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: currency_quote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Facundo A. Díaz Martínez