power-bi 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/power-bi.rb +1 -0
- data/lib/power-bi/user.rb +48 -0
- data/lib/power-bi/workspace.rb +2 -12
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '053216118d9fed6cb0cb3dff7a8bbe03c64be8a80f2cf26205a1c1b2ee48699c'
|
4
|
+
data.tar.gz: 29908d4c0d9c2c988073f42c7b1180e21863a755ee14c68858016a0d74f437b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b466f3f6b3d67701d40635ac0035b4a94d5aa9a1908152e2f32e244cbfe9f27f8c35f7978ec47bb2a3bccc7e681f14247d76128074c6a93006c2fc2b0c7f8438
|
7
|
+
data.tar.gz: b43176b8de6c021e9c2529aafa9f137fab06877d320b26acc9ea0d7e7edfaee5d37a03d81dbf9f2672beae4399e25a24958aad94f39cecbaaf4d4ecf29edeb4f
|
data/README.md
CHANGED
@@ -31,6 +31,12 @@ pbi = PowerBI::Tenant.new(->{token = get_token(client, token) ; token.token})
|
|
31
31
|
|
32
32
|
* List pages in a report: `report.pages`
|
33
33
|
|
34
|
+
## Users
|
35
|
+
|
36
|
+
* List users in a workspace: `workspace.pages`
|
37
|
+
* Delete a user from a workspace: `user.delete`
|
38
|
+
* Add a user to a workspace: `workspace.create(email_address, access_right: "Viewer")`
|
39
|
+
|
34
40
|
## Datasets
|
35
41
|
|
36
42
|
* List datasets in a workspace: `workspace.datasets`
|
data/lib/power-bi.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
module PowerBI
|
2
|
+
class User
|
3
|
+
attr_reader :email_address, :group_user_access_right, :display_name, :identifier, :principal_type
|
4
|
+
|
5
|
+
def initialize(tenant, data)
|
6
|
+
@email_address = data[:emailAddress]
|
7
|
+
@group_user_access_right = data[:groupUserAccessRight]
|
8
|
+
@display_name = data[:displayName]
|
9
|
+
@identifier = data[:identifier]
|
10
|
+
@principal_type = data[:principalType]
|
11
|
+
@workspace = data[:workspace]
|
12
|
+
@tenant = tenant
|
13
|
+
end
|
14
|
+
|
15
|
+
def delete
|
16
|
+
@tenant.delete("/groups/#{@workspace.id}/users/#{@email_address}")
|
17
|
+
@workspace.users.reload
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
class UserArray < Array
|
23
|
+
|
24
|
+
def initialize(tenant, workspace)
|
25
|
+
super(tenant)
|
26
|
+
@workspace = workspace
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.get_class
|
30
|
+
User
|
31
|
+
end
|
32
|
+
|
33
|
+
def create(email_address, access_right: "Viewer")
|
34
|
+
@tenant.post("/groups/#{@workspace.id}/users") do |req|
|
35
|
+
req.body = {
|
36
|
+
emailAddress: email_address,
|
37
|
+
groupUserAccessRight: access_right
|
38
|
+
}.to_json
|
39
|
+
end
|
40
|
+
self.reload
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_data
|
44
|
+
data = @tenant.get("/groups/#{@workspace.id}/users")[:value]
|
45
|
+
data.each { |d| d[:workspace] = @workspace }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/power-bi/workspace.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module PowerBI
|
2
2
|
class Workspace
|
3
|
-
attr_reader :name, :is_read_only, :is_on_dedicated_capacity, :id, :reports, :datasets
|
3
|
+
attr_reader :name, :is_read_only, :is_on_dedicated_capacity, :id, :reports, :datasets, :users
|
4
4
|
|
5
5
|
class UploadError < PowerBI::Error ; end
|
6
6
|
|
@@ -12,6 +12,7 @@ module PowerBI
|
|
12
12
|
@tenant = tenant
|
13
13
|
@reports = ReportArray.new(@tenant, self)
|
14
14
|
@datasets = DatasetArray.new(@tenant, self)
|
15
|
+
@users = UserArray.new(@tenant, self)
|
15
16
|
end
|
16
17
|
|
17
18
|
def upload_pbix(file, dataset_name, timeout: 30)
|
@@ -43,17 +44,6 @@ module PowerBI
|
|
43
44
|
true
|
44
45
|
end
|
45
46
|
|
46
|
-
# TODO LATER: the 'Viewer' acces right is currently not settable throught the API. Fix that later
|
47
|
-
def add_user(email_address, access_right = 'Member')
|
48
|
-
@tenant.post("/groups/#{id}/users") do |req|
|
49
|
-
req.body = {
|
50
|
-
emailAddress: email_address,
|
51
|
-
groupUserAccessRight: access_right
|
52
|
-
}.to_json
|
53
|
-
end
|
54
|
-
true
|
55
|
-
end
|
56
|
-
|
57
47
|
end
|
58
48
|
|
59
49
|
class WorkspaceArray < Array
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: power-bi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lode Cools
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- lib/power-bi/refresh.rb
|
58
58
|
- lib/power-bi/report.rb
|
59
59
|
- lib/power-bi/tenant.rb
|
60
|
+
- lib/power-bi/user.rb
|
60
61
|
- lib/power-bi/workspace.rb
|
61
62
|
homepage: https://github.com/piloos/power-bi
|
62
63
|
licenses:
|