sisense 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +66 -0
- data/CHANGELOG.md +15 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +42 -37
- data/README.md +12 -5
- data/Rakefile +2 -2
- data/lib/sisense.rb +23 -22
- data/lib/sisense/alert.rb +1 -1
- data/lib/sisense/api/client.rb +35 -16
- data/lib/sisense/api/nested_resource.rb +2 -2
- data/lib/sisense/api/resource.rb +3 -3
- data/lib/sisense/connection.rb +1 -1
- data/lib/sisense/dashboard.rb +1 -1
- data/lib/sisense/dataset.rb +1 -1
- data/lib/sisense/elasticube.rb +3 -3
- data/lib/sisense/elasticube_datasecurity.rb +4 -4
- data/lib/sisense/folder.rb +1 -1
- data/lib/sisense/group.rb +13 -2
- data/lib/sisense/role.rb +17 -0
- data/lib/sisense/share.rb +1 -1
- data/lib/sisense/translation.rb +1 -1
- data/lib/sisense/user.rb +4 -4
- data/lib/sisense/utils/string.rb +4 -4
- data/lib/sisense/version.rb +1 -1
- data/lib/sisense/widget.rb +1 -1
- data/sisense.gemspec +20 -20
- metadata +12 -12
- data/.rubocop.yml +0 -9
- data/.travis.yml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 457d08dcd0462118b16fd1ed8eae5ab2b8a46dfe1455c3e7a4be46debaaa76dd
|
4
|
+
data.tar.gz: 3deea29c97b2216b584839eab1ee659c042c7e9e5b941f4d5c5c56a36467fb0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74924a50b1a346626d592de8ca62bfb57c493d24466588fb784055c2193a41a7c4eea9a1b70c331a6867d561751b2ab7a03ede5544a1914c70a54a70de77e2c4
|
7
|
+
data.tar.gz: c23c60cb42ea822a0e08a949fd4d990d83309d48c0524b3633233a2abf472691c0f940a05eb85073bc91080661a2889c8143f686c2ddaae829f350122c7692a8
|
@@ -0,0 +1,66 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
tests:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: [2.6]
|
11
|
+
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@master
|
14
|
+
|
15
|
+
- name: Set up the Ruby version
|
16
|
+
uses: actions/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby }}
|
19
|
+
|
20
|
+
- name: Ruby gem cache
|
21
|
+
uses: actions/cache@v1
|
22
|
+
with:
|
23
|
+
path: vendor/bundle
|
24
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
25
|
+
restore-keys: |
|
26
|
+
${{ runner.os }}-gems-
|
27
|
+
|
28
|
+
- name: Set up the environment
|
29
|
+
run: |
|
30
|
+
gem install bundler
|
31
|
+
bundle config path vendor/bundle
|
32
|
+
bundle install --jobs 4 --retry 3
|
33
|
+
|
34
|
+
- name: Runs tests
|
35
|
+
run: bundle exec rspec
|
36
|
+
|
37
|
+
standard:
|
38
|
+
runs-on: ubuntu-latest
|
39
|
+
strategy:
|
40
|
+
matrix:
|
41
|
+
ruby: [2.6]
|
42
|
+
|
43
|
+
steps:
|
44
|
+
- uses: actions/checkout@master
|
45
|
+
|
46
|
+
- name: Set up the Ruby version
|
47
|
+
uses: actions/setup-ruby@v1
|
48
|
+
with:
|
49
|
+
ruby-version: ${{ matrix.ruby }}
|
50
|
+
|
51
|
+
- name: Ruby gem cache
|
52
|
+
uses: actions/cache@v1
|
53
|
+
with:
|
54
|
+
path: vendor/bundle
|
55
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
56
|
+
restore-keys: |
|
57
|
+
${{ runner.os }}-gems-
|
58
|
+
|
59
|
+
- name: Set up the environment
|
60
|
+
run: |
|
61
|
+
gem install bundler
|
62
|
+
bundle config path vendor/bundle
|
63
|
+
bundle install --jobs 4 --retry 3
|
64
|
+
|
65
|
+
- name: Run Standard
|
66
|
+
run: bundle exec standardrb
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
### 1.2.0 / 2020-11-03
|
4
|
+
|
5
|
+
- Add support for Group update endpoint
|
6
|
+
- Add support for Role resource
|
7
|
+
|
8
|
+
### 1.1.0 / 2019-04-01
|
9
|
+
|
10
|
+
- Add support for Group deletion
|
11
|
+
- Handle legacy api error format
|
12
|
+
|
13
|
+
## 1.0.0 / 2018-10-04
|
14
|
+
|
15
|
+
- Initial release
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,60 +1,65 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sisense (
|
4
|
+
sisense (1.2.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
addressable (2.
|
10
|
-
public_suffix (>= 2.0.2, <
|
9
|
+
addressable (2.7.0)
|
10
|
+
public_suffix (>= 2.0.2, < 5.0)
|
11
11
|
ast (2.4.0)
|
12
12
|
coderay (1.1.2)
|
13
13
|
crack (0.4.3)
|
14
14
|
safe_yaml (~> 1.0.0)
|
15
15
|
diff-lcs (1.3)
|
16
|
-
hashdiff (0.
|
17
|
-
jaro_winkler (1.5.
|
18
|
-
method_source (0.
|
19
|
-
parallel (1.
|
20
|
-
parser (2.
|
16
|
+
hashdiff (1.0.1)
|
17
|
+
jaro_winkler (1.5.4)
|
18
|
+
method_source (1.0.0)
|
19
|
+
parallel (1.19.1)
|
20
|
+
parser (2.7.1.2)
|
21
21
|
ast (~> 2.4.0)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
public_suffix (3.0.3)
|
22
|
+
pry (0.13.1)
|
23
|
+
coderay (~> 1.1)
|
24
|
+
method_source (~> 1.0)
|
25
|
+
public_suffix (4.0.5)
|
27
26
|
rainbow (3.0.0)
|
28
|
-
rake (
|
29
|
-
|
30
|
-
|
31
|
-
rspec-
|
32
|
-
rspec-
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
rake (13.0.1)
|
28
|
+
rexml (3.2.4)
|
29
|
+
rspec (3.9.0)
|
30
|
+
rspec-core (~> 3.9.0)
|
31
|
+
rspec-expectations (~> 3.9.0)
|
32
|
+
rspec-mocks (~> 3.9.0)
|
33
|
+
rspec-core (3.9.2)
|
34
|
+
rspec-support (~> 3.9.3)
|
35
|
+
rspec-expectations (3.9.2)
|
36
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-mocks (3.
|
37
|
+
rspec-support (~> 3.9.0)
|
38
|
+
rspec-mocks (3.9.1)
|
39
39
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-support (3.
|
42
|
-
rubocop (0.
|
40
|
+
rspec-support (~> 3.9.0)
|
41
|
+
rspec-support (3.9.3)
|
42
|
+
rubocop (0.82.0)
|
43
43
|
jaro_winkler (~> 1.5.1)
|
44
44
|
parallel (~> 1.10)
|
45
|
-
parser (>= 2.
|
46
|
-
powerpack (~> 0.1)
|
45
|
+
parser (>= 2.7.0.1)
|
47
46
|
rainbow (>= 2.2.2, < 4.0)
|
47
|
+
rexml
|
48
48
|
ruby-progressbar (~> 1.7)
|
49
|
-
unicode-display_width (
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
50
|
+
rubocop-performance (1.5.2)
|
51
|
+
rubocop (>= 0.71.0)
|
52
|
+
ruby-progressbar (1.10.1)
|
53
|
+
safe_yaml (1.0.5)
|
54
|
+
standard (0.4.1)
|
55
|
+
rubocop (~> 0.82.0)
|
56
|
+
rubocop-performance (~> 1.5.2)
|
57
|
+
unicode-display_width (1.7.0)
|
58
|
+
vcr (5.1.0)
|
59
|
+
webmock (3.8.3)
|
55
60
|
addressable (>= 2.3.6)
|
56
61
|
crack (>= 0.3.2)
|
57
|
-
hashdiff
|
62
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
58
63
|
|
59
64
|
PLATFORMS
|
60
65
|
ruby
|
@@ -64,10 +69,10 @@ DEPENDENCIES
|
|
64
69
|
pry
|
65
70
|
rake
|
66
71
|
rspec
|
67
|
-
rubocop
|
68
72
|
sisense!
|
73
|
+
standard
|
69
74
|
vcr
|
70
75
|
webmock
|
71
76
|
|
72
77
|
BUNDLED WITH
|
73
|
-
1.
|
78
|
+
1.17.3
|
data/README.md
CHANGED
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.com/chronogolf/sisense.svg?branch=master)](https://travis-ci.com/chronogolf/sisense)
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
TODO: Delete this and the text above, and describe your gem
|
5
|
+
This gem is a wrapper around [Sisense API](https://developers.sisense.com/display/API2/REST+API+Reference+-+v1.0)
|
8
6
|
|
9
7
|
## Installation
|
10
8
|
|
@@ -24,11 +22,18 @@ Or install it yourself as:
|
|
24
22
|
|
25
23
|
## Usage
|
26
24
|
|
27
|
-
|
25
|
+
```ruby
|
26
|
+
Sisense.access_token = 'MyToken'
|
27
|
+
Sisense.hostname = 'bi.chronogolf.com'
|
28
|
+
Sisense.use_ssl = true
|
29
|
+
|
30
|
+
# List all supported resources
|
31
|
+
Sisense.api_resources
|
32
|
+
```
|
28
33
|
|
29
34
|
## Development
|
30
35
|
|
31
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `
|
36
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
32
37
|
|
33
38
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
34
39
|
|
@@ -36,6 +41,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
36
41
|
|
37
42
|
Bug reports and pull requests are welcome on GitHub at https://github.com/chronogolf/sisense.
|
38
43
|
|
44
|
+
Please make sure to run changes through [Standard ruby](https://github.com/testdouble/standard). `bundle exec standardrb --fix`
|
45
|
+
|
39
46
|
## License
|
40
47
|
|
41
48
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
data/lib/sisense.rb
CHANGED
@@ -1,24 +1,25 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
1
|
+
require "sisense/utils/string"
|
2
|
+
require "sisense/version"
|
3
|
+
require "sisense/api/client"
|
4
|
+
require "sisense/api/resource"
|
5
|
+
require "sisense/api/nested_resource"
|
6
|
+
require "sisense/api/error"
|
7
|
+
require "sisense/api/not_found_error"
|
8
|
+
require "sisense/api/unprocessable_entity_error"
|
9
9
|
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
10
|
+
require "sisense/alert"
|
11
|
+
require "sisense/connection"
|
12
|
+
require "sisense/dashboard"
|
13
|
+
require "sisense/dataset"
|
14
|
+
require "sisense/elasticube"
|
15
|
+
require "sisense/elasticube_datasecurity"
|
16
|
+
require "sisense/folder"
|
17
|
+
require "sisense/group"
|
18
|
+
require "sisense/role"
|
19
|
+
require "sisense/share"
|
20
|
+
require "sisense/translation"
|
21
|
+
require "sisense/user"
|
22
|
+
require "sisense/widget"
|
22
23
|
|
23
24
|
module Sisense
|
24
25
|
@access_token = nil
|
@@ -29,9 +30,9 @@ module Sisense
|
|
29
30
|
attr_accessor :access_token, :hostname, :use_ssl
|
30
31
|
|
31
32
|
def api_resources
|
32
|
-
@api_resources ||= API::Resource.descendants.each_with_object({})
|
33
|
+
@api_resources ||= API::Resource.descendants.each_with_object({}) { |descendant, resources|
|
33
34
|
resources[descendant::RESOURCE_NAME] = descendant
|
34
|
-
|
35
|
+
}.sort.to_h.freeze
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
data/lib/sisense/alert.rb
CHANGED
data/lib/sisense/api/client.rb
CHANGED
@@ -1,11 +1,16 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "net/http"
|
2
|
+
require "uri"
|
3
|
+
require "cgi"
|
4
|
+
require "json"
|
5
|
+
require "erb"
|
5
6
|
|
6
7
|
module Sisense
|
7
8
|
module API
|
8
9
|
class Client
|
10
|
+
include ERB::Util
|
11
|
+
|
12
|
+
PATH_SEGMENT_PATTERN = %r{[^/]+}.freeze
|
13
|
+
|
9
14
|
VERB_MAP = {
|
10
15
|
get: Net::HTTP::Get,
|
11
16
|
post: Net::HTTP::Post,
|
@@ -45,7 +50,9 @@ module Sisense
|
|
45
50
|
def parsed_response(response, object_class:)
|
46
51
|
response_hash = JSON.parse(response.body)
|
47
52
|
if collection?(response_hash)
|
48
|
-
response_hash
|
53
|
+
response_hash
|
54
|
+
.select { |obj| obj.is_a?(Hash) }
|
55
|
+
.map { |json_item| object_class.new(json_item) }
|
49
56
|
else
|
50
57
|
object_class.new(response_hash)
|
51
58
|
end
|
@@ -74,31 +81,41 @@ module Sisense
|
|
74
81
|
|
75
82
|
def handle_response(response)
|
76
83
|
return response if %w[200 201 204].include?(response.code)
|
84
|
+
|
77
85
|
handle_error(response)
|
78
86
|
end
|
79
87
|
|
80
88
|
def handle_error(response)
|
81
|
-
error_params = JSON.parse(response.body, symbolize_names: true)
|
89
|
+
error_params = JSON.parse(response.body, symbolize_names: true)
|
90
|
+
new_api_format_error_params = error_params[:error]
|
91
|
+
error_params = new_api_format_error_params || error_params
|
82
92
|
case response.code
|
83
|
-
when
|
84
|
-
raise Sisense::API::NotFoundError
|
85
|
-
when
|
86
|
-
raise Sisense::API::UnprocessableEntityError
|
93
|
+
when "404"
|
94
|
+
raise Sisense::API::NotFoundError, error_params
|
95
|
+
when "422"
|
96
|
+
raise Sisense::API::UnprocessableEntityError, error_params
|
87
97
|
else
|
88
|
-
raise Sisense::API::Error
|
98
|
+
raise Sisense::API::Error, error_params
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def encode_path_segments(path)
|
103
|
+
path.gsub PATH_SEGMENT_PATTERN do |segment|
|
104
|
+
url_encode(segment)
|
89
105
|
end
|
90
106
|
end
|
91
107
|
|
92
108
|
def encode_path(path, params = nil)
|
93
|
-
encoded_path =
|
94
|
-
return
|
109
|
+
encoded_path = encode_path_segments(path)
|
110
|
+
return encoded_path if params.nil?
|
95
111
|
|
96
112
|
encoded_params = URI.encode_www_form(params)
|
97
|
-
|
113
|
+
uri = URI::HTTP.build(path: encoded_path, query: encoded_params)
|
114
|
+
uri.request_uri
|
98
115
|
end
|
99
116
|
|
100
117
|
def headers
|
101
|
-
@headers ||= {
|
118
|
+
@headers ||= {"Authorization" => "Bearer #{Sisense.access_token}", "Content-Type" => "application/json"}
|
102
119
|
end
|
103
120
|
|
104
121
|
def parameterize(object)
|
@@ -106,7 +123,7 @@ module Sisense
|
|
106
123
|
return object.map { |item| parameterize(item) } if object.is_a?(Array)
|
107
124
|
|
108
125
|
obj.keys.each do |key|
|
109
|
-
obj[key] = parameterize_object(obj[key])
|
126
|
+
obj[key] = parameterize_object(obj[key])
|
110
127
|
obj[key.to_s.to_camel_case] = obj.delete(key)
|
111
128
|
end
|
112
129
|
end
|
@@ -116,6 +133,8 @@ module Sisense
|
|
116
133
|
return parameterize(object.to_h) if Sisense::API::Resource.descendants.include?(object.class)
|
117
134
|
return parameterize(object) if object.is_a?(Hash)
|
118
135
|
return object.map { |item| item.is_a?(String) ? item : parameterize_object(item) } if object.is_a?(Array)
|
136
|
+
|
137
|
+
object
|
119
138
|
end
|
120
139
|
end
|
121
140
|
end
|
@@ -2,9 +2,9 @@ module Sisense
|
|
2
2
|
module API
|
3
3
|
class NestedResource < Resource
|
4
4
|
def self.resource_base_path(use_legacy_api: false)
|
5
|
-
raise NotImplementedError,
|
5
|
+
raise NotImplementedError, "Sisense::API::NestedResource is an abstract class" if self == NestedResource
|
6
6
|
|
7
|
-
path_base = use_legacy_api ?
|
7
|
+
path_base = use_legacy_api ? "/api/" : "/api/v1/"
|
8
8
|
path_base + self::PARENT_CLASS::RESOURCE_NAME
|
9
9
|
end
|
10
10
|
end
|
data/lib/sisense/api/resource.rb
CHANGED
@@ -10,13 +10,13 @@ module Sisense
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.class_name
|
13
|
-
name.split(
|
13
|
+
name.split("::")[-1]
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.resource_base_path(use_legacy_api: false)
|
17
|
-
raise NotImplementedError,
|
17
|
+
raise NotImplementedError, "Sisense::API::Resource is an abstract class" if self == Resource
|
18
18
|
|
19
|
-
path_base = use_legacy_api ?
|
19
|
+
path_base = use_legacy_api ? "/api/" : "/api/v1/"
|
20
20
|
path_base + self::RESOURCE_NAME
|
21
21
|
end
|
22
22
|
|
data/lib/sisense/connection.rb
CHANGED
data/lib/sisense/dashboard.rb
CHANGED
data/lib/sisense/dataset.rb
CHANGED
data/lib/sisense/elasticube.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
module Sisense
|
2
2
|
class Elasticube < API::Resource
|
3
|
-
RESOURCE_NAME =
|
3
|
+
RESOURCE_NAME = "elasticubes".freeze
|
4
4
|
|
5
5
|
def self.list
|
6
|
-
path = [resource_base_path,
|
6
|
+
path = [resource_base_path, "getElasticubes"].join("/")
|
7
7
|
response = api_client.get(path)
|
8
8
|
api_client.parsed_response(response, object_class: self)
|
9
9
|
end
|
10
10
|
|
11
11
|
def datasecurity
|
12
|
-
@datasecurity ||= ElasticubeDatasecurity.list(params: {
|
12
|
+
@datasecurity ||= ElasticubeDatasecurity.list(params: {server: server, elasticube_title: title})
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -1,24 +1,24 @@
|
|
1
1
|
module Sisense
|
2
2
|
class ElasticubeDatasecurity < API::NestedResource
|
3
|
-
RESOURCE_NAME =
|
3
|
+
RESOURCE_NAME = "datasecurity".freeze
|
4
4
|
PARENT_CLASS = Sisense::Elasticube
|
5
5
|
|
6
6
|
def self.list(params: {})
|
7
7
|
server = params[:server]
|
8
8
|
title = params[:elasticube_title]
|
9
|
-
path = [resource_base_path(use_legacy_api: true), server, title,
|
9
|
+
path = [resource_base_path(use_legacy_api: true), server, title, "datasecurity"].join("/")
|
10
10
|
response = api_client.get(path)
|
11
11
|
api_client.parsed_response(response, object_class: self)
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.create(params:)
|
15
|
-
path = [resource_base_path(use_legacy_api: true),
|
15
|
+
path = [resource_base_path(use_legacy_api: true), "datasecurity"].join("/")
|
16
16
|
response = api_client.post(path, params: params)
|
17
17
|
api_client.parsed_response(response, object_class: self)
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.update(id:, params:)
|
21
|
-
path = [resource_base_path(use_legacy_api: true),
|
21
|
+
path = [resource_base_path(use_legacy_api: true), "datasecurity", id].join("/")
|
22
22
|
response = api_client.put(path, params: params)
|
23
23
|
api_client.parsed_response(response, object_class: self)
|
24
24
|
end
|
data/lib/sisense/folder.rb
CHANGED
data/lib/sisense/group.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Sisense
|
2
2
|
class Group < API::Resource
|
3
|
-
RESOURCE_NAME =
|
3
|
+
RESOURCE_NAME = "groups".freeze
|
4
4
|
|
5
5
|
def self.list(params: nil)
|
6
6
|
path = resource_base_path
|
@@ -9,7 +9,7 @@ module Sisense
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.retrieve(id:, params: nil)
|
12
|
-
path = [resource_base_path, id].join(
|
12
|
+
path = [resource_base_path, id].join("/")
|
13
13
|
response = api_client.get(path, params: params)
|
14
14
|
api_client.parsed_response(response, object_class: self)
|
15
15
|
end
|
@@ -19,5 +19,16 @@ module Sisense
|
|
19
19
|
response = api_client.post(path, params: params)
|
20
20
|
api_client.parsed_response(response, object_class: self)
|
21
21
|
end
|
22
|
+
|
23
|
+
def self.update(id:, params:)
|
24
|
+
path = [resource_base_path(use_legacy_api: true), id].join("/")
|
25
|
+
response = api_client.put(path, params: params)
|
26
|
+
api_client.parsed_response(response, object_class: self)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.delete(id:)
|
30
|
+
path = [resource_base_path, id].join("/")
|
31
|
+
api_client.delete(path)
|
32
|
+
end
|
22
33
|
end
|
23
34
|
end
|
data/lib/sisense/role.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Sisense
|
2
|
+
class Role < API::Resource
|
3
|
+
RESOURCE_NAME = "roles".freeze
|
4
|
+
|
5
|
+
def self.list(params: nil)
|
6
|
+
path = resource_base_path(use_legacy_api: true)
|
7
|
+
response = api_client.get(path, params: params)
|
8
|
+
api_client.parsed_response(response, object_class: self)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.retrieve(id:, params: nil)
|
12
|
+
path = [resource_base_path(use_legacy_api: true), id].join("/")
|
13
|
+
response = api_client.get(path, params: params)
|
14
|
+
api_client.parsed_response(response, object_class: self)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/sisense/share.rb
CHANGED
data/lib/sisense/translation.rb
CHANGED
data/lib/sisense/user.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Sisense
|
2
2
|
class User < API::Resource
|
3
|
-
RESOURCE_NAME =
|
3
|
+
RESOURCE_NAME = "users".freeze
|
4
4
|
|
5
5
|
def self.list(params: nil)
|
6
6
|
path = resource_base_path
|
@@ -9,7 +9,7 @@ module Sisense
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.retrieve(id:, params: nil)
|
12
|
-
path = [resource_base_path, id].join(
|
12
|
+
path = [resource_base_path, id].join("/")
|
13
13
|
response = api_client.get(path, params: params)
|
14
14
|
api_client.parsed_response(response, object_class: self)
|
15
15
|
end
|
@@ -21,13 +21,13 @@ module Sisense
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.update(id:, params:)
|
24
|
-
path = [resource_base_path, id].join(
|
24
|
+
path = [resource_base_path, id].join("/")
|
25
25
|
response = api_client.patch(path, params: params)
|
26
26
|
api_client.parsed_response(response, object_class: self)
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.delete(id:)
|
30
|
-
path = [resource_base_path, id].join(
|
30
|
+
path = [resource_base_path, id].join("/")
|
31
31
|
api_client.delete(path)
|
32
32
|
end
|
33
33
|
end
|
data/lib/sisense/utils/string.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
class String
|
2
2
|
def to_snake_case
|
3
|
-
gsub(/::/,
|
3
|
+
gsub(/::/, "/")
|
4
4
|
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
5
5
|
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
6
|
-
.tr(
|
6
|
+
.tr("-", "_")
|
7
7
|
.downcase
|
8
8
|
end
|
9
9
|
|
10
10
|
def to_camel_case
|
11
|
-
split(
|
11
|
+
split("_").each_with_object([]).with_index { |(string_part, string_parts), index|
|
12
12
|
string_part.capitalize! if index > 0
|
13
13
|
string_parts << string_part
|
14
|
-
|
14
|
+
}.join
|
15
15
|
end
|
16
16
|
end
|
data/lib/sisense/version.rb
CHANGED
data/lib/sisense/widget.rb
CHANGED
data/sisense.gemspec
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
lib = File.expand_path(
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require
|
3
|
+
require "sisense/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
7
|
-
spec.version
|
8
|
-
spec.authors
|
9
|
-
spec.email
|
6
|
+
spec.name = "sisense"
|
7
|
+
spec.version = Sisense::VERSION
|
8
|
+
spec.authors = ["Olivier Buffon"]
|
9
|
+
spec.email = ["developers@chronogolf.ca"]
|
10
10
|
|
11
|
-
spec.summary
|
12
|
-
spec.description
|
13
|
-
spec.license
|
11
|
+
spec.summary = "Sisense Ruby API Client"
|
12
|
+
spec.description = "Light API client to communicate with Sisense API"
|
13
|
+
spec.license = "MIT"
|
14
14
|
|
15
|
-
spec.files
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
16
16
|
f.match(%r{^(test|spec|features)/})
|
17
17
|
end
|
18
|
-
spec.bindir
|
19
|
-
spec.executables
|
20
|
-
spec.require_paths = [
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
22
|
+
spec.add_development_dependency "bundler"
|
23
|
+
spec.add_development_dependency "pry"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
spec.add_development_dependency "standard"
|
27
|
+
spec.add_development_dependency "vcr"
|
28
|
+
spec.add_development_dependency "webmock"
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sisense
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olivier Buffon
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: standard
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -110,15 +110,15 @@ dependencies:
|
|
110
110
|
version: '0'
|
111
111
|
description: Light API client to communicate with Sisense API
|
112
112
|
email:
|
113
|
-
-
|
113
|
+
- developers@chronogolf.ca
|
114
114
|
executables: []
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
+
- ".github/workflows/ci.yml"
|
118
119
|
- ".gitignore"
|
119
120
|
- ".rspec"
|
120
|
-
-
|
121
|
-
- ".travis.yml"
|
121
|
+
- CHANGELOG.md
|
122
122
|
- Gemfile
|
123
123
|
- Gemfile.lock
|
124
124
|
- LICENSE.txt
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- lib/sisense/elasticube_datasecurity.rb
|
142
142
|
- lib/sisense/folder.rb
|
143
143
|
- lib/sisense/group.rb
|
144
|
+
- lib/sisense/role.rb
|
144
145
|
- lib/sisense/share.rb
|
145
146
|
- lib/sisense/translation.rb
|
146
147
|
- lib/sisense/user.rb
|
@@ -148,11 +149,11 @@ files:
|
|
148
149
|
- lib/sisense/version.rb
|
149
150
|
- lib/sisense/widget.rb
|
150
151
|
- sisense.gemspec
|
151
|
-
homepage:
|
152
|
+
homepage:
|
152
153
|
licenses:
|
153
154
|
- MIT
|
154
155
|
metadata: {}
|
155
|
-
post_install_message:
|
156
|
+
post_install_message:
|
156
157
|
rdoc_options: []
|
157
158
|
require_paths:
|
158
159
|
- lib
|
@@ -167,9 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
168
|
- !ruby/object:Gem::Version
|
168
169
|
version: '0'
|
169
170
|
requirements: []
|
170
|
-
|
171
|
-
|
172
|
-
signing_key:
|
171
|
+
rubygems_version: 3.0.6
|
172
|
+
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: Sisense Ruby API Client
|
175
175
|
test_files: []
|
data/.rubocop.yml
DELETED