Class: Crypto::Top

Inherits:
Base
  • Object
show all
Defined in:
lib/crypto/resources/top.rb

Constant Summary collapse

PERCENTAGE =
20.0
BASE_IMG_URL =
'https://s2.coinmarketcap.com/static/img/coins/64x64'

Class Method Summary collapse

Methods inherited from Base

binance?, coinex?, load_fixture, test

Class Method Details

.infoObject

rubocop: disable Metrics/MethodLength, Lint/MissingCopEnableDirective



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/crypto/resources/top.rb', line 16

def info
  payload = detail
  if status?(payload)
    news = []

    cryptos(payload).each do |announcement|
      next unless correct_percentage?(announcement.dig('quote', 'USD'))

      news.append(formatting(announcement))
    end

    correct(news)
  else
    error(payload)
  end
end