Class: CurrencyQuote::Dolar

Inherits:
Object
  • Object
show all
Defined in:
lib/currency_quote/dolar.rb

Constant Summary collapse

BASE_URL =
"https://www.bna.com.ar/Cotizador/HistoricoPrincipales"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date:) ⇒ Dolar

Returns a new instance of Dolar.



11
12
13
# File 'lib/currency_quote/dolar.rb', line 11

def initialize(date:)
  @date = date
end

Instance Attribute Details

#buyObject

Returns the value of attribute buy.



7
8
9
# File 'lib/currency_quote/dolar.rb', line 7

def buy
  @buy
end

#dateObject

Returns the value of attribute date.



7
8
9
# File 'lib/currency_quote/dolar.rb', line 7

def date
  @date
end

#docObject

Returns the value of attribute doc.



7
8
9
# File 'lib/currency_quote/dolar.rb', line 7

def doc
  @doc
end

#sellObject

Returns the value of attribute sell.



7
8
9
# File 'lib/currency_quote/dolar.rb', line 7

def sell
  @sell
end

Instance Method Details

#get_quotationObject



15
16
17
18
19
20
21
22
23
# File 'lib/currency_quote/dolar.rb', line 15

def get_quotation
  begin
    make_get_to_bna
    extract_data
  rescue Timeout::Error => e
    @data = @sell = @buy = 0
  end
  return struct
end