Sha256: 61a8ca1df13db9ad93d313ee990214adfe4815dbeef844898b06b6a1b68a8c97
Contents?: true
Size: 922 Bytes
Versions: 1
Compression:
Stored size: 922 Bytes
Contents
# frozen_string_literal: true module CoinmarketcapFree # Get static image of a coin from coinmarketcap.com module Icons class << self # Get coin logo URI # # logo = CoinmarketcapFree.img_coin(1, 64) # # Result: # "https://s2.coinmarketcap.com/static/img/coins/64x64/1.png" # # @param [Integer] id_coin Identify coin. For example, bitcoin has 1 # @param [Integer] size Choose one size: 64, 128, 200 # @return [String] Return URI from coinmarketcap def get_coin_logo_uri(id_coin, size) size_x_size = case size when 64, 128, 200 "#{size}x#{size}" else raise ArgumentError, "Can't find this value: #{size}" end "https://s2.coinmarketcap.com/static/img/coins/#{size_x_size}/#{id_coin}.png" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coinmarketcap_free-0.1.5 | lib/coinmarketcap_free/icons.rb |