Wrapper for embedding Tableau workbooks using the Tableau trusted interface.
Add to your Gemfile
:
gem 'tableau_trusted_interface'
You have the option of specifying a default Trusted Authentication server address, view retrieval server address and user:
TableauTrustedInterface.configure do |config|
config.default_tableau_auth_server = 'http://auth.example.com'
config.default_tableau_view_server = 'https://view.example.com'
config.default_tableau_user = 'foobar'
end
As a fallback for both the default_tableau_auth_server
and default_tableau_view_server
options, a default_tableau_server
option can be specified.
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:
, auth_server:
and view_server:
options here too if you don’t want to use the configured defaults. Similar to the configuration, you can also specify a server:
option as a fallback for the latter two.
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>
See the LICENSE file for license rights and limitations (MIT).