Sha256: c0ddb6f777c3b63706ffb61de9097ac159efcf5e78dbafa293019954cc6abcf8

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module Cryptum
  # This module is used to Interact with the APIs
  module API
    # Module specifically related to orders history retrieval.
    module ExchangeRates
      # Obtain latest order history
      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 StandardError => e
        raise e
      end

      # Display Usage for this Module
      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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cryptum-0.0.386 lib/cryptum/api/exchange_rates.rb
cryptum-0.0.385 lib/cryptum/api/exchange_rates.rb
cryptum-0.0.384 lib/cryptum/api/exchange_rates.rb
cryptum-0.0.383 lib/cryptum/api/exchange_rates.rb