Class: CurrencyQuote::Currency
- Inherits:
-
Object
- Object
- CurrencyQuote::Currency
- Defined in:
- lib/currency_quote/currency.rb
Constant Summary collapse
- BASE_URL =
"https://www.bcra.gob.ar/publicacionesestadisticas/Cotizaciones_por_fecha_2.asp"
Instance Attribute Summary collapse
-
#buy ⇒ Object
Returns the value of attribute buy.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#date ⇒ Object
Returns the value of attribute date.
-
#doc ⇒ Object
Returns the value of attribute doc.
-
#dolar ⇒ Object
Returns the value of attribute dolar.
-
#quote ⇒ Object
Returns the value of attribute quote.
-
#sell ⇒ Object
Returns the value of attribute sell.
Instance Method Summary collapse
- #get_quotation ⇒ Object
-
#initialize(currency:, date:) ⇒ Currency
constructor
A new instance of Currency.
Constructor Details
#initialize(currency:, date:) ⇒ Currency
Returns a new instance of Currency.
10 11 12 13 14 |
# File 'lib/currency_quote/currency.rb', line 10 def initialize(currency:, date: ) @currency = currency @date = date @dolar = dolar end |
Instance Attribute Details
#buy ⇒ Object
Returns the value of attribute buy.
6 7 8 |
# File 'lib/currency_quote/currency.rb', line 6 def buy @buy end |
#currency ⇒ Object
Returns the value of attribute currency.
6 7 8 |
# File 'lib/currency_quote/currency.rb', line 6 def currency @currency end |
#date ⇒ Object
Returns the value of attribute date.
6 7 8 |
# File 'lib/currency_quote/currency.rb', line 6 def date @date end |
#doc ⇒ Object
Returns the value of attribute doc.
6 7 8 |
# File 'lib/currency_quote/currency.rb', line 6 def doc @doc end |
#dolar ⇒ Object
Returns the value of attribute dolar.
6 7 8 |
# File 'lib/currency_quote/currency.rb', line 6 def dolar @dolar end |
#quote ⇒ Object
Returns the value of attribute quote.
6 7 8 |
# File 'lib/currency_quote/currency.rb', line 6 def quote @quote end |
#sell ⇒ Object
Returns the value of attribute sell.
6 7 8 |
# File 'lib/currency_quote/currency.rb', line 6 def sell @sell end |
Instance Method Details
#get_quotation ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/currency_quote/currency.rb', line 16 def get_quotation begin get_dolar_quotation make_get_to_bcra get_currency_quotation rescue Timeout::Error => e @sell = @buy = @quote = 0 end return struct end |