Module: CryptoTracker
- Defined in:
- lib/crypto_tracker.rb,
lib/crypto_tracker/client.rb,
lib/crypto_tracker/crypto.rb,
lib/crypto_tracker/version.rb
Defined Under Namespace
Constant Summary collapse
- SUPPORTED_CURRENCIES =
%w[usd brl].freeze
- VERSION =
'0.2.1'
Class Method Summary collapse
- .history(coin, days = 30, currency = 'usd') ⇒ Object
- .price(coin, currency = 'usd') ⇒ Object
- .supported_coins ⇒ Object
Class Method Details
.history(coin, days = 30, currency = 'usd') ⇒ Object
14 15 16 |
# File 'lib/crypto_tracker.rb', line 14 def self.history(coin, days = 30, currency = 'usd') Crypto.new(coin, currency).price_history(days) end |
.price(coin, currency = 'usd') ⇒ Object
10 11 12 |
# File 'lib/crypto_tracker.rb', line 10 def self.price(coin, currency = 'usd') Crypto.new(coin, currency).current_price end |
.supported_coins ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/crypto_tracker.rb', line 18 def self.supported_coins response = Client.get('coins/list') unless response.is_a?(Array) puts "Erro ao buscar criptomoedas: #{response}" return [] end response.map { |coin| coin['id'] } end |