class TableauServerClient::Resources::Workbook
Attributes
content_url[R]
created_at[R]
id[R]
name[R]
owner[W]
owner_id[R]
project_id[R]
show_tabs[R]
size[R]
updated_at[R]
webpage_url[R]
Public Class Methods
from_collection_response(client, path, xml) { |from_response(client, "#{path}/#{id}", s)| ... }
click to toggle source
# File lib/tableau_server_client/resources/workbook.rb, line 25 def self.from_collection_response(client, path, xml) xml.xpath("//xmlns:workbooks/xmlns:workbook").each do |s| id = s['id'] yield from_response(client, "#{path}/#{id}", s) end end
from_response(client, path, xml)
click to toggle source
# File lib/tableau_server_client/resources/workbook.rb, line 17 def self.from_response(client, path, xml) attrs = extract_attributes(xml) attrs['project_id'] = xml.xpath("xmlns:project")[0]['id'] attrs['owner_id'] = xml.xpath("xmlns:owner")[0]['id'] attrs['tags'] = xml.xpath("xmlns:tags/xmlns:tag").map {|t| t['label'] } new(client, path, attrs) end
Public Instance Methods
connections()
click to toggle source
# File lib/tableau_server_client/resources/workbook.rb, line 32 def connections @client.get_collection Connection.location(path) end
delete_tag!(tag)
click to toggle source
# File lib/tableau_server_client/resources/workbook.rb, line 72 def delete_tag!(tag) @client.delete(self, path: "#{path}/tags/#{tag}") end
embedded_datasources()
click to toggle source
# File lib/tableau_server_client/resources/workbook.rb, line 76 def embedded_datasources download.xpath('//datasources//datasource').map do |ds| Datasource::DatasourceContent.new(ds) end end
owner()
click to toggle source
# File lib/tableau_server_client/resources/workbook.rb, line 40 def owner @owner ||= @client.get User.location(site_path, @owner_id) end
project()
click to toggle source
# File lib/tableau_server_client/resources/workbook.rb, line 36 def project @project ||= @client.get_collection(Project.location(site_path)).find {|p| p.id == project_id } end
to_request()
click to toggle source
# File lib/tableau_server_client/resources/workbook.rb, line 48 def to_request request = build_request {|b| b.workbook {|w| w.owner(id: owner.id) } } request end
update!()
click to toggle source
# File lib/tableau_server_client/resources/workbook.rb, line 57 def update! @client.update self end
views()
click to toggle source
# File lib/tableau_server_client/resources/workbook.rb, line 44 def views @views ||= @client.get_collection(View.location(site_path)).select {|v| v.workbook_id == id } end