tableau_rest_api 0.1.3 → 0.1.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec764f4db940bac68471b37eb006438c2072e780
|
4
|
+
data.tar.gz: a572193a533663fd00a44193a7141e3a6bab6c2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecb498f6d7b495c5366d353d564ea7c6e34ea2d663085f95f142643c6caf4cee0c4b62b42df792424abfce81b52eb24f6dce604b02c4658cc9b06b8cc2504aa7
|
7
|
+
data.tar.gz: 4aa665b7c0274b58259d886023a51080d82492504a6a28d9416bcdf5f975addf483f531876b3cceb7bfa148438c5846ace20da27094604b706a49e577d59c25c
|
@@ -64,5 +64,11 @@ module TableauRestApi
|
|
64
64
|
def delete(url)
|
65
65
|
Response.new(RestClient.delete(url, header)).parse
|
66
66
|
end
|
67
|
+
|
68
|
+
def fetch_paginated_set(endpoint, extract)
|
69
|
+
response = get build_url(endpoint)
|
70
|
+
collection = extract.call(response)
|
71
|
+
collection = retrieve_additional_pages(response, collection, endpoint, extract)
|
72
|
+
end
|
67
73
|
end
|
68
74
|
end
|
@@ -19,9 +19,8 @@ module TableauRestApi
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def sites
|
22
|
-
|
23
|
-
sites
|
24
|
-
sites = retrieve_additional_pages(resp, sites, 'sites', :extract_sites)
|
22
|
+
sites = Proc.new { |resp| resp.sites.site.to_a }
|
23
|
+
fetch_paginated_set('sites', sites).map { |site| Site.new(site, self) }
|
25
24
|
end
|
26
25
|
|
27
26
|
def create_site(site)
|
@@ -39,11 +38,5 @@ module TableauRestApi
|
|
39
38
|
delete url
|
40
39
|
@token = nil
|
41
40
|
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def extract_sites(response)
|
46
|
-
response.sites.site.to_a.map { |site| Site.new(site, self) }
|
47
|
-
end
|
48
41
|
end
|
49
42
|
end
|
@@ -7,16 +7,16 @@ module TableauRestApi
|
|
7
7
|
|
8
8
|
def paginate(pagination)
|
9
9
|
read_pagination_header(pagination)
|
10
|
-
return
|
10
|
+
return single_page? if first_page?
|
11
11
|
@total % ((@page) * @per_page) == @total
|
12
12
|
end
|
13
13
|
|
14
|
-
def first_page
|
14
|
+
def first_page?
|
15
15
|
@page == 0
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
@total
|
18
|
+
def single_page?
|
19
|
+
@total <= @per_page
|
20
20
|
end
|
21
21
|
|
22
22
|
def read_pagination_header(pagination)
|
@@ -29,10 +29,10 @@ module TableauRestApi
|
|
29
29
|
@page + 1
|
30
30
|
end
|
31
31
|
|
32
|
-
def retrieve_additional_pages(response, collection,
|
32
|
+
def retrieve_additional_pages(response, collection, endpoint, extract)
|
33
33
|
until complete?(response) do
|
34
|
-
response = (get build_url(
|
35
|
-
collection = collection +
|
34
|
+
response = (get build_url(endpoint, next_page))
|
35
|
+
collection = collection + extract.call(response)
|
36
36
|
end
|
37
37
|
collection
|
38
38
|
end
|
data/tableau_rest_api.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["lancaster.dave@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Ruby library wrapping the Tableau REST API.}
|
13
|
-
spec.description = %q{Exposes a subset of the
|
13
|
+
spec.description = %q{Exposes a subset of the Tableau v2.6 REST API (json).}
|
14
14
|
spec.homepage = "https://github.com/davelancaster/tableau-rest-api"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tableau_rest_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Lancaster
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0.1'
|
125
|
-
description: Exposes a subset of the
|
125
|
+
description: Exposes a subset of the Tableau v2.6 REST API (json).
|
126
126
|
email:
|
127
127
|
- lancaster.dave@gmail.com
|
128
128
|
executables: []
|