Class: ArgCurrency
- Inherits:
-
Object
- Object
- ArgCurrency
- Defined in:
- lib/arg-dolarblue-btc.rb
Instance Method Summary collapse
- #get_currencies ⇒ Object
-
#initialize(argv = [""]) ⇒ ArgCurrency
constructor
A new instance of ArgCurrency.
Constructor Details
#initialize(argv = [""]) ⇒ ArgCurrency
Returns a new instance of ArgCurrency.
6 7 8 9 |
# File 'lib/arg-dolarblue-btc.rb', line 6 def initialize(argv=[""]) @urlDolar = 'http://ws.geeklab.com.ar/dolar/get-dolar-json.php' @urlBitstamp = 'https://www.bitstamp.net/api/ticker/' end |
Instance Method Details
#get_currencies ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/arg-dolarblue-btc.rb', line 11 def get_currencies response = HTTParty.get(@urlDolar) json = JSON.parse(response.body) puts '================= DOLAR ================' puts "Dolar Blue:".colorize(:blue).bold.underline + " $#{json['blue']}" puts "Dolar Oficial:".colorize(:green).bold.underline + " $#{json['libre']}" #BTC response = HTTParty.get(@urlBitstamp) json = JSON.parse(response.body) puts '================= BTC ==================' puts 'Last:'.colorize(:light_black).underline + " $#{json['last']}".bold puts 'High:'.colorize(:light_black).underline + " $#{json['high']}" puts 'Low:'.colorize(:light_black).underline + " $#{json['low']}" puts 'Bid:'.colorize(:light_black).underline + " $#{json['bid']}" puts 'Ask:'.colorize(:light_black).underline + " $#{json['ask']}" puts 'Volume:'.colorize(:light_black).underline + " #{json['volume']}" puts '========================================' end |