class TableauServerClient::Resources::Datasource

Attributes

content_url[R]
created_at[R]
id[R]
is_certified[R]
name[R]
owner[W]
type[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/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) click to toggle source
# 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

Public Instance Methods

connections() click to toggle source
# File lib/tableau_server_client/resources/datasource.rb, line 30
def connections
  @client.get_collection Connection.location(path)
end
content() click to toggle source
# File lib/tableau_server_client/resources/datasource.rb, line 54
def content
  DatasourceContent.new(download.xpath('//datasource').first)
end
owner() click to toggle source
# File lib/tableau_server_client/resources/datasource.rb, line 38
def owner
  @owner ||= @client.get User.location(site_path, @owner_id)
end
project() click to toggle source
# 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() click to toggle source
# 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!() click to toggle source
# File lib/tableau_server_client/resources/datasource.rb, line 50
def update!
  @client.update self
end