Class: TableauServerClient::Resources::Datasource
- Defined in:
- lib/tableau_server_client/resources/datasource.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.
-
#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.
Class Method Summary collapse
Instance Method Summary collapse
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.
10 11 12 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 10 def content_url @content_url end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 10 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 10 def id @id end |
#is_certified ⇒ Object (readonly)
Returns the value of attribute is_certified.
10 11 12 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 10 def is_certified @is_certified end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 10 def name @name end |
#owner ⇒ Object
36 37 38 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 36 def owner @owner ||= @client.get User.location(site_path, @owner_id) end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
10 11 12 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 10 def type @type end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
10 11 12 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 10 def updated_at @updated_at end |
Class Method Details
.from_collection_response(client, path, xml) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 21 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
13 14 15 16 17 18 19 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 13 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
28 29 30 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 28 def connections @client.get_collection Connection.location(path) end |
#project ⇒ Object
32 33 34 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 32 def project @project ||= @client.get_collection(Project.location(site_path)).find {|p| p.id == @project_id } end |
#to_request ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 40 def to_request request = build_request {|b| b.datasource {|w| w.owner(id: owner.id) } } end |
#update! ⇒ Object
48 49 50 |
# File 'lib/tableau_server_client/resources/datasource.rb', line 48 def update! @client.update self end |