Sha256: 753d83a4d95434b816bbc391dea6172a16249551dac5e5d0d7bc50ecb9d5de3c

Contents?: true

Size: 677 Bytes

Versions: 2

Compression:

Stored size: 677 Bytes

Contents

# frozen_string_literal: true

module CoinMarketCapitalization
  # GlobalMetrics class containing methods that map to API endpoints for global aggregate market data.
  # This category currently includes 2 endpoints
  class GlobalMetrics < Base
    BASE_URL = "https://pro-api.coinmarketcap.com/v1/global-metrics"
    END_POINT_ENTRIES = %w[
      quotes/latest
      quotes/historical
    ].freeze

    def initialize(api_key:, base_url: BASE_URL, adapter: Faraday.default_adapter)
      super
    end

    END_POINT_ENTRIES.each do |end_point|
      define_method(end_point.tr("/-", "_").to_sym) do |**args|
        make_request(end_point, **args)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
coin_market_capitalization-0.1.2 lib/coin_market_capitalization/global_metrics.rb
coin_market_capitalization-0.1.1 lib/coin_market_capitalization/global_metrics.rb