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
-
#show_tabs ⇒ Object
readonly
Returns the value of attribute show_tabs.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Class Method Summary collapse
Instance Method Summary collapse
- #connections ⇒ Object
- #embedded_datasources ⇒ Object
- #project ⇒ Object
- #to_request ⇒ Object
- #update! ⇒ 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, #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.
13 14 15 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 13 def content_url @content_url end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
13 14 15 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 13 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
13 14 15 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 13 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 13 def name @name end |
#owner ⇒ Object
38 39 40 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 38 def owner @owner ||= @client.get User.location(site_path, @owner_id) end |
#show_tabs ⇒ Object (readonly)
Returns the value of attribute show_tabs.
13 14 15 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 13 def show_tabs @show_tabs end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
13 14 15 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 13 def size @size end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
13 14 15 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 13 def updated_at @updated_at end |
Class Method Details
.from_collection_response(client, path, xml) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 23 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
16 17 18 19 20 21 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 16 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'] new(client, path, attrs) end |
Instance Method Details
#connections ⇒ Object
30 31 32 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 30 def connections @client.get_collection Connection.location(path) end |
#embedded_datasources ⇒ Object
55 56 57 58 59 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 55 def download.xpath('//datasources//datasource').map do |ds| Datasource::DatasourceContent.new(ds) end end |
#project ⇒ Object
34 35 36 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 34 def project @project ||= @client.get_collection(Project.location(site_path)).find {|p| p.id == @project_id } end |
#to_request ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 42 def to_request request = build_request {|b| b.workbook {|w| w.owner(id: owner.id) } } request end |
#update! ⇒ Object
51 52 53 |
# File 'lib/tableau_server_client/resources/workbook.rb', line 51 def update! @client.update self end |