tableau_server_client 0.3.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f4255306f228031f6c4db6e6b747c64daf9fcf6266529c10fd7b9a4f2ae4679
4
- data.tar.gz: ef2fafcc87bb2d45ce457082efe8e4625e7c5cabae312ff6bb887feb429216b1
3
+ metadata.gz: a2b753dc351bba7fa961e4772449b2ef68789fd24f6ca632983f506c729d596e
4
+ data.tar.gz: a6de27794f5a2fcf43f393f4f259cda8250860c30176852b586d458d87e2e60b
5
5
  SHA512:
6
- metadata.gz: 8402b65fd6e2c6a0645310a7707618dafd907038cc18c4fef0ba4e6c061dc1fd9568a4c21bfba20466e33a80fd5dece452c3e8d6a4acb912fd60ba7b85461dca
7
- data.tar.gz: 547bec151a48a0a2d01943f1ab990b8800d3ce512beb141a6789c9b2a4de952fa6a6694b71f678374f99d7b6c7fcb366fdde6eba8f360a8e4bed6acc122e6be7
6
+ metadata.gz: cc52e212245271db396f36989401102e78377e5b794977e580d17d65394033bd36398dcf50249a96c7f595ef4cbc07f447dcf92d7a28c090d19264a2019d98f3
7
+ data.tar.gz: 5f4a6ea560350dcc8641b9ad1c8b04187d8973d14ac5679546ec66f595e7decc65aafda880b2021aca962c2d88b265950b58e14defb7012c31aed802bcc53eb8
@@ -0,0 +1,31 @@
1
+ require 'tableau_server_client/resources/resource'
2
+
3
+ module TableauServerClient
4
+ module Resources
5
+
6
+ class Group < Resource
7
+
8
+ attr_reader :id, :name, :site_role
9
+
10
+ def self.from_response(client, path, xml)
11
+ attrs = extract_attributes(xml)
12
+ if xml.xpath("xmlns:import")[0]
13
+ attrs['site_role'] = xml.xpath("xmlns:import")[0]['siteRole']
14
+ end
15
+ new(client, path, attrs)
16
+ end
17
+
18
+ def self.from_collection_response(client, path, xml)
19
+ xml.xpath("//xmlns:groups/xmlns:group").each do |s|
20
+ id = s['id']
21
+ yield from_response(client, "#{path}/#{id}", s)
22
+ end
23
+ end
24
+
25
+ def users
26
+ @client.get_collection(User.location(path))
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -5,6 +5,7 @@ require 'tableau_server_client/resources/user'
5
5
  require 'tableau_server_client/resources/subscription'
6
6
  require 'tableau_server_client/resources/extract_refresh'
7
7
  require 'tableau_server_client/resources/view'
8
+ require 'tableau_server_client/resources/group'
8
9
 
9
10
  module TableauServerClient
10
11
  module Resources
@@ -77,6 +78,11 @@ module TableauServerClient
77
78
  @client.get_collection ExtractRefresh.location("#{path}/tasks")
78
79
  end
79
80
 
81
+ def groups(filter: [])
82
+ @client.get_collection Group.location(path, filter: filter)
83
+ end
84
+
85
+
80
86
  end
81
87
  end
82
88
  end
@@ -20,7 +20,7 @@ module TableauServerClient
20
20
  end
21
21
 
22
22
  def reload
23
- @client.get User.location(site_path, id)
23
+ @client.get location
24
24
  end
25
25
 
26
26
  def full_name
@@ -39,6 +39,23 @@ module TableauServerClient
39
39
  end
40
40
  end
41
41
 
42
+ def to_request
43
+ request = build_request {|b|
44
+ b.user(siteRole: site_role)
45
+ }
46
+ end
47
+
48
+ def update_site_role!(role)
49
+ @site_role = role
50
+ # Using location to get corretct path
51
+ # When initialized from Group path will be groups/group_id/users/user_id
52
+ @client.update(self, path: location.path)
53
+ end
54
+
55
+ def location
56
+ User.location(site_path, id)
57
+ end
58
+
42
59
  end
43
60
  end
44
61
  end
@@ -1,3 +1,3 @@
1
1
  module TableauServerClient
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tableau_server_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - shimpeko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-05 00:00:00.000000000 Z
11
+ date: 2020-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -145,6 +145,7 @@ files:
145
145
  - lib/tableau_server_client/resources/datasource.rb
146
146
  - lib/tableau_server_client/resources/downloadable.rb
147
147
  - lib/tableau_server_client/resources/extract_refresh.rb
148
+ - lib/tableau_server_client/resources/group.rb
148
149
  - lib/tableau_server_client/resources/job.rb
149
150
  - lib/tableau_server_client/resources/project.rb
150
151
  - lib/tableau_server_client/resources/resource.rb