Class: Tableau::Groups

Inherits:
Object
  • Object
show all
Defined in:
lib/tableau_ruby/groups.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Groups


3
4
5
# File 'lib/tableau_ruby/groups.rb', line 3

def initialize(client)
  @client = client
end

Instance Method Details

#allObject


7
8
9
10
11
12
13
14
15
16
# File 'lib/tableau_ruby/groups.rb', line 7

def all
  resp = @client.conn.get "/api/2.0/sites/#{@client.site_id}/groups" do |req|
    req.headers['X-Tableau-Auth'] = @client.token if @client.token
  end
  groups = {groups: []}
  Nokogiri::XML(resp.body).css("tsResponse groups group").each do |s|
    groups[:groups] << {id: s["id"], name: s["name"]}
  end
  groups
end

#all_users_groupObject


18
19
20
# File 'lib/tableau_ruby/groups.rb', line 18

def all_users_group
  all[:groups].detect{|group| group[:name] == "All Users"}
end