Giter VIP home page Giter VIP logo

tableau-ruby's Introduction

TableauRuby

Unofficial Tableau API Ruby client

Installation

Add this line to your application's Gemfile:

gem 'tableau_ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tableau_ruby

Usage

Setup

require 'rubygems'
require 'tableau_ruby'

Tableau.configure do |config|
	# Required
	config.host = 'https://your-url-here.com'
	config.admin_name = 'your-admin-username'
	config.admin_password = 'your-admin-password'
	# Optional
	config.user_name = 'user-to-act-on-behalf-of'
	config.site_name = 'defaults-to-Default'
end

@client = Tableau::Client.new

# Alternatively pass the information as a hash

@client = Tableau::Client.new(
	host: 'https://your-url-here.com',
	admin_name: 'your-admin-password',
	admin_password: 'your-admin-password'
)

@site = JSON.parse(@client.sites.find_by(name: 'Default'))['site']

@user = Tableau::User.new(@client, JSON.parse(@client.users.find_by(site_id: @site['id'], name: 'user-name'))['user'])
@user.workbooks

Sites

# By default the all request does not include projects in the results
# add them by including include_projects: true
@sites = client.sites.all(include_projects: true)

@site = client.sites.find_by(id: 'site-id') # also try :name and :url
@site = client.sites.create(name: 'Site Name')
@site = client.sites.update(id: 'site-id')
@site = client.sites.delete(id: 'site-id')

Projects

@projects = @client.projects.all()

@project = client.projects.create(name: 'Project Name', site_id: 'project-site-id')
@project = client.projects.update(id: 'project-id', site_id: 'project-site-id')
@project = client.projects.delete(id: 'project-id', site_id: 'project-site-id')

Users

@users = client.users.all(site_id: 'site-id')

@user = client.users.find_by(name: 'user-name', site_id: 'site-id')
@user = client.users.create(name: 'new user', site_id: 'site-id')
@user = client.users.delete(id: 'user-id', site_id: 'site-id')

Workbooks

@workbooks = client.workbooks.all(site_id: 'site-id')
@workbooks = client.workbooks.all(site_id: 'site-id', is_owner: true) # defaults to false

@workbook = client.workbooks.find(id: 'workbook-id', site_id: 'site-id', include_views: true)

@workbook_image = client.workbooks.preview_image(id: 'workbook-id', site_id: 'site-id') # returns the binary image data.

TODO

  • inherit site_id from client object to avoid having to pass site_id
  • consolidate parameter checking
  • error responses
  • make self documenting

Contributing

  1. Fork it ( https://github.com/[my-github-username]/tableau_ruby/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

tableau-ruby's People

Contributors

jvsidler avatar kcollignon avatar orenmazor avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.