Class: GoodData::Command::User

Inherits:
Object
  • Object
show all
Defined in:
lib/gooddata/commands/user.rb

Class Method Summary collapse

Class Method Details

.roles(pid) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/gooddata/commands/user.rb', line 16

def roles(pid)
  roles_response = GoodData.get("/gdc/projects/#{pid}/roles")

  roles = {}
  roles_response['projectRoles']['roles'].each do |role_uri|
    r = GoodData.get(role_uri)
    identifier = r['projectRole']['meta']['identifier']
    roles[identifier] = {
      :user_uri => r['projectRole']['links']['roleUsers'],
      :uri => role_uri
    }
  end
  roles
end

.show(opts = { client: GoodData.connection }) ⇒ Object



31
32
33
34
35
# File 'lib/gooddata/commands/user.rb', line 31

def show(opts = { client: GoodData.connection })
  client = opts[:client]
  fail ArgumentError, 'No :client specified' if client.nil?
  pp client.user.json
end