0.02
Low commit activity in last 3 years
A long-lived project that still receives updates
Ruby interface to the Tableau API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 0.10
~> 3.6
~> 3.0
~> 6.0
~> 13.0
~> 1.91

Runtime

~> 3.2
~> 0.24
~> 0.7
~> 3.7
 Project Readme

tableau_api

CircleCI Gem Version

Ruby interface to the Tableau 9.0 API.

Installation

Add this line to your application's Gemfile:

gem 'tableau_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tableau_api

Usage

Basic Authentication

client = TableauApi.new(host: 'https://tableau.domain.tld', site_name: 'Default', username: 'ExampleUsername', password: 'ExamplePassword')
client.users.create(username: 'baz')

Trusted Authentication

client = TableauApi.new(host: 'https://tableau.domain.tld', site_name: 'Default', username: 'ExampleUsername')
client.auth.trusted_ticket

Workbooks

# find a workbook by name
workbook = client.workbooks.list.find do |w|
  w['name'] == 'Example Workbook Name'
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake to run the tests and linters. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Testing

Docker

A development image is provided so you don't need a local Ruby toolchain. The image and the installed gems are kept per Ruby version, so versions don't interfere with each other.

docker compose run --rm dev bundle install
docker compose run --rm dev bundle exec rake

This uses Ruby 3.4 by default. To run against another supported Ruby (3.3 and newer), set RUBY_VERSION on the same commands. The image is built the first time a version is used:

RUBY_VERSION=3.3 docker compose run --rm dev bundle install
RUBY_VERSION=3.3 docker compose run --rm dev bundle exec rake

Creating New VCR Cassettes

Cassettes should be self-contained, generated by a single spec file run in defined order. To make changes to specs, it's best to delete a whole cassette and rerun the whole spec file, except for auth.yml, since it could be difficult to generate a trusted ticket from a non-trusted host.

To regenerate all the the cassettes, you'll first need to create the following on the Tableau server:

  • Site: Default
  • Site: TestSite
  • Datasource: test (this might need to be created from Tableau Desktop)
  • Username: test_test

And delete the following if they exist:

  • Group: testgroup (probably under TestSite)
  • Project: test_project (probably under Default)
  • Site: Test Site 2
  • User: test (probably under TestSite)
  • Workbook: test
  • Workbook: testpublish

Set the environment variables below to an administrator account and your Tableau Server hostname.

Then run the commands below:

docker run -it -d \
  -v $(pwd):/src \
  -e TABLEAU_HOST -e TABLEAU_ADMIN_USERNAME -e TABLEAU_ADMIN_PASSWORD \
  ruby /bin/bash
docker exec -it CONTAINER_ID /bin/bash -c "cd /src && bundle && rake"

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/civisanalytics/tableau_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

tableau_api is released under the BSD 3-Clause License.