A wrapper for Cubes OLAP Server.
Add this line to your application's Gemfile:
gem 'cubes'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cubes
You can configure the Cubes::Client pass configuration options to the constructor.
client = Cubes::Client.new(base_url: 'http://your-cubes-server:5000')
By default, the client uses: base_url: 'http://localhost:5000'
.
List all cubes
client.cubes
Fetching the model specification of a cube
cube = client.cube('sales')
cube.model
*Aggregate the measures of a cube
cube = client.cube('sales')
cube.aggregate(cut: 'date:2016')
cube.aggregate(cut: 'date:2016,5', drilldown: 'date')
Generating reports
report = {
summary: {
query: :aggregate
},
by_year: {
query: :aggregate
drilldown: [:date],
rollup: :date
}
}
cube = client.cube('sales')
cube.report(report_data, cut: 'date:2016')
Bug reports and pull requests are welcome on GitHub at https://github.com/ntxcode/cubes.
The gem is available as open source under the terms of the MIT License.