Class: CryptoTracker::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/crypto_tracker/client.rb

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.get(endpoint, params = {}) ⇒ Object



9
10
11
12
13
14
# File 'lib/crypto_tracker/client.rb', line 9

def self.get(endpoint, params = {})
  response = Faraday.get("#{BASE_URL}/#{endpoint}", params)
  JSON.parse(response.body)
rescue StandardError => e
  { error: e.message }
end