onvo 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onvo/automations.rb +2 -2
- data/lib/onvo/dashboard/datasources.rb +1 -1
- data/lib/onvo/dashboard.rb +0 -6
- data/lib/onvo/dashboards.rb +2 -2
- data/lib/onvo/datasources.rb +2 -2
- data/lib/onvo/embed_users.rb +2 -10
- data/lib/onvo/questions.rb +19 -0
- data/lib/onvo/sessions.rb +22 -0
- data/lib/onvo/widgets.rb +30 -0
- data/lib/onvo.rb +8 -2
- data/lib/resource.rb +15 -10
- metadata +5 -20
- data/lib/onvo/dashboard/questions.rb +0 -17
- data/lib/onvo/dashboard/sessions.rb +0 -24
- data/lib/onvo/dashboard/widgets.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f68b68906f415004096ec475af32a63191275e289a253e0f1f271dc76c8386f1
|
4
|
+
data.tar.gz: 1f5924af7a1e67a41f4e2e086b402174d149a502d40db34539236df31389e7ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f90ad508dc19bd6f35da7b17dccbebe619b453339baf361d1e61a4228241008e1787c88c798c0d89f91838c760df3f83d31cf200a752ca71c7ee826e3de5de8
|
7
|
+
data.tar.gz: 0a02aabe44d284b69c3709d8d52d90528fe3aec8a41e9ce3ada8e562f463f69cb7fb1db09c84694b5288f45cccbe0561cd41eff3d44ee45e5e3bdcbe653c3b0d
|
data/lib/onvo/automations.rb
CHANGED
@@ -17,10 +17,10 @@ class Automations < Resource
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def update(id, body)
|
20
|
-
base_post("/automations/#{id}", body)
|
20
|
+
base_post("/automations/#{id}", body: body)
|
21
21
|
end
|
22
22
|
|
23
23
|
def create(body)
|
24
|
-
base_put('/automations', body)
|
24
|
+
base_put('/automations', body: body)
|
25
25
|
end
|
26
26
|
end
|
@@ -10,7 +10,7 @@ class DashboardDatasources < DashboardResource
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def link(datasource_id)
|
13
|
-
base_put("/dashboards/#{@dashboard_id}/datasources",
|
13
|
+
base_put("/dashboards/#{@dashboard_id}/datasources", body: { datasourceId: datasource_id })
|
14
14
|
end
|
15
15
|
|
16
16
|
def unlink(datasource_id)
|
data/lib/onvo/dashboard.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative './dashboard/datasources'
|
4
|
-
require_relative './dashboard/widgets'
|
5
|
-
require_relative './dashboard/questions'
|
6
|
-
require_relative './dashboard/sessions'
|
7
4
|
|
8
5
|
# The Dashboard API
|
9
6
|
class Dashboard
|
@@ -13,8 +10,5 @@ class Dashboard
|
|
13
10
|
params = [dashboard_id, endpoint, api_key]
|
14
11
|
|
15
12
|
@datasources = DashboardDatasources.new(*params)
|
16
|
-
@widgets = DashboardWidgets.new(*params)
|
17
|
-
@questions = DashboardQuestions.new(*params)
|
18
|
-
@sessions = DashboardSessions.new(*params)
|
19
13
|
end
|
20
14
|
end
|
data/lib/onvo/dashboards.rb
CHANGED
@@ -17,10 +17,10 @@ class Dashboards < Resource
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def update(id, body)
|
20
|
-
base_post("/dashboards/#{id}", body)
|
20
|
+
base_post("/dashboards/#{id}", body: body)
|
21
21
|
end
|
22
22
|
|
23
23
|
def create(body)
|
24
|
-
base_put('/dashboards', body)
|
24
|
+
base_put('/dashboards', body: body)
|
25
25
|
end
|
26
26
|
end
|
data/lib/onvo/datasources.rb
CHANGED
@@ -25,10 +25,10 @@ class Datasources < Resource
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def update(id, body)
|
28
|
-
base_post("/datasources/#{id}", body)
|
28
|
+
base_post("/datasources/#{id}", body: body)
|
29
29
|
end
|
30
30
|
|
31
31
|
def create(body)
|
32
|
-
base_put('/datasources', body)
|
32
|
+
base_put('/datasources', body: body)
|
33
33
|
end
|
34
34
|
end
|
data/lib/onvo/embed_users.rb
CHANGED
@@ -16,16 +16,8 @@ class EmbedUsers < Resource
|
|
16
16
|
base_delete("/embed-users/#{id}")
|
17
17
|
end
|
18
18
|
|
19
|
-
def upsert(
|
20
|
-
base_post(
|
21
|
-
'/embed-users',
|
22
|
-
{
|
23
|
-
'id': id,
|
24
|
-
'name': name,
|
25
|
-
'email': email,
|
26
|
-
'metadata': metadata
|
27
|
-
}
|
28
|
-
)
|
19
|
+
def upsert(body)
|
20
|
+
base_post('/embed-users', body: body)
|
29
21
|
end
|
30
22
|
|
31
23
|
def get_access_token(id)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'uri'
|
4
|
+
require_relative '../resource'
|
5
|
+
|
6
|
+
# Dashboard Question endpoints
|
7
|
+
class Questions < Resource
|
8
|
+
def list(dashboard_id)
|
9
|
+
base_get('/questions', query: { dashboard: dashboard_id })
|
10
|
+
end
|
11
|
+
|
12
|
+
def create(dashboard_id, query)
|
13
|
+
base_put('/questions', query: { query: query }, body: { dashboard: dashboard_id })
|
14
|
+
end
|
15
|
+
|
16
|
+
def delete(id)
|
17
|
+
base_delete("/questions/#{id}")
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../resource'
|
4
|
+
|
5
|
+
# Dashboard session endpoints
|
6
|
+
class Sessions < Resource
|
7
|
+
def list(dashboard_id)
|
8
|
+
base_get('/sessions', query: { dashboard: dashboard_id })
|
9
|
+
end
|
10
|
+
|
11
|
+
def delete(dashboard_id)
|
12
|
+
base_delete('/sessions', query: { dashboard: dashboard_id })
|
13
|
+
end
|
14
|
+
|
15
|
+
def upsert(dashboard_id, user_id)
|
16
|
+
session_data = base_post(
|
17
|
+
'/sessions',
|
18
|
+
body: { dashboard: dashboard_id, user: user_id }
|
19
|
+
)
|
20
|
+
session_data.merge({ 'url': "#{@endpoint}#{session_data['url']}" })
|
21
|
+
end
|
22
|
+
end
|
data/lib/onvo/widgets.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../resource'
|
4
|
+
|
5
|
+
# Dashboard Widget endpoints
|
6
|
+
class Widgets < Resource
|
7
|
+
def list(dashboard_id)
|
8
|
+
base_get('/widgets', query: { dashboard: dashboard_id })
|
9
|
+
end
|
10
|
+
|
11
|
+
def get(widget_id)
|
12
|
+
base_get("/widgets/#{widget_id}")
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_image(widget_id)
|
16
|
+
base_get("/widgets/#{widget_id}/image")
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete(widget_id)
|
20
|
+
base_delete("/widgets/#{widget_id}")
|
21
|
+
end
|
22
|
+
|
23
|
+
def update(widget_id, body)
|
24
|
+
base_post("/widgets/#{widget_id}", body: body)
|
25
|
+
end
|
26
|
+
|
27
|
+
def create(dashboard_id, query)
|
28
|
+
base_put('/widgets', query: { query: query }, body: { dashboard: dashboard_id })
|
29
|
+
end
|
30
|
+
end
|
data/lib/onvo.rb
CHANGED
@@ -6,12 +6,15 @@ require_relative './onvo/embed_users'
|
|
6
6
|
require_relative './onvo/datasources'
|
7
7
|
require_relative './onvo/automations'
|
8
8
|
require_relative './onvo/dashboards'
|
9
|
+
require_relative './onvo/questions'
|
10
|
+
require_relative './onvo/sessions'
|
11
|
+
require_relative './onvo/widgets'
|
9
12
|
|
10
13
|
require_relative './onvo/dashboard'
|
11
14
|
|
12
15
|
# The Onvo Ruby SDK
|
13
16
|
class Onvo
|
14
|
-
attr_reader :accounts, :teams, :embed_users, :datasources, :automations, :dashboards
|
17
|
+
attr_reader :accounts, :teams, :embed_users, :datasources, :automations, :dashboards, :questions, :sessions, :widgets
|
15
18
|
attr_accessor :endpoint, :api_key
|
16
19
|
|
17
20
|
def initialize(endpoint = ENV['ONVO_API_ENDPOINT'], api_key = ENV['ONVO_API_KEY'])
|
@@ -23,8 +26,11 @@ class Onvo
|
|
23
26
|
@teams = Teams.new(*params)
|
24
27
|
@embed_users = EmbedUsers.new(*params)
|
25
28
|
@datasources = Datasources.new(*params)
|
26
|
-
@automations = Automations.new(*params)
|
27
29
|
@dashboards = Dashboards.new(*params)
|
30
|
+
@automations = Automations.new(*params)
|
31
|
+
@questions = Questions.new(*params)
|
32
|
+
@sessions = Sessions.new(*params)
|
33
|
+
@widgets = Widgets.new(*params)
|
28
34
|
end
|
29
35
|
|
30
36
|
def dashboard(dashboard_id)
|
data/lib/resource.rb
CHANGED
@@ -31,21 +31,26 @@ class Resource
|
|
31
31
|
response.body
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
35
|
-
|
34
|
+
def merge_options(extra_options)
|
35
|
+
filtered_extras = {}
|
36
|
+
filtered_extras[:query] = extra_options[:query] if extra_options.key? :query
|
37
|
+
filtered_extras[:body] = extra_options[:body].to_json if extra_options.key? :body
|
38
|
+
options.merge(filtered_extras)
|
36
39
|
end
|
37
40
|
|
38
|
-
def
|
39
|
-
|
40
|
-
base_request { self.class.put(subdirectory, params) }
|
41
|
+
def base_get(subdirectory, **extra_options)
|
42
|
+
base_request { self.class.get(subdirectory, **merge_options(extra_options)) }
|
41
43
|
end
|
42
44
|
|
43
|
-
def
|
44
|
-
|
45
|
-
base_request { self.class.post(subdirectory, params) }
|
45
|
+
def base_put(subdirectory, **extra_options)
|
46
|
+
base_request { self.class.put(subdirectory, **merge_options(extra_options)) }
|
46
47
|
end
|
47
48
|
|
48
|
-
def
|
49
|
-
base_request { self.class.
|
49
|
+
def base_post(subdirectory, **extra_options)
|
50
|
+
base_request { self.class.post(subdirectory, **merge_options(extra_options)) }
|
51
|
+
end
|
52
|
+
|
53
|
+
def base_delete(subdirectory, **extra_options)
|
54
|
+
base_request { self.class.delete(subdirectory, **merge_options(extra_options)) }
|
50
55
|
end
|
51
56
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onvo
|
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
|
- Bryan Davis
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-02-
|
12
|
+
date: 2024-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -25,20 +25,6 @@ dependencies:
|
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 0.13.7
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: json
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - "~>"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 2.6.1
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - "~>"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: 2.6.1
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: minitest-hooks
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,13 +67,13 @@ files:
|
|
81
67
|
- lib/onvo/dashboard.rb
|
82
68
|
- lib/onvo/dashboard/dashboard_resource.rb
|
83
69
|
- lib/onvo/dashboard/datasources.rb
|
84
|
-
- lib/onvo/dashboard/questions.rb
|
85
|
-
- lib/onvo/dashboard/sessions.rb
|
86
|
-
- lib/onvo/dashboard/widgets.rb
|
87
70
|
- lib/onvo/dashboards.rb
|
88
71
|
- lib/onvo/datasources.rb
|
89
72
|
- lib/onvo/embed_users.rb
|
73
|
+
- lib/onvo/questions.rb
|
74
|
+
- lib/onvo/sessions.rb
|
90
75
|
- lib/onvo/teams.rb
|
76
|
+
- lib/onvo/widgets.rb
|
91
77
|
- lib/resource.rb
|
92
78
|
homepage:
|
93
79
|
licenses: []
|
@@ -96,7 +82,6 @@ post_install_message:
|
|
96
82
|
rdoc_options: []
|
97
83
|
require_paths:
|
98
84
|
- lib
|
99
|
-
- lib/onvo
|
100
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
101
86
|
requirements:
|
102
87
|
- - ">="
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'uri'
|
4
|
-
require_relative './dashboard_resource'
|
5
|
-
|
6
|
-
# Dashboard Question endpoints
|
7
|
-
class DashboardQuestions < DashboardResource
|
8
|
-
def list
|
9
|
-
base_get("/dashboards/#{@dashboard_id}/questions")
|
10
|
-
end
|
11
|
-
|
12
|
-
# TODO: ask?
|
13
|
-
def create(query)
|
14
|
-
processed_query = URI.encode_www_form_component(query)
|
15
|
-
base_put("/dashboards/#{@dashboard_id}/questions?query=#{processed_query}")
|
16
|
-
end
|
17
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative './dashboard_resource'
|
4
|
-
|
5
|
-
# Dashboard session endpoints
|
6
|
-
class DashboardSessions < DashboardResource
|
7
|
-
def list
|
8
|
-
base_get("/dashboards/#{@dashboard_id}/sessions")
|
9
|
-
end
|
10
|
-
|
11
|
-
# TODO: check if rename to delete_all
|
12
|
-
def delete
|
13
|
-
base_delete("/dashboards/#{@dashboard_id}/sessions")
|
14
|
-
end
|
15
|
-
|
16
|
-
def upsert(user_id, parameters = {})
|
17
|
-
session_data = base_post(
|
18
|
-
"/dashboards/#{@dashboard_id}/sessions",
|
19
|
-
user: user_id,
|
20
|
-
parameters: parameters
|
21
|
-
)
|
22
|
-
session_data.merge({ 'url': "#{@endpoint}#{session_data['url']}" })
|
23
|
-
end
|
24
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'uri'
|
4
|
-
require_relative './dashboard_resource'
|
5
|
-
|
6
|
-
# Dashboard Widget endpoints
|
7
|
-
class DashboardWidgets < DashboardResource
|
8
|
-
def list
|
9
|
-
base_get("/dashboards/#{@dashboard_id}/widgets")
|
10
|
-
end
|
11
|
-
|
12
|
-
def get(widget_id)
|
13
|
-
base_get("/dashboards/#{@dashboard_id}/widgets/#{widget_id}")
|
14
|
-
end
|
15
|
-
|
16
|
-
def delete(widget_id)
|
17
|
-
base_delete("/dashboards/#{@dashboard_id}/widgets/#{widget_id}")
|
18
|
-
end
|
19
|
-
|
20
|
-
def update(widget_id, body)
|
21
|
-
base_post("/dashboards/#{@dashboard_id}/widgets/#{widget_id}", body)
|
22
|
-
end
|
23
|
-
|
24
|
-
def create(query)
|
25
|
-
processed_query = URI.encode_www_form_component(query)
|
26
|
-
base_put("/dashboards/#{@dashboard_id}/widgets?query=#{processed_query}")
|
27
|
-
end
|
28
|
-
end
|