Tableau Trusted Interface for Ruby
Wrapper for embedding Tableau workbooks using the Tableau trusted interface.
Installation
Add to your Gemfile:
gem 'tableau_trusted_interface'
You have the option of specifying a default server address and user:
TableauTrustedInterface.configure do |config|
config.default_tableau_server = 'http://example.com'
config.default_tableau_user = 'foobar'
end
Usage
Instantiate the interface by specifying which workbook you want and the embed params you wish to use:
@report = TableauTrustedInterface::Report.new(
path: 'project/workbook',
embed_params: { embed: 'yes', toolbar: 'no' }
)
You can optionally pass user: and server: options here too if you don’t want to use the configured defaults.
This would typically be put in a Rails controller, providing you access to the following methods in your view:
@report.report_url@report.report_embed_url
For convenience, this is how you embed the report in a responsive Bootstrap 3 iframe:
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="<%= @report.report_embed_url %>"></iframe>
</div>
License
See the LICENSE file for license rights and limitations (MIT).