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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c341c078fadf708c850b18d17e5f7feccee4ac814dcecba44d635d82a8ef3fc2
4
- data.tar.gz: b728e16dbb30fd18d8831adb4c6e1189fc1f0baedef479e3a3d86e72ab3880a4
3
+ metadata.gz: 457d08dcd0462118b16fd1ed8eae5ab2b8a46dfe1455c3e7a4be46debaaa76dd
4
+ data.tar.gz: 3deea29c97b2216b584839eab1ee659c042c7e9e5b941f4d5c5c56a36467fb0d
5
5
  SHA512:
6
- metadata.gz: 3ed7d1b9842bb6e7baf6166c4733e7cc0aa89f9c9babc358ed407c1a75ce249fb53127c4417b42061c30fb3b51efd9ef00cbb966e2f7170f9525da8f4d67b167
7
- data.tar.gz: b40f1dcdebd041efd630b7254c17b9561253512642415dcf571122b9187cf15588b557cbf8f8bd423791f360099f74042df371e4db4996efa48a5ea077adfcd0
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
@@ -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
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
@@ -1,60 +1,65 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sisense (0.1.0)
4
+ sisense (1.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- addressable (2.5.2)
10
- public_suffix (>= 2.0.2, < 4.0)
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.3.7)
17
- jaro_winkler (1.5.1)
18
- method_source (0.9.0)
19
- parallel (1.12.1)
20
- parser (2.5.1.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
- powerpack (0.1.2)
23
- pry (0.11.3)
24
- coderay (~> 1.1.0)
25
- method_source (~> 0.9.0)
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 (12.3.1)
29
- rspec (3.8.0)
30
- rspec-core (~> 3.8.0)
31
- rspec-expectations (~> 3.8.0)
32
- rspec-mocks (~> 3.8.0)
33
- rspec-core (3.8.0)
34
- rspec-support (~> 3.8.0)
35
- rspec-expectations (3.8.1)
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.8.0)
38
- rspec-mocks (3.8.0)
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.8.0)
41
- rspec-support (3.8.0)
42
- rubocop (0.59.1)
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.5, != 2.5.1.1)
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 (~> 1.0, >= 1.0.1)
50
- ruby-progressbar (1.10.0)
51
- safe_yaml (1.0.4)
52
- unicode-display_width (1.4.0)
53
- vcr (4.0.0)
54
- webmock (3.4.2)
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.16.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
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sisense`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Write usage instructions here
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 `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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
@@ -1,5 +1,5 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
@@ -1,24 +1,25 @@
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'
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 '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/share'
19
- require 'sisense/translation'
20
- require 'sisense/user'
21
- require 'sisense/widget'
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({}) do |descendant, resources|
33
+ @api_resources ||= API::Resource.descendants.each_with_object({}) { |descendant, resources|
33
34
  resources[descendant::RESOURCE_NAME] = descendant
34
- end.freeze
35
+ }.sort.to_h.freeze
35
36
  end
36
37
  end
37
38
  end
@@ -1,5 +1,5 @@
1
1
  module Sisense
2
2
  class Alert < API::Resource
3
- RESOURCE_NAME = 'alerts'.freeze
3
+ RESOURCE_NAME = "alerts".freeze
4
4
  end
5
5
  end
@@ -1,11 +1,16 @@
1
- require 'net/http'
2
- require 'uri'
3
- require 'cgi'
4
- require 'json'
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.map { |json_item| object_class.new(json_item) }
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)[:error]
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 '404'
84
- raise Sisense::API::NotFoundError.new(error_params)
85
- when '422'
86
- raise Sisense::API::UnprocessableEntityError.new(error_params)
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.new(error_params)
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 = URI.encode(path)
94
- return path if params.nil?
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
- [encoded_path, encoded_params].join('?')
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 ||= { 'Authorization' => "Bearer #{Sisense.access_token}", 'Content-Type' => 'application/json' }
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]) unless obj[key].is_a?(String)
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, 'Sisense::API::NestedResource is an abstract class' if self == NestedResource
5
+ raise NotImplementedError, "Sisense::API::NestedResource is an abstract class" if self == NestedResource
6
6
 
7
- path_base = use_legacy_api ? '/api/' : '/api/v1/'
7
+ path_base = use_legacy_api ? "/api/" : "/api/v1/"
8
8
  path_base + self::PARENT_CLASS::RESOURCE_NAME
9
9
  end
10
10
  end
@@ -10,13 +10,13 @@ module Sisense
10
10
  end
11
11
 
12
12
  def self.class_name
13
- name.split('::')[-1]
13
+ name.split("::")[-1]
14
14
  end
15
15
 
16
16
  def self.resource_base_path(use_legacy_api: false)
17
- raise NotImplementedError, 'Sisense::API::Resource is an abstract class' if self == Resource
17
+ raise NotImplementedError, "Sisense::API::Resource is an abstract class" if self == Resource
18
18
 
19
- path_base = use_legacy_api ? '/api/' : '/api/v1/'
19
+ path_base = use_legacy_api ? "/api/" : "/api/v1/"
20
20
  path_base + self::RESOURCE_NAME
21
21
  end
22
22
 
@@ -1,5 +1,5 @@
1
1
  module Sisense
2
2
  class Connection < API::Resource
3
- RESOURCE_NAME = 'connections'.freeze
3
+ RESOURCE_NAME = "connections".freeze
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Sisense
2
2
  class Dashboard < API::Resource
3
- RESOURCE_NAME = 'dashboards'.freeze
3
+ RESOURCE_NAME = "dashboards".freeze
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Sisense
2
2
  class Dataset < API::Resource
3
- RESOURCE_NAME = 'datasets'.freeze
3
+ RESOURCE_NAME = "datasets".freeze
4
4
  end
5
5
  end
@@ -1,15 +1,15 @@
1
1
  module Sisense
2
2
  class Elasticube < API::Resource
3
- RESOURCE_NAME = 'elasticubes'.freeze
3
+ RESOURCE_NAME = "elasticubes".freeze
4
4
 
5
5
  def self.list
6
- path = [resource_base_path, 'getElasticubes'].join('/')
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: { server: server, elasticube_title: title })
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 = 'datasecurity'.freeze
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, 'datasecurity'].join('/')
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), 'datasecurity'].join('/')
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), 'datasecurity', id].join('/')
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
@@ -1,5 +1,5 @@
1
1
  module Sisense
2
2
  class Folder < API::Resource
3
- RESOURCE_NAME = 'folders'.freeze
3
+ RESOURCE_NAME = "folders".freeze
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  module Sisense
2
2
  class Group < API::Resource
3
- RESOURCE_NAME = 'groups'.freeze
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Sisense
2
2
  class Share < API::Resource
3
- RESOURCE_NAME = 'shares'.freeze
3
+ RESOURCE_NAME = "shares".freeze
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Sisense
2
2
  class Translation < API::Resource
3
- RESOURCE_NAME = 'translations'.freeze
3
+ RESOURCE_NAME = "translations".freeze
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  module Sisense
2
2
  class User < API::Resource
3
- RESOURCE_NAME = 'users'.freeze
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
@@ -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('_').each_with_object([]).with_index do |(string_part, string_parts), index|
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
- end.join
14
+ }.join
15
15
  end
16
16
  end
@@ -1,3 +1,3 @@
1
1
  module Sisense
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = "1.2.0".freeze
3
3
  end
@@ -1,5 +1,5 @@
1
1
  module Sisense
2
2
  class Widget < API::Resource
3
- RESOURCE_NAME = 'widgets'.freeze
3
+ RESOURCE_NAME = "widgets".freeze
4
4
  end
5
5
  end
@@ -1,29 +1,29 @@
1
- lib = File.expand_path('lib', __dir__)
1
+ lib = File.expand_path("lib", __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'sisense/version'
3
+ require "sisense/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = 'sisense'
7
- spec.version = Sisense::VERSION
8
- spec.authors = ['Olivier Buffon']
9
- spec.email = ['olivier@chronogolf.ca']
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 = 'Sisense Ruby API Client'
12
- spec.description = 'Light API client to communicate with Sisense API'
13
- spec.license = 'MIT'
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 = `git ls-files -z`.split("\x0").reject do |f|
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 = 'exe'
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ['lib']
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 'bundler'
23
- spec.add_development_dependency 'pry'
24
- spec.add_development_dependency 'rake'
25
- spec.add_development_dependency 'rspec'
26
- spec.add_development_dependency 'rubocop'
27
- spec.add_development_dependency 'vcr'
28
- spec.add_development_dependency 'webmock'
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.0.0
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: 2018-10-04 00:00:00.000000000 Z
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: rubocop
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
- - olivier@chronogolf.ca
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
- - ".rubocop.yml"
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
- rubyforge_project:
171
- rubygems_version: 2.7.6
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: []
@@ -1,9 +0,0 @@
1
- Metrics/LineLength:
2
- Max: 120
3
-
4
- Metrics/BlockLength:
5
- Exclude:
6
- - 'spec/**/*'
7
-
8
- Style/Documentation:
9
- Enabled: false
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.0
5
- before_install: gem install bundler -v 1.16.1