Dune 
Welcome to the Ruby SDK of the Dune Analytics API
Installation
dune
is available as a gem on Rubygems To install it, add it to your Gemfile
source "https://rubygems.org"
gem "dune"
Usage
To use the Dune API you'll need to request an API key. The Dune API is currently in private beta.
Official API Documentation
Setting up the client
The underlying HTTP client is Faraday
Here's the properties that can be provided to the constructor
property | required | description |
---|
api_key | true | the API key |
faraday_settings | false | a hash provided to Faraday.new |
logger | false | an instance of Logger, defaults to a null logger |
require "dune"
dune = Dune::Client.new(api_key: ENV["DUNE_API_KEY"])
dune.connection
Available methods
All methods will return the parsed JSON response as a hash.
Should the request fail the call will fail with a Dune::Error
that contains the faraday response
as a property
dune = Dune::Client.new(api_key: ENV["DUNE_API_KEY"])
query_id = 312527
query_response = dune.query(query_id)
dune.execution_status(query_response["execution_id"])
dune.execution(query_response["execution_id"])
dune.cancel(query_response["execution_id"])
Supplying parameters
Supplying parameters works by invoking the same query
method. Make sure your query in Dune accepts parameters.
dex_by_volume_query_id = 312527
json = JSON.generate({ query_parameters: { grouping_parameter: 2 } })
dune.query(dex_by_volume_query_id, json)