Module: CoingeckoRuby::Connection

Included in:
Client
Defined in:
lib/coingecko_ruby/connection.rb

Constant Summary collapse

BASE_URL =
'https://api.coingecko.com/api/v3/'.freeze

Instance Method Summary collapse

Instance Method Details

#get(endpoint, **params) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/coingecko_ruby/connection.rb', line 9

def get(endpoint, **params)
  url = BASE_URL + endpoint
  uri = URI(url)
  uri = build_request(uri, params) unless params.empty?
  response = Net::HTTP.get(uri)
  JSON.parse(response)
end