Module: Cryptum::API::ExchangeRates

Defined in:
lib/cryptum/api/exchange_rates.rb

Overview

Module specifically related to orders history retrieval.

Class Method Summary collapse

Class Method Details

.get(opts = {}) ⇒ Object

Obtain latest order history



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/cryptum/api/exchange_rates.rb', line 9

public_class_method def self.get(opts = {})
  option_choice = opts[:option_choice]
  env = opts[:env]

  api_endpoint = 'https://api.coinbase.com/v2'
  exchange_rates_api_call = '/exchange-rates'

  # We don't always get fees back from Coinbase...
  # This is a hack to ensure we do.
  Cryptum::API::Rest.call(
    option_choice: option_choice,
    env: env,
    http_method: :GET,
    api_endpoint: api_endpoint,
    api_call: exchange_rates_api_call
  )
rescue Interrupt, StandardError => e
  Cryptum::Log.append(level: :error, msg: e, which_self: self)
end

.helpObject

Display Usage for this Module



30
31
32
33
34
35
36
37
# File 'lib/cryptum/api/exchange_rates.rb', line 30

public_class_method def self.help
  puts "USAGE:
    fees = #{self}.get(
      env: 'required - Coinbase::Option::Environment.get Object',
      option_choice: 'required - Coinbase::Option::Choice Object'
    )
  "
end