diff --git a/lib/tableau_server_client/resources/project.rb b/lib/tableau_server_client/resources/project.rb index 880c685..810c581 100644 --- a/lib/tableau_server_client/resources/project.rb +++ b/lib/tableau_server_client/resources/project.rb @@ -61,7 +61,7 @@ def hierarchy end def workbooks - @client.get_collection(Workbook.location(site_path, filter: [])).select {|w| + @client.get_collection(Workbook.location(site_path, filter: ["projectName:eq:#{name}"])).select {|w| w.project_id == id } end diff --git a/lib/tableau_server_client/resources/user.rb b/lib/tableau_server_client/resources/user.rb index b3a4423..7ce630e 100644 --- a/lib/tableau_server_client/resources/user.rb +++ b/lib/tableau_server_client/resources/user.rb @@ -29,13 +29,13 @@ def full_name def workbooks @client.get_collection(Workbook.location(site_path, filter: ["ownerName:eq:#{full_name}"])).select do |w| - w.owner.id == id + w.owner_id == id end end def datasources @client.get_collection(Datasource.location(site_path, filter: ["ownerName:eq:#{full_name}"])).select do |d| - d.owner.id == id + d.owner_id == id end end diff --git a/lib/tableau_server_client/resources/view.rb b/lib/tableau_server_client/resources/view.rb index ee48876..cb64a2c 100644 --- a/lib/tableau_server_client/resources/view.rb +++ b/lib/tableau_server_client/resources/view.rb @@ -11,7 +11,9 @@ class View < Resource def self.from_response(client, path, xml) attrs = extract_attributes(xml) - attrs['workbook_id'] = xml.xpath("xmlns:workbook")[0]['id'] + # The workbook-scoped views endpoint (/workbooks//views) omits the + # element since it is already implied, so guard against nil. + attrs['workbook_id'] = xml.xpath("xmlns:workbook")[0]&.fetch('id', nil) new(client, path, attrs) end diff --git a/lib/tableau_server_client/resources/workbook.rb b/lib/tableau_server_client/resources/workbook.rb index 00152bd..30fdf29 100644 --- a/lib/tableau_server_client/resources/workbook.rb +++ b/lib/tableau_server_client/resources/workbook.rb @@ -42,7 +42,7 @@ def owner end def views - @views ||= @client.get_collection(View.location(site_path)).select {|v| v.workbook_id == id } + @views ||= @client.get_collection(View.location(path)) end def to_request