Class: Eyeofsatoshi::Coinbase

Inherits:
Base
  • Object
show all
Defined in:
lib/coinbase.rb

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Eyeofsatoshi::Base

Instance Method Details

#parsed_response(response) ⇒ Object



7
8
9
# File 'lib/coinbase.rb', line 7

def parsed_response(response)
  response.dig('data', 'amount').to_f
end

#requestObject



3
4
5
# File 'lib/coinbase.rb', line 3

def request
  super(:get, url)
end

#urlObject



11
12
13
14
# File 'lib/coinbase.rb', line 11

def url
  pair = @options.fetch(:pair, 'usd')
  "https://api.coinbase.com/v2/prices/#{@options[:symbol]}-#{pair}/spot"
end