Class: TableauServerClient::Resources::Workbook
- Includes:
- Downloadable
- Defined in:
- lib/tableau_server_client/resources/workbook.rb
Instance Attribute Summary collapse
-
#content_url ⇒ Object
readonly
Returns the value of attribute content_url.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
- #owner ⇒ Object
-
#owner_id ⇒ Object
readonly
Returns the value of attribute owner_id.
-
#project_id ⇒ Object
readonly
Returns the value of attribute project_id.
-
#show_tabs ⇒ Object
readonly
Returns the value of attribute show_tabs.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#webpage_url ⇒ Object
readonly
Returns the value of attribute webpage_url.
Class Method Summary collapse
Instance Method Summary collapse
- #add_tags!(tags) ⇒ Object
- #connections ⇒ Object
- #delete_tag!(tag) ⇒ Object
- #embedded_datasources ⇒ Object
- #project ⇒ Object
- #to_request ⇒ Object
- #update! ⇒ Object
- #views ⇒ Object
Methods included from Downloadable
Methods inherited from Resource
attr_reader, attributes, #attributes, #delete!, extract_attributes, extract_site_path, #initialize, location, #location, #path, plural_resource_name, resource_name, #server_url, #site_id, #site_path
Methods included from TableauServerClient::RequestBuilder
Constructor Details
This class inherits a constructor from TableauServerClient::Resources::Resource
Instance Attribute Details
#content_url ⇒ Object (readonly)
Returns the value of attribute content_url.
14 15 16 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 14 def content_url @content_url end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
14 15 16 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 14 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
14 15 16 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 14 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 14 def name @name end |
#owner ⇒ Object
40 41 42 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 40 def owner @owner ||= @client.get User.location(site_path, @owner_id) end |
#owner_id ⇒ Object (readonly)
Returns the value of attribute owner_id.
14 15 16 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 14 def owner_id @owner_id end |
#project_id ⇒ Object (readonly)
Returns the value of attribute project_id.
14 15 16 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 14 def project_id @project_id end |
#show_tabs ⇒ Object (readonly)
Returns the value of attribute show_tabs.
14 15 16 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 14 def show_tabs @show_tabs end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
14 15 16 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 14 def size @size end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
14 15 16 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 14 def end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
14 15 16 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 14 def updated_at @updated_at end |
#webpage_url ⇒ Object (readonly)
Returns the value of attribute webpage_url.
14 15 16 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 14 def webpage_url @webpage_url end |
Class Method Details
.from_collection_response(client, path, xml) ⇒ Object
25 26 27 28 29 30 |
# 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) ⇒ Object
17 18 19 20 21 22 23 |
# 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 |
Instance Method Details
#add_tags!(tags) ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 61 def () request = build_request {|b| b. { .each do |t| b.tag(label: t) end } } resp = @client.update(self, path: "#{path}/tags", request: request) end |
#connections ⇒ Object
32 33 34 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 32 def connections @client.get_collection Connection.location(path) end |
#delete_tag!(tag) ⇒ Object
72 73 74 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 72 def delete_tag!(tag) @client.delete(self, path: "#{path}/tags/#{tag}") end |
#embedded_datasources ⇒ Object
76 77 78 79 80 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 76 def download.xpath('//datasources//datasource').map do |ds| Datasource::DatasourceContent.new(ds) end end |
#project ⇒ Object
36 37 38 |
# 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 ⇒ Object
48 49 50 51 52 53 54 55 |
# 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! ⇒ Object
57 58 59 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 57 def update! @client.update self end |
#views ⇒ Object
44 45 46 |
# 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 |