tableau_api 1.1.2 → 2.0.0

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: 79d15e26e8441669e7c04c13794a049dc968d69e
4
- data.tar.gz: 05e49453e17574474a356d20cb21fc0ce094e6e0
3
+ metadata.gz: f4798e618f0d34f889de213df1639f637bd10725
4
+ data.tar.gz: 101be1cca96ab9cb21fd6061f557ea2d718ac8a7
5
5
  SHA512:
6
- metadata.gz: 8e69aba0b041e655e0e93b1fc0de62f069c966148675b755365bac2572a01dd78fbc322ce1020e1e588bef1600a554e77b8e54089c5936390573d3bb0137d018
7
- data.tar.gz: ca5ebe0289ac4af7c5ccf6c0e1945ce61f01d693b31f027cf1ed8baafcfbf7e980042afb09167c48befbf074a1a46e1d003367d1565fc30ede71cee7f2884957
6
+ metadata.gz: 2ebb0f01b35a52a1270cd50dc21dc883d801acfe82dfaa4d0284ab3c47cef1fc61a0c024d02abc9720ac3114852355e105ba711d7b8ff4a926950b5dda7f0bd6
7
+ data.tar.gz: 75afe1a966db2064aa0a89c2f0e321e43a701288bba57a1dd8f22f031db2be5e2a699e2a74ad988196517923bbf63f91d71737ff88b61282c7cc2dda54b1f6fa
data/.rubocop.yml CHANGED
@@ -1,3 +1,5 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
1
3
  AllCops:
2
4
  TargetRubyVersion: 2.2
3
5
 
@@ -18,3 +20,8 @@ Metrics/AbcSize:
18
20
 
19
21
  MethodLength:
20
22
  Max: 30
23
+
24
+ Metrics/BlockLength:
25
+ Exclude:
26
+ - ./tableau_api.gemspec
27
+ - ./spec/resources/workbooks_spec.rb
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,12 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2019-08-21 17:54:45 +0000 using RuboCop version 0.49.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 13
10
+ # Configuration parameters: CountComments, ExcludedMethods.
11
+ Metrics/BlockLength:
12
+ Max: 316
data/.travis.yml CHANGED
@@ -4,7 +4,6 @@ branches:
4
4
  - master
5
5
  language: ruby
6
6
  rvm:
7
+ - 2.6.3
8
+ - 2.5.5
7
9
  - 2.4.1
8
- - 2.3.4
9
- - 2.2.7
10
- - 2.1.10
data/CHANGELOG.md CHANGED
@@ -3,7 +3,11 @@
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
- ## [Unreleased]
6
+ ## [2.0.0] - 2019-08-29
7
+
8
+ - Updated to API version 2.8, compatible with Tableau Server >= 10.5
9
+ - Add `refresh` and `image_preview` methods for workbooks
10
+ - Bumped the Ruby versions in the Travis matrix build to 2.3.4, 2.2.7, and
7
11
 
8
12
  ## [1.1.2] - 2017-05-24
9
13
 
data/Rakefile CHANGED
@@ -6,4 +6,4 @@ RuboCop::RakeTask.new(:rubocop)
6
6
 
7
7
  RSpec::Core::RakeTask.new(:spec)
8
8
 
9
- task default: [:rubocop, :spec]
9
+ task default: %i[rubocop spec]
@@ -28,7 +28,8 @@ module TableauApi
28
28
  sites: TableauApi::Resources::Sites,
29
29
  users: TableauApi::Resources::Users,
30
30
  groups: TableauApi::Resources::Groups,
31
- workbooks: TableauApi::Resources::Workbooks
31
+ workbooks: TableauApi::Resources::Workbooks,
32
+ datasources: TableauApi::Resources::Datasources
32
33
  }
33
34
  end
34
35
 
@@ -1,6 +1,6 @@
1
1
  module TableauApi
2
2
  class Connection
3
- API_VERSION = '2.0'.freeze
3
+ API_VERSION = '2.8'.freeze
4
4
 
5
5
  include HTTParty
6
6
 
@@ -45,10 +45,14 @@ module TableauApi
45
45
  end
46
46
 
47
47
  def api_post(path, *args)
48
+ args[0][:headers] = {} unless args[0][:headers]
49
+ args[0][:headers]['Content-Type'] = 'application/xml'
48
50
  api_method(:post, path, *args)
49
51
  end
50
52
 
51
53
  def api_put(path, *args)
54
+ args[0][:headers] = {} unless args[0][:headers]
55
+ args[0][:headers]['Content-Type'] = 'application/xml'
52
56
  api_method(:put, path, *args)
53
57
  end
54
58
 
@@ -75,7 +79,8 @@ module TableauApi
75
79
  # do not attach auth headers or attempt to signin if we're signing in
76
80
  unless path == 'auth/signin'
77
81
  args[0] = {} unless args[0]
78
- args[0][:headers] = auth_headers
82
+ args[0][:headers] = {} unless args[0][:headers]
83
+ args[0][:headers].merge!(auth_headers)
79
84
  end
80
85
  self.class.send(method, url_for(path), *args)
81
86
  end
@@ -0,0 +1,10 @@
1
+ module TableauApi
2
+ module Resources
3
+ class Datasources < Base
4
+ def list
5
+ url = "sites/#{@client.auth.site_id}/datasources"
6
+ @client.connection.api_get_collection(url, 'datasources.datasource')
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,7 +1,7 @@
1
1
  module TableauApi
2
2
  module Resources
3
3
  class Users < Base
4
- SITE_ROLES = %w(
4
+ SITE_ROLES = %w[
5
5
  Interactor
6
6
  Publisher
7
7
  SiteAdministrator
@@ -9,7 +9,7 @@ module TableauApi
9
9
  UnlicensedWithPublish
10
10
  Viewer
11
11
  ViewerWithPublish
12
- ).freeze
12
+ ].freeze
13
13
 
14
14
  def create(username:, site_role: 'Viewer')
15
15
  raise 'invalid site_role' unless SITE_ROLES.include? site_role
@@ -48,12 +48,12 @@ module TableauApi
48
48
  end
49
49
  # rubocop:enable Metrics/ParameterLists
50
50
 
51
- CAPABILITIES = %w(
51
+ CAPABILITIES = %w[
52
52
  AddComment ChangeHierarchy ChangePermissions Delete ExportData ExportImage ExportXml
53
53
  Filter Read ShareView ViewComments ViewUnderlyingData WebAuthoring Write
54
- ).freeze
54
+ ].freeze
55
55
 
56
- CAPABILITY_MODES = %w(ALLOW DENY).freeze
56
+ CAPABILITY_MODES = %w[ALLOW DENY].freeze
57
57
 
58
58
  def permissions(workbook_id:)
59
59
  res = @client.connection.api_get("sites/#{@client.auth.site_id}/workbooks/#{workbook_id}/permissions")
@@ -98,7 +98,7 @@ module TableauApi
98
98
  raise 'invalid mode' unless CAPABILITY_MODES.include? capability_mode.to_s
99
99
 
100
100
  subpath = user_id ? "users/#{user_id}" : "groups/#{group_id}"
101
- subpath += "/#{capability}/#{capability_mode}"
101
+ subpath += "/#{capability}/#{capability_mode.capitalize}"
102
102
  res = @client.connection.api_delete("sites/#{@client.auth.site_id}/workbooks/#{workbook_id}/permissions/#{subpath}")
103
103
 
104
104
  res.code == 204
@@ -116,6 +116,17 @@ module TableauApi
116
116
  res.code == 200
117
117
  end
118
118
 
119
+ def refresh(workbook_id:)
120
+ request = Builder::XmlMarkup.new.tsRequest
121
+ res = @client.connection.api_post("sites/#{@client.auth.site_id}/workbooks/#{workbook_id}/refresh", body: request)
122
+ res.code == 202
123
+ end
124
+
125
+ def preview_image(workbook_id:)
126
+ res = @client.connection.api_get("sites/#{@client.auth.site_id}/workbooks/#{workbook_id}/previewImage")
127
+ res.body if res.code == 200
128
+ end
129
+
119
130
  def find(workbook_id)
120
131
  res = @client.connection.api_get("sites/#{@client.auth.site_id}/workbooks/#{workbook_id}")
121
132
  res['tsResponse']['workbook'] if res.code == 200
@@ -1,3 +1,3 @@
1
1
  module TableauApi
2
- VERSION = '1.1.2'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end
data/lib/tableau_api.rb CHANGED
@@ -12,6 +12,7 @@ require 'tableau_api/resources/sites'
12
12
  require 'tableau_api/resources/users'
13
13
  require 'tableau_api/resources/groups'
14
14
  require 'tableau_api/resources/workbooks'
15
+ require 'tableau_api/resources/datasources'
15
16
  require 'tableau_api/version'
16
17
 
17
18
  module TableauApi
data/tableau_api.gemspec CHANGED
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'tableau_api/version'
@@ -10,7 +11,7 @@ Gem::Specification.new do |spec|
10
11
  'Jonathan Cobian']
11
12
  spec.email = ['opensource@civisanalytics.com']
12
13
 
13
- spec.summary = 'Ruby interface to the Tableau 9.0 API.'
14
+ spec.summary = 'Ruby interface to the Tableau API.'
14
15
  spec.homepage = 'https://github.com/civisanalytics/tableau_api'
15
16
  spec.license = 'BSD-3-Clause'
16
17
 
@@ -32,5 +33,6 @@ Gem::Specification.new do |spec|
32
33
  spec.add_development_dependency 'webmock', '~> 3.0'
33
34
  spec.add_development_dependency 'pry', '~> 0.10'
34
35
  spec.add_development_dependency 'pry-byebug', '~> 3.4'
35
- spec.add_development_dependency 'rubocop', '~> 0.46.0'
36
+ spec.add_development_dependency 'rubocop', '~> 0.49.0'
37
+ spec.add_development_dependency 'chunky_png', '~> 1.3.11'
36
38
  end
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: 1.1.2
4
+ version: 2.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: 2017-05-24 00:00:00.000000000 Z
13
+ date: 2019-08-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -172,14 +172,28 @@ dependencies:
172
172
  requirements:
173
173
  - - "~>"
174
174
  - !ruby/object:Gem::Version
175
- version: 0.46.0
175
+ version: 0.49.0
176
176
  type: :development
177
177
  prerelease: false
178
178
  version_requirements: !ruby/object:Gem::Requirement
179
179
  requirements:
180
180
  - - "~>"
181
181
  - !ruby/object:Gem::Version
182
- version: 0.46.0
182
+ version: 0.49.0
183
+ - !ruby/object:Gem::Dependency
184
+ name: chunky_png
185
+ requirement: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - "~>"
188
+ - !ruby/object:Gem::Version
189
+ version: 1.3.11
190
+ type: :development
191
+ prerelease: false
192
+ version_requirements: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - "~>"
195
+ - !ruby/object:Gem::Version
196
+ version: 1.3.11
183
197
  description:
184
198
  email:
185
199
  - opensource@civisanalytics.com
@@ -190,6 +204,7 @@ files:
190
204
  - ".gitignore"
191
205
  - ".rspec"
192
206
  - ".rubocop.yml"
207
+ - ".rubocop_todo.yml"
193
208
  - ".ruby-version"
194
209
  - ".travis.yml"
195
210
  - CHANGELOG.md
@@ -206,6 +221,7 @@ files:
206
221
  - lib/tableau_api/error.rb
207
222
  - lib/tableau_api/resources/auth.rb
208
223
  - lib/tableau_api/resources/base.rb
224
+ - lib/tableau_api/resources/datasources.rb
209
225
  - lib/tableau_api/resources/groups.rb
210
226
  - lib/tableau_api/resources/projects.rb
211
227
  - lib/tableau_api/resources/sites.rb
@@ -233,8 +249,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
249
  version: '0'
234
250
  requirements: []
235
251
  rubyforge_project:
236
- rubygems_version: 2.6.11
252
+ rubygems_version: 2.5.2.3
237
253
  signing_key:
238
254
  specification_version: 4
239
- summary: Ruby interface to the Tableau 9.0 API.
255
+ summary: Ruby interface to the Tableau API.
240
256
  test_files: []