tableau_server_client 0.3.0 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f4255306f228031f6c4db6e6b747c64daf9fcf6266529c10fd7b9a4f2ae4679
4
- data.tar.gz: ef2fafcc87bb2d45ce457082efe8e4625e7c5cabae312ff6bb887feb429216b1
3
+ metadata.gz: a9fcfc2f4fb4ee9d576bc4049b462fa7127c3a12116f1b789a0ca65839311960
4
+ data.tar.gz: 9769ba75f0c2f1e70314cd92296fbedeb24d2a255f2dd060310e970f83ad77ba
5
5
  SHA512:
6
- metadata.gz: 8402b65fd6e2c6a0645310a7707618dafd907038cc18c4fef0ba4e6c061dc1fd9568a4c21bfba20466e33a80fd5dece452c3e8d6a4acb912fd60ba7b85461dca
7
- data.tar.gz: 547bec151a48a0a2d01943f1ab990b8800d3ce512beb141a6789c9b2a4de952fa6a6694b71f678374f99d7b6c7fcb366fdde6eba8f360a8e4bed6acc122e6be7
6
+ metadata.gz: c286496bc37d8d01a1d9871b6b4f30e1c7d4abba5287173bc89874c106259baeddb0399a3627fa554f7a5143096a47afea21f225782fc7f7a1bdd5e282a78387
7
+ data.tar.gz: a35dc1650c7b3806c031580a2f720542b7d7b936f3eebdd90d916cc50cd2fed52b0451c29d50e70edc67440fcd7744960b5020413a5bc93972690e0deb2884f8
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # v0.4.4 (2022-07-01)
2
+ - Allow Resources::Workbook to have nil `project_id`
3
+ - Add `#project_id` and `#owner_id` to Resources::Datasource
data/README.md CHANGED
@@ -11,3 +11,9 @@ $ bundle exec console
11
11
  > site.workbooks.first.name
12
12
  => "My Workbook"
13
13
  ```
14
+
15
+ ## Release new version
16
+
17
+ ```
18
+ $ rake release
19
+ ```
@@ -23,7 +23,7 @@ module TableauServerClient
23
23
 
24
24
  def query_params
25
25
  return "" if params.empty?
26
- params.keys.map {|k| URI.encode("#{k}=#{params[k]}") }.join("&")
26
+ params.keys.map {|k| URI.encode_www_form({k => params[k]}) }.join("&")
27
27
  end
28
28
  end
29
29
  end
@@ -9,7 +9,7 @@ module TableauServerClient
9
9
  class Datasource < Resource
10
10
  include Downloadable
11
11
 
12
- attr_reader :id, :name, :webpage_url, :content_url, :type, :created_at, :updated_at, :is_certified
12
+ attr_reader :id, :name, :webpage_url, :content_url, :type, :created_at, :updated_at, :is_certified, :project_id, :owner_id
13
13
  attr_writer :owner
14
14
 
15
15
  def self.from_response(client, path, xml)
@@ -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
@@ -16,7 +16,7 @@ module TableauServerClient
16
16
 
17
17
  def self.from_response(client, path, xml)
18
18
  attrs = extract_attributes(xml)
19
- attrs['project_id'] = xml.xpath("xmlns:project")[0]['id']
19
+ attrs['project_id'] = xml.at_xpath("xmlns:project")&.[]('id')
20
20
  attrs['owner_id'] = xml.xpath("xmlns:owner")[0]['id']
21
21
  attrs['tags'] = xml.xpath("xmlns:tags/xmlns:tag").map {|t| t['label'] }
22
22
  new(client, path, attrs)
@@ -1,3 +1,3 @@
1
1
  module TableauServerClient
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.4"
3
3
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{Tableau Server REST API Client}
13
13
  spec.description = %q{REST API Client for Tableau Server.}
14
- spec.homepage = "https://github.com/shimpeko/tableau-server-client"
14
+ spec.homepage = "https://github.com/cookpad/tableau-server-client"
15
15
  spec.license = "MIT"
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
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.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - shimpeko
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-05 00:00:00.000000000 Z
11
+ date: 2022-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,6 +131,7 @@ extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
133
  - ".gitignore"
134
+ - CHANGELOG.md
134
135
  - Gemfile
135
136
  - README.md
136
137
  - Rakefile
@@ -145,6 +146,7 @@ files:
145
146
  - lib/tableau_server_client/resources/datasource.rb
146
147
  - lib/tableau_server_client/resources/downloadable.rb
147
148
  - lib/tableau_server_client/resources/extract_refresh.rb
149
+ - lib/tableau_server_client/resources/group.rb
148
150
  - lib/tableau_server_client/resources/job.rb
149
151
  - lib/tableau_server_client/resources/project.rb
150
152
  - lib/tableau_server_client/resources/resource.rb
@@ -158,11 +160,11 @@ files:
158
160
  - lib/tableau_server_client/token.rb
159
161
  - lib/tableau_server_client/version.rb
160
162
  - tableau_server_client.gemspec
161
- homepage: https://github.com/shimpeko/tableau-server-client
163
+ homepage: https://github.com/cookpad/tableau-server-client
162
164
  licenses:
163
165
  - MIT
164
166
  metadata: {}
165
- post_install_message:
167
+ post_install_message:
166
168
  rdoc_options: []
167
169
  require_paths:
168
170
  - lib
@@ -177,8 +179,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
179
  - !ruby/object:Gem::Version
178
180
  version: '0'
179
181
  requirements: []
180
- rubygems_version: 3.0.3
181
- signing_key:
182
+ rubygems_version: 3.3.8
183
+ signing_key:
182
184
  specification_version: 4
183
185
  summary: Tableau Server REST API Client
184
186
  test_files: []