Class: TableauServerClient::Resources::Group

Inherits:
Resource
  • Object
show all
Defined in:
lib/tableau_server_client/resources/group.rb

Instance Attribute Summary collapse

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, #server_url, #site_id, #site_path

Methods included from TableauServerClient::RequestBuilder

#build_request

Constructor Details

This class inherits a constructor from TableauServerClient::Resources::Resource

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/tableau_server_client/resources/group.rb', line 8

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/tableau_server_client/resources/group.rb', line 8

def name
  @name
end

#site_roleObject (readonly)

Returns the value of attribute site_role.



8
9
10
# File 'lib/tableau_server_client/resources/group.rb', line 8

def site_role
  @site_role
end

Class Method Details

.from_collection_response(client, path, xml) ⇒ Object



18
19
20
21
22
23
# File 'lib/tableau_server_client/resources/group.rb', line 18

def self.from_collection_response(client, path, xml)
  xml.xpath("//xmlns:groups/xmlns:group").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
14
15
16
# File 'lib/tableau_server_client/resources/group.rb', line 10

def self.from_response(client, path, xml)
  attrs = extract_attributes(xml)
  if xml.xpath("xmlns:import")[0]
    attrs['site_role'] = xml.xpath("xmlns:import")[0]['siteRole']
  end
  new(client, path, attrs)
end

Instance Method Details

#usersObject



25
26
27
# File 'lib/tableau_server_client/resources/group.rb', line 25

def users
  @client.get_collection(User.location(path))
end