tableau_api 4.1.0 → 5.0.0

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
- SHA1:
3
- metadata.gz: a147139944855ed7147760ceae5d65bcd5f6fb1c
4
- data.tar.gz: ea08dc0b70183fc30620959fa255e041e6c318ea
2
+ SHA256:
3
+ metadata.gz: 43cac99596054f87a1077b820a3b461fd8eda987d3ae4c785b50bfade19c9543
4
+ data.tar.gz: b1a031c5fb30bb1d59e5065ec0f044e8696784ddb673d106aa7f86442d783647
5
5
  SHA512:
6
- metadata.gz: b60cbc7aec82d7a36868faadbe38f775786a67b84c809c2803e384424c877d6c22116b1da652d0634f57d731b0d99a2b3e69123d746499390e7e2a2c34d71a63
7
- data.tar.gz: f36628abb279e8ca26aee9747a9fafb0ab29e41268b6787e2da9a90d2d4a116d3f18fd7d7ca6557481340a72aaf6a6306cb95f5ce6caf83a4ab274b2df17b994
6
+ metadata.gz: 4386b22e40f004915e66b4051c8de0ce50e6aa0a052f0471429d67a588b2c6d3effe85e5555675685ec2059e256297042a8773bbcf4c141827c7b5f8dd2770e1
7
+ data.tar.gz: 4afa373753b3647d72b755e5864e10ba7ddb0de4d2bb55637c3ed4bcc89c64728827285e3661c8e46fb36b4291cde2173c29ec30ab9ab763638c8d534a6bf437
data/.rubocop.yml CHANGED
@@ -1,24 +1,25 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.2
4
+ TargetRubyVersion: 2.7
5
+ NewCops: enable
5
6
 
6
- ClassLength:
7
- Max: 200
7
+ Gemspec/RequiredRubyVersion:
8
+ Enabled: false
9
+
10
+ Layout/LineLength:
11
+ Max: 170
8
12
 
9
13
  Style/Documentation:
10
14
  Enabled: false
11
15
 
12
- LineLength:
13
- Max: 170
14
-
15
- MethodLength:
16
- Max: 20
16
+ Metrics/ClassLength:
17
+ Max: 200
17
18
 
18
19
  Metrics/AbcSize:
19
20
  Max: 40
20
21
 
21
- MethodLength:
22
+ Metrics/MethodLength:
22
23
  Max: 30
23
24
 
24
25
  Metrics/BlockLength:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.4.10
1
+ 3.2.1
data/.travis.yml CHANGED
@@ -4,6 +4,6 @@ branches:
4
4
  - master
5
5
  language: ruby
6
6
  rvm:
7
- - 2.6.6
8
- - 2.5.8
9
- - 2.4.10
7
+ - 3.2.1
8
+ - 3.1.3
9
+ - 2.7.0
data/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@ This project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
8
  ### Changed
9
9
 
10
+ ## [5.0.0] - 2023-03-23
11
+
12
+ - Added support for Ruby 3
13
+ - Bumped dev Ruby version to 3.2.1
14
+ - Bumped minimum required Ruby version to 2.7.0
15
+ - Bumped Rake version for development to 12.3.3
16
+ - Bumped Rubocop version for development to 1.48.1
17
+ - Bumped vcr version for development to 6.0
18
+ - Bumped Travis matrix Ruby versions to 3.2.1, 3.0.5, and 2.7.0
19
+ - Added Rubygems MFA requirement
20
+
10
21
  ## [4.1.0] - 2022-04-13
11
22
 
12
23
  - Specify major version number of ruby in Docker testing command in README
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in tableau_api.gemspec
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
  require 'rubocop/rake_task'
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'tableau_api'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TableauApi
2
4
  class Client
3
5
  attr_reader :host, :username, :password, :site_id, :site_name
@@ -6,12 +8,15 @@ module TableauApi
6
8
  @resources = {}
7
9
 
8
10
  raise 'host is required' if host.to_s.empty?
11
+
9
12
  @host = host
10
13
 
11
14
  raise 'site_name is required' if site_name.to_s.empty?
15
+
12
16
  @site_name = site_name
13
17
 
14
18
  raise 'username is required' if username.to_s.empty?
19
+
15
20
  @username = username
16
21
 
17
22
  @password = password
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TableauApi
2
4
  class Connection
3
- API_VERSION = '3.1'.freeze
5
+ API_VERSION = '3.1'
4
6
 
5
7
  include HTTParty
6
8
  headers 'User-Agent' => "tableau_api/#{::TableauApi::VERSION} Ruby/#{RUBY_VERSION}"
@@ -16,6 +18,7 @@ module TableauApi
16
18
  # if the result is paginated, it will fetch subsequent pages
17
19
  # collection can be delimited with a period to do nested hash lookups
18
20
  # e.g. objects.object
21
+ # rubocop:disable Metrics/CyclomaticComplexity
19
22
  def api_get_collection(path, collection, page_number: 1, page_size: 100, **kwargs)
20
23
  Enumerator.new do |enum|
21
24
  loop do
@@ -39,6 +42,7 @@ module TableauApi
39
42
  end
40
43
  end
41
44
  end
45
+ # rubocop:enable Metrics/CyclomaticComplexity
42
46
 
43
47
  def api_get(path, **kwargs)
44
48
  api_method(:get, path, kwargs)
@@ -75,9 +79,7 @@ module TableauApi
75
79
 
76
80
  def api_method(method, path, kwargs)
77
81
  # do not attach auth headers or attempt to signin if we're signing in
78
- unless path == 'auth/signin'
79
- new_headers = auth_headers(kwargs.fetch(:headers, {}))
80
- end
82
+ new_headers = auth_headers(kwargs.fetch(:headers, {})) unless path == 'auth/signin'
81
83
  self.class.public_send(method, url_for(path), kwargs.merge(headers: new_headers))
82
84
  end
83
85
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TableauApi
2
4
  class TableauError < StandardError
3
5
  attr_reader :http_response_code, :error_code, :summary, :detail
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TableauApi
2
4
  module Resources
3
5
  class Auth < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TableauApi
2
4
  module Resources
3
5
  class Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TableauApi
2
4
  module Resources
3
5
  class Datasources < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TableauApi
2
4
  module Resources
3
5
  class Groups < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TableauApi
2
4
  module Resources
3
5
  class Jobs < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TableauApi
2
4
  module Resources
3
5
  class Projects < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TableauApi
2
4
  module Resources
3
5
  class Sites < Base
@@ -23,12 +25,14 @@ module TableauApi
23
25
  res = @client.connection.api_post('sites', body: request)
24
26
 
25
27
  return res['tsResponse']['site'] if res.code == 201
28
+
26
29
  raise TableauError, res
27
30
  end
28
31
 
29
32
  def delete(site_id:)
30
33
  res = @client.connection.api_delete("sites/#{site_id}")
31
34
  return true if res.code == 204
35
+
32
36
  raise TableauError, res
33
37
  end
34
38
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TableauApi
2
4
  module Resources
3
5
  class Users < Base
@@ -35,6 +37,7 @@ module TableauApi
35
37
  res = @client.connection.api_get("sites/#{@client.auth.site_id}/users/#{user_id}")
36
38
 
37
39
  raise 'failed to find user' if res.code != 200
40
+
38
41
  user = res['tsResponse']['user']
39
42
 
40
43
  request = Builder::XmlMarkup.new.tsRequest do |ts|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'zip'
2
4
 
3
5
  module TableauApi
@@ -55,10 +57,12 @@ module TableauApi
55
57
 
56
58
  CAPABILITY_MODES = %w[ALLOW DENY].freeze
57
59
 
60
+ # rubocop:disable Metrics/CyclomaticComplexity
58
61
  def permissions(workbook_id:)
59
62
  res = @client.connection.api_get("sites/#{@client.auth.site_id}/workbooks/#{workbook_id}/permissions")
60
63
 
61
64
  raise TableauError, res if res.code != 200
65
+
62
66
  permissions = HTTParty::Parser.new(res.body, :xml).parse['tsResponse']['permissions']['granteeCapabilities']
63
67
  return [] if permissions.nil?
64
68
 
@@ -81,9 +85,10 @@ module TableauApi
81
85
  }
82
86
  end
83
87
  end
88
+ # rubocop:enable Metrics/CyclomaticComplexity
84
89
 
85
90
  # capabilities is a hash of symbol keys to booleans { Read: true, ChangePermissions: false }
86
- def add_permissions(workbook_id:, user_id: nil, group_id: nil, capabilities:)
91
+ def add_permissions(workbook_id:, capabilities:, user_id: nil, group_id: nil)
87
92
  validate_user_group_exclusivity(user_id, group_id)
88
93
 
89
94
  request = permissions_request(workbook_id, user_id, group_id, capabilities)
@@ -92,7 +97,7 @@ module TableauApi
92
97
  res.code == 200
93
98
  end
94
99
 
95
- def delete_permissions(workbook_id:, user_id: nil, group_id: nil, capability:, capability_mode:)
100
+ def delete_permissions(workbook_id:, capability:, capability_mode:, user_id: nil, group_id: nil)
96
101
  validate_user_group_exclusivity(user_id, group_id)
97
102
  raise 'invalid capability' unless CAPABILITIES.include? capability.to_s
98
103
  raise 'invalid mode' unless CAPABILITY_MODES.include? capability_mode.to_s
@@ -155,6 +160,7 @@ module TableauApi
155
160
  capabilities.each do |k, v|
156
161
  k = k.to_s
157
162
  raise "invalid capability #{k}" unless CAPABILITIES.include? k
163
+
158
164
  c.capability(name: k, mode: v ? 'Allow' : 'Deny')
159
165
  end
160
166
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TableauApi
2
- VERSION = '4.1.0'.freeze
4
+ VERSION = '5.0.0'
3
5
  end
data/lib/tableau_api.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'httparty'
2
4
  require 'builder'
3
5
  require 'net/http/post/multipart'
@@ -19,8 +21,8 @@ require 'tableau_api/resources/jobs'
19
21
 
20
22
  module TableauApi
21
23
  class << self
22
- def new(options = {})
23
- Client.new(options)
24
+ def new(**options)
25
+ Client.new(**options)
24
26
  end
25
27
  end
26
28
  end
data/tableau_api.gemspec CHANGED
@@ -1,6 +1,6 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'tableau_api/version'
6
6
 
@@ -19,19 +19,20 @@ Gem::Specification.new do |spec|
19
19
  spec.bindir = 'exe'
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
- spec.required_ruby_version = '~> 2.1'
22
+ spec.required_ruby_version = '>= 2.7'
23
23
 
24
- spec.add_dependency 'httparty', '~> 0.13'
25
24
  spec.add_dependency 'builder', '~> 3.2'
25
+ spec.add_dependency 'httparty', '~> 0.13'
26
26
  spec.add_dependency 'multipart-post', '~> 2.0'
27
27
  spec.add_dependency 'rubyzip', '~> 1.0'
28
28
 
29
- spec.add_development_dependency 'rake', '~> 11.0'
30
- spec.add_development_dependency 'rspec', '~> 3.6'
31
- spec.add_development_dependency 'vcr', '~> 3.0'
32
- spec.add_development_dependency 'webmock', '~> 3.0'
29
+ spec.add_development_dependency 'chunky_png', '~> 1.3.11'
33
30
  spec.add_development_dependency 'pry', '~> 0.10'
34
31
  spec.add_development_dependency 'pry-byebug', '~> 3.4'
35
- spec.add_development_dependency 'rubocop', '~> 0.49.0'
36
- spec.add_development_dependency 'chunky_png', '~> 1.3.11'
32
+ spec.add_development_dependency 'rake', '~> 12.3.3'
33
+ spec.add_development_dependency 'rspec', '~> 3.6'
34
+ spec.add_development_dependency 'rubocop', '~> 1.48.1'
35
+ spec.add_development_dependency 'vcr', '~> 6.0'
36
+ spec.add_development_dependency 'webmock', '~> 3.0'
37
+ spec.metadata['rubygems_mfa_required'] = 'true'
37
38
  end
metadata CHANGED
@@ -1,45 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tableau_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Manning
8
8
  - Matt Brennan
9
9
  - Jonathan Cobian
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2022-04-28 00:00:00.000000000 Z
13
+ date: 2023-03-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: httparty
16
+ name: builder
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '0.13'
21
+ version: '3.2'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '0.13'
28
+ version: '3.2'
29
29
  - !ruby/object:Gem::Dependency
30
- name: builder
30
+ name: httparty
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: '3.2'
35
+ version: '0.13'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '3.2'
42
+ version: '0.13'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: multipart-post
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -69,118 +69,118 @@ dependencies:
69
69
  - !ruby/object:Gem::Version
70
70
  version: '1.0'
71
71
  - !ruby/object:Gem::Dependency
72
- name: rake
72
+ name: chunky_png
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: '11.0'
77
+ version: 1.3.11
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - "~>"
83
83
  - !ruby/object:Gem::Version
84
- version: '11.0'
84
+ version: 1.3.11
85
85
  - !ruby/object:Gem::Dependency
86
- name: rspec
86
+ name: pry
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: '3.6'
91
+ version: '0.10'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: '3.6'
98
+ version: '0.10'
99
99
  - !ruby/object:Gem::Dependency
100
- name: vcr
100
+ name: pry-byebug
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - "~>"
104
104
  - !ruby/object:Gem::Version
105
- version: '3.0'
105
+ version: '3.4'
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - "~>"
111
111
  - !ruby/object:Gem::Version
112
- version: '3.0'
112
+ version: '3.4'
113
113
  - !ruby/object:Gem::Dependency
114
- name: webmock
114
+ name: rake
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - "~>"
118
118
  - !ruby/object:Gem::Version
119
- version: '3.0'
119
+ version: 12.3.3
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - "~>"
125
125
  - !ruby/object:Gem::Version
126
- version: '3.0'
126
+ version: 12.3.3
127
127
  - !ruby/object:Gem::Dependency
128
- name: pry
128
+ name: rspec
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - "~>"
132
132
  - !ruby/object:Gem::Version
133
- version: '0.10'
133
+ version: '3.6'
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - "~>"
139
139
  - !ruby/object:Gem::Version
140
- version: '0.10'
140
+ version: '3.6'
141
141
  - !ruby/object:Gem::Dependency
142
- name: pry-byebug
142
+ name: rubocop
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - "~>"
146
146
  - !ruby/object:Gem::Version
147
- version: '3.4'
147
+ version: 1.48.1
148
148
  type: :development
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - "~>"
153
153
  - !ruby/object:Gem::Version
154
- version: '3.4'
154
+ version: 1.48.1
155
155
  - !ruby/object:Gem::Dependency
156
- name: rubocop
156
+ name: vcr
157
157
  requirement: !ruby/object:Gem::Requirement
158
158
  requirements:
159
159
  - - "~>"
160
160
  - !ruby/object:Gem::Version
161
- version: 0.49.0
161
+ version: '6.0'
162
162
  type: :development
163
163
  prerelease: false
164
164
  version_requirements: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - "~>"
167
167
  - !ruby/object:Gem::Version
168
- version: 0.49.0
168
+ version: '6.0'
169
169
  - !ruby/object:Gem::Dependency
170
- name: chunky_png
170
+ name: webmock
171
171
  requirement: !ruby/object:Gem::Requirement
172
172
  requirements:
173
173
  - - "~>"
174
174
  - !ruby/object:Gem::Version
175
- version: 1.3.11
175
+ version: '3.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: 1.3.11
183
- description:
182
+ version: '3.0'
183
+ description:
184
184
  email:
185
185
  - opensource@civisanalytics.com
186
186
  executables: []
@@ -219,25 +219,25 @@ files:
219
219
  homepage: https://github.com/civisanalytics/tableau_api
220
220
  licenses:
221
221
  - BSD-3-Clause
222
- metadata: {}
223
- post_install_message:
222
+ metadata:
223
+ rubygems_mfa_required: 'true'
224
+ post_install_message:
224
225
  rdoc_options: []
225
226
  require_paths:
226
227
  - lib
227
228
  required_ruby_version: !ruby/object:Gem::Requirement
228
229
  requirements:
229
- - - "~>"
230
+ - - ">="
230
231
  - !ruby/object:Gem::Version
231
- version: '2.1'
232
+ version: '2.7'
232
233
  required_rubygems_version: !ruby/object:Gem::Requirement
233
234
  requirements:
234
235
  - - ">="
235
236
  - !ruby/object:Gem::Version
236
237
  version: '0'
237
238
  requirements: []
238
- rubyforge_project:
239
- rubygems_version: 2.6.14.4
240
- signing_key:
239
+ rubygems_version: 3.4.6
240
+ signing_key:
241
241
  specification_version: 4
242
242
  summary: Ruby interface to the Tableau API.
243
243
  test_files: []