Sha256: 5e0bd404c0c93961ad416e95a4755d468a384a2e1f7f5c5e504384e02b215993

Contents?: true

Size: 565 Bytes

Versions: 3

Compression:

Stored size: 565 Bytes

Contents

# frozen_string_literal: true

require 'uri'
require 'net/http'
require 'openssl'
require 'json'

module CoinmarketcapFree
  BASE_URI = 'https://api.coinmarketcap.com/data-api/'
  VERSION_API = 'v3'

  # Helper module for CoinmarketcapFree
  module Helper
    class << self
      def http_get(url, data = nil)
        uri = URI(generate_url(url, data))
        Net::HTTP.get(uri)
      end

      private

      def generate_url(url, data = nil)
        "#{url}#{data ? '?' : ''}#{data.map { |key, value| "#{key}=#{value}" }.join('&')}"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
coinmarketcap_free-0.4.1 lib/coinmarketcap_free/helper.rb
coinmarketcap_free-0.4.0 lib/coinmarketcap_free/helper.rb
coinmarketcap_free-0.3.0 lib/coinmarketcap_free/helper.rb