Class: TableauServerClient::Resources::Datasource
- Includes:
- Downloadable
- Defined in:
- lib/tableau_server_client/resources/datasource.rb
Defined Under Namespace
Classes: DatasourceContent
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.
-
#is_certified ⇒ Object
readonly
Returns the value of attribute is_certified.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
- #owner ⇒ Object
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#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
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.
12 13 14 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 12 def content_url @content_url end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
12 13 14 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 12 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 12 def id @id end |
#is_certified ⇒ Object (readonly)
Returns the value of attribute is_certified.
12 13 14 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 12 def is_certified @is_certified end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 12 def name @name end |
#owner ⇒ Object
38 39 40 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 38 def owner @owner ||= @client.get User.location(site_path, @owner_id) end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
12 13 14 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 12 def type @type end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
12 13 14 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 12 def updated_at @updated_at end |
#webpage_url ⇒ Object (readonly)
Returns the value of attribute webpage_url.
12 13 14 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 12 def webpage_url @webpage_url end |
Class Method Details
.from_collection_response(client, path, xml) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 23 def self.from_collection_response(client, path, xml) xml.xpath("//xmlns:datasources/xmlns:datasource").each do |s| id = s['id'] yield from_response(client, "#{path}/#{id}", s) end end |
.from_response(client, path, xml) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 15 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'] #TODO add owner new(client, path, attrs) end |
Instance Method Details
#connections ⇒ Object
30 31 32 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 30 def connections @client.get_collection Connection.location(path) end |
#content ⇒ Object
54 55 56 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 54 def content DatasourceContent.new(download.xpath('//datasource').first) end |
#project ⇒ Object
34 35 36 |
# File 'lib/tableau_server_client/resources/datasource.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 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 42 def to_request request = build_request {|b| b.datasource {|w| w.owner(id: owner.id) } } end |
#update! ⇒ Object
50 51 52 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 50 def update! @client.update self end |