Class: TableauServerClient::Resources::User
- Defined in:
- lib/tableau_server_client/resources/user.rb
Instance Attribute Summary collapse
-
#external_auth_user_id ⇒ Object
readonly
Returns the value of attribute external_auth_user_id.
-
#full_name ⇒ Object
readonly
Returns the value of attribute full_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_login ⇒ Object
readonly
Returns the value of attribute last_login.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#site_role ⇒ Object
readonly
Returns the value of attribute site_role.
Class Method Summary collapse
Instance Method Summary collapse
- #datasources ⇒ Object
- #location ⇒ Object
- #reload ⇒ Object
- #to_request ⇒ Object
- #update_site_role!(role) ⇒ Object
- #workbooks ⇒ Object
Methods inherited from Resource
attr_reader, attributes, #attributes, #delete!, extract_attributes, extract_site_path, #initialize, 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
#external_auth_user_id ⇒ Object (readonly)
Returns the value of attribute external_auth_user_id.
8 9 10 |
# File 'lib/tableau_server_client/resources/user.rb', line 8 def external_auth_user_id @external_auth_user_id end |
#full_name ⇒ Object (readonly)
Returns the value of attribute full_name.
8 9 10 |
# File 'lib/tableau_server_client/resources/user.rb', line 8 def full_name @full_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/tableau_server_client/resources/user.rb', line 8 def id @id end |
#last_login ⇒ Object (readonly)
Returns the value of attribute last_login.
8 9 10 |
# File 'lib/tableau_server_client/resources/user.rb', line 8 def last_login @last_login end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/tableau_server_client/resources/user.rb', line 8 def name @name end |
#site_role ⇒ Object (readonly)
Returns the value of attribute site_role.
8 9 10 |
# File 'lib/tableau_server_client/resources/user.rb', line 8 def site_role @site_role end |
Class Method Details
.from_collection_response(client, path, xml) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/tableau_server_client/resources/user.rb', line 15 def self.from_collection_response(client, path, xml) xml.xpath("//xmlns:users/xmlns:user").each do |s| id = s['id'] yield from_response(client, "#{path}/#{id}", s) end end |
.from_response(client, path, xml) ⇒ Object
10 11 12 13 |
# File 'lib/tableau_server_client/resources/user.rb', line 10 def self.from_response(client, path, xml) attrs = extract_attributes(xml) new(client, path, attrs) end |
Instance Method Details
#datasources ⇒ Object
36 37 38 39 40 |
# File 'lib/tableau_server_client/resources/user.rb', line 36 def datasources @client.get_collection(Datasource.location(site_path, filter: ["ownerName:eq:#{full_name}"])).select do |d| d.owner.id == id end end |
#location ⇒ Object
55 56 57 |
# File 'lib/tableau_server_client/resources/user.rb', line 55 def location User.location(site_path, id) end |
#reload ⇒ Object
22 23 24 |
# File 'lib/tableau_server_client/resources/user.rb', line 22 def reload @client.get location end |
#to_request ⇒ Object
42 43 44 45 46 |
# File 'lib/tableau_server_client/resources/user.rb', line 42 def to_request request = build_request {|b| b.user(siteRole: site_role) } end |
#update_site_role!(role) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/tableau_server_client/resources/user.rb', line 48 def update_site_role!(role) @site_role = role # Using location to get corretct path # When initialized from Group path will be groups/group_id/users/user_id @client.update(self, path: location.path) end |