coinmarketcap_client

CoinmarketcapClient - the Ruby gem for the Coinmarketcap API Swagger Implementation

Define coinmarketcap's api in swagger 2.0 openapi standard

This SDK is automatically generated by the Swagger Codegen project:

  • API version: 1.0.0
  • Package version: 1.0.2
  • Build package: io.swagger.codegen.languages.RubyClientCodegen

Installation

Build a gem

To build the Ruby code into a gem:

gem build coinmarketcap_client.gemspec

Then either install the gem locally:

gem install ./coinmarketcap_client-1.0.2.gem

(for development, run gem install --dev ./coinmarketcap_client-1.0.2.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'coinmarketcap_client', '~> 1.0.2'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'coinmarketcap_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'coinmarketcap_client'

# Setup authorization
CoinmarketcapClient.configure do |config|
  # Configure API key authorization: ApiKeyAuth
  config.api_key['X-CMC_PRO_API_KEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['X-CMC_PRO_API_KEY'] = 'Bearer'
end

api_instance = CoinmarketcapClient::DefaultApi.new

opts = { 
  id: 'id_example', # String | One or more comma-separated CoinMarketCap cryptocurrency IDs. Example \"1,2\"
  symbol: 'symbol_example' # String | Alternatively pass one or more comma-separated cryptocurrency symbols. Example: \"BTC,ETH\". At least one \"id\" or \"symbol\" is required.
}

begin
  #Get metadata
  result = api_instance.cryptocurrency_info_get(opts)
  p result
rescue CoinmarketcapClient::ApiError => e
  puts "Exception when calling DefaultApi->cryptocurrency_info_get: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://pro-api.coinmarketcap.com/v1

Class Method HTTP request Description
CoinmarketcapClient::DefaultApi cryptocurrency_info_get GET /cryptocurrency/info Get metadata
CoinmarketcapClient::DefaultApi cryptocurrency_listings_historical_get GET /cryptocurrency/listings/historical List all cryptocurrencies (historical)
CoinmarketcapClient::DefaultApi cryptocurrency_listings_latest_get GET /cryptocurrency/listings/latest List all cryptocurrencies (latest)
CoinmarketcapClient::DefaultApi cryptocurrency_map_get GET /cryptocurrency/map Get CoinMarketCap ID map
CoinmarketcapClient::DefaultApi global_metrics_quotes_historical_get GET /global-metrics/quotes/historical List all cryptocurrencies (latest)
CoinmarketcapClient::DefaultApi global_metrics_quotes_latest_get GET /global-metrics/quotes/latest Get aggregate market metrics (latest)

Documentation for Models

Documentation for Authorization

ApiKeyAuth

  • Type: API key
  • API key parameter name: X-CMC_PRO_API_KEY
  • Location: HTTP header