Sha256: 335584d3eba34054e355f6f048adaa0135e740a24421d55a2bf8238e1c961355
Contents?: true
Size: 695 Bytes
Versions: 2
Compression:
Stored size: 695 Bytes
Contents
require 'business_time' require 'haml' require 'mongoid' require "iro/engine" class Iro::Iro def self.get_coins out = HTTParty.get( "https://pro-api.coinmarketcap.com/v2/cryptocurrency/quotes/latest?slug=bitcoin,ethereum", { headers: { 'X-CMC_PRO_API_KEY' => COINMARKETCAP[:key] }, }) out = out.parsed_response.deep_symbolize_keys out[:data].each do |k, item| opi = Iro::Datapoint.new({ kind: Iro::Datapoint::KIND_CRYPTO, symbol: item[:symbol], quote_at: item[:quote][:USD][:last_updated], value: item[:quote][:USD][:price], volume: item[:quote][:USD][:volume_24h], }) opi.save! end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
iron_warbler-2.0.7.35 | lib/iron_warbler.rb |
iron_warbler-2.0.7.34 | lib/iron_warbler.rb |