tableau_api 3.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +3 -3
- data/CHANGELOG.md +13 -1
- data/README.md +1 -1
- data/lib/tableau_api.rb +2 -1
- data/lib/tableau_api/connection.rb +22 -26
- data/lib/tableau_api/resources/jobs.rb +2 -2
- data/lib/tableau_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab171fa9db1acc1d2baa0134e86df90f9fabae6c
|
4
|
+
data.tar.gz: 7ade53d8f0ed080241ddc2f37810a0e29193773c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a15d7705a00c982b44d3b3ceb47eae9231440a77acb8af470df74dcb95baa28f1375c8479bce2eb778d4f83c99003230180b345cfdc30f74326f54ecb3955006
|
7
|
+
data.tar.gz: 4523b88ddaf739fa6064b428a2c555ea533bb93d6d65e70280182d362144a0b05da0c87a42294170574c12b045edca33a2e9fae2e0db13abf7ae74062b9b5f09
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.4.
|
1
|
+
2.4.10
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,7 +3,19 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
-
## [
|
6
|
+
## [4.0.0] - 2020-11-30
|
7
|
+
|
8
|
+
### Changed/Fixed
|
9
|
+
|
10
|
+
- Changed interface to Connection#api_get_collection to properly merge a string
|
11
|
+
query with the pagination parameters instead of overwriting the pagination
|
12
|
+
params. This means you can't pass a Hash `query` parameter to `Jobs#list`
|
13
|
+
anymore, but job filtering now works properly because colons in the filter
|
14
|
+
will not be URL-encoded.
|
15
|
+
- Avoid mutating extra argument hash to endpoint methods
|
16
|
+
|
17
|
+
|
18
|
+
## [3.0.0] - 2020-11-11
|
7
19
|
|
8
20
|
### Added
|
9
21
|
|
data/README.md
CHANGED
@@ -68,7 +68,7 @@ generate a trusted ticket from a non-trusted host.
|
|
68
68
|
To regenerate all the the cassettes, you'll first need to create the following on the Tableau server:
|
69
69
|
* *Site*: Default
|
70
70
|
* *Site*: TestSite
|
71
|
-
* *Datasource*: test
|
71
|
+
* *Datasource*: test (this might need to be created from Tableau Desktop)
|
72
72
|
* *Username*: test_test
|
73
73
|
|
74
74
|
And delete the following if they exist:
|
data/lib/tableau_api.rb
CHANGED
@@ -2,6 +2,8 @@ require 'httparty'
|
|
2
2
|
require 'builder'
|
3
3
|
require 'net/http/post/multipart'
|
4
4
|
|
5
|
+
require 'tableau_api/version'
|
6
|
+
|
5
7
|
require 'tableau_api/client'
|
6
8
|
require 'tableau_api/connection'
|
7
9
|
require 'tableau_api/error'
|
@@ -14,7 +16,6 @@ require 'tableau_api/resources/groups'
|
|
14
16
|
require 'tableau_api/resources/workbooks'
|
15
17
|
require 'tableau_api/resources/datasources'
|
16
18
|
require 'tableau_api/resources/jobs'
|
17
|
-
require 'tableau_api/version'
|
18
19
|
|
19
20
|
module TableauApi
|
20
21
|
class << self
|
@@ -3,28 +3,28 @@ module TableauApi
|
|
3
3
|
API_VERSION = '3.1'.freeze
|
4
4
|
|
5
5
|
include HTTParty
|
6
|
+
headers 'User-Agent' => "tableau_api/#{::TableauApi::VERSION} Ruby/#{RUBY_VERSION}"
|
6
7
|
|
7
8
|
def initialize(client)
|
8
9
|
@client = client
|
9
10
|
end
|
10
11
|
|
11
|
-
def post(path,
|
12
|
-
self.class.post("#{@client.host}/#{path}",
|
12
|
+
def post(path, **kwargs)
|
13
|
+
self.class.post("#{@client.host}/#{path}", kwargs)
|
13
14
|
end
|
14
15
|
|
15
16
|
# if the result is paginated, it will fetch subsequent pages
|
16
17
|
# collection can be delimited with a period to do nested hash lookups
|
17
18
|
# e.g. objects.object
|
18
|
-
def api_get_collection(path, collection,
|
19
|
+
def api_get_collection(path, collection, page_number: 1, page_size: 100, **kwargs)
|
19
20
|
Enumerator.new do |enum|
|
20
|
-
args[0] = {} unless args[0]
|
21
|
-
page_size = (args[0].delete(:page_size) { 100 }).to_i
|
22
|
-
page_number = (args[0].delete(:page_number) { 1 }).to_i
|
23
|
-
|
24
21
|
loop do
|
25
|
-
|
22
|
+
query = kwargs.fetch(:query, '')
|
23
|
+
query += '&' unless query.empty?
|
24
|
+
query += "pageSize=#{page_size}&pageNumber=#{page_number}"
|
25
|
+
new_kwargs = kwargs.merge(query: query)
|
26
26
|
|
27
|
-
res = api_get(
|
27
|
+
res = api_get(path, **new_kwargs)
|
28
28
|
raise TableauError, res if res.code.to_s != '200'
|
29
29
|
|
30
30
|
# ensure the result is an array because it will not be an array if there is only one element
|
@@ -40,24 +40,22 @@ module TableauApi
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
def api_get(path,
|
44
|
-
api_method(:get, path,
|
43
|
+
def api_get(path, **kwargs)
|
44
|
+
api_method(:get, path, kwargs)
|
45
45
|
end
|
46
46
|
|
47
|
-
def api_post(path,
|
48
|
-
|
49
|
-
|
50
|
-
api_method(:post, path, *args)
|
47
|
+
def api_post(path, **kwargs)
|
48
|
+
new_headers = kwargs.fetch(:headers, {}).merge('Content-Type' => 'application/xml')
|
49
|
+
api_method(:post, path, kwargs.merge(headers: new_headers))
|
51
50
|
end
|
52
51
|
|
53
|
-
def api_put(path,
|
54
|
-
|
55
|
-
|
56
|
-
api_method(:put, path, *args)
|
52
|
+
def api_put(path, **kwargs)
|
53
|
+
new_headers = kwargs.fetch(:headers, {}).merge('Content-Type' => 'application/xml')
|
54
|
+
api_method(:put, path, kwargs.merge(headers: new_headers))
|
57
55
|
end
|
58
56
|
|
59
|
-
def api_delete(path,
|
60
|
-
api_method(:delete, path,
|
57
|
+
def api_delete(path, **kwargs)
|
58
|
+
api_method(:delete, path, kwargs)
|
61
59
|
end
|
62
60
|
|
63
61
|
def api_post_multipart(path, parts, headers)
|
@@ -75,14 +73,12 @@ module TableauApi
|
|
75
73
|
|
76
74
|
private
|
77
75
|
|
78
|
-
def api_method(method, path,
|
76
|
+
def api_method(method, path, kwargs)
|
79
77
|
# do not attach auth headers or attempt to signin if we're signing in
|
80
78
|
unless path == 'auth/signin'
|
81
|
-
|
82
|
-
args[0][:headers] = {} unless args[0][:headers]
|
83
|
-
args[0][:headers].merge!(auth_headers)
|
79
|
+
new_headers = auth_headers(kwargs.fetch(:headers, {}))
|
84
80
|
end
|
85
|
-
self.class.
|
81
|
+
self.class.public_send(method, url_for(path), kwargs.merge(headers: new_headers))
|
86
82
|
end
|
87
83
|
|
88
84
|
def url_for(path)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module TableauApi
|
2
2
|
module Resources
|
3
3
|
class Jobs < Base
|
4
|
-
def list(
|
4
|
+
def list(params = {})
|
5
5
|
url = "sites/#{@client.auth.site_id}/jobs"
|
6
|
-
@client.connection.api_get_collection(url, 'backgroundJobs.backgroundJob', **
|
6
|
+
@client.connection.api_get_collection(url, 'backgroundJobs.backgroundJob', **params)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
data/lib/tableau_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tableau_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Manning
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-12-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|