osso 0.0.10 → 0.0.11
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 +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +17 -13
- data/lib/osso.rb +1 -0
- data/lib/osso/graphql/mutations/configure_identity_provider.rb +4 -1
- data/lib/osso/graphql/mutations/create_enterprise_account.rb +4 -1
- data/lib/osso/graphql/mutations/create_identity_provider.rb +6 -1
- data/lib/osso/graphql/mutations/create_oauth_client.rb +4 -1
- data/lib/osso/graphql/mutations/delete_enterprise_account.rb +5 -1
- data/lib/osso/graphql/mutations/delete_identity_provider.rb +4 -1
- data/lib/osso/graphql/mutations/delete_oauth_client.rb +4 -1
- data/lib/osso/graphql/mutations/invite_admin_user.rb +6 -0
- data/lib/osso/graphql/mutations/regenerate_oauth_credentials.rb +4 -1
- data/lib/osso/graphql/mutations/set_redirect_uris.rb +2 -0
- data/lib/osso/graphql/mutations/update_app_config.rb +4 -1
- data/lib/osso/lib/analytics.rb +55 -0
- data/lib/osso/routes/admin.rb +4 -0
- data/lib/osso/version.rb +1 -1
- data/osso-rb.gemspec +2 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3def53429479fcc6f8174b8065830233e8437b3e6cd5e6a2647caa710622028
|
4
|
+
data.tar.gz: dbdaa671b3a6b2ca07e5d48ed247eefbdbe6bd06423247975821088aea097f45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0391fb57427e5f417ee19f2566cda5e432834bff640d14516abdf54a716c401c6ed42559ed5f366855936e2f6d976f86e1c64c1bfd497f9b3443f8a54f240485'
|
7
|
+
data.tar.gz: 1bdc64d6943502b18f7801003131d379879bad62265bc80f4f5cd5c9547604d7fb60b35a174ce9875a1d5b13ef673535bed4566d14d5888de1552b40a9c0d26b
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
osso (0.0.
|
4
|
+
osso (0.0.11)
|
5
5
|
activesupport (>= 6.0.3.2)
|
6
6
|
bcrypt (~> 3.1.13)
|
7
7
|
graphql
|
@@ -9,12 +9,13 @@ PATH
|
|
9
9
|
mail (~> 2.7.1)
|
10
10
|
omniauth-multi-provider
|
11
11
|
omniauth-saml
|
12
|
+
posthog-ruby
|
12
13
|
rack (>= 2.1.4)
|
13
14
|
rack-contrib
|
14
15
|
rack-oauth2
|
15
16
|
rake
|
16
17
|
rodauth (>= 2.6, < 2.8)
|
17
|
-
sequel (>= 5.37, < 5.
|
18
|
+
sequel (>= 5.37, < 5.41)
|
18
19
|
sequel-activerecord_connection (>= 0.3, < 2.0)
|
19
20
|
sinatra
|
20
21
|
sinatra-activerecord
|
@@ -54,7 +55,7 @@ GEM
|
|
54
55
|
activerecord
|
55
56
|
database_cleaner (~> 1.8.0)
|
56
57
|
diff-lcs (1.4.4)
|
57
|
-
docile (1.3.
|
58
|
+
docile (1.3.4)
|
58
59
|
factory_bot (6.1.0)
|
59
60
|
activesupport (>= 5.0.0)
|
60
61
|
faker (2.15.1)
|
@@ -65,8 +66,7 @@ GEM
|
|
65
66
|
httpclient (2.8.3)
|
66
67
|
i18n (1.8.5)
|
67
68
|
concurrent-ruby (~> 1.0)
|
68
|
-
json (
|
69
|
-
json-jwt (1.12.0)
|
69
|
+
json-jwt (1.13.0)
|
70
70
|
activesupport (>= 4.2)
|
71
71
|
aes_key_wrap
|
72
72
|
bindata
|
@@ -75,13 +75,14 @@ GEM
|
|
75
75
|
mini_mime (>= 0.1.1)
|
76
76
|
method_source (1.0.0)
|
77
77
|
mini_mime (1.0.2)
|
78
|
-
mini_portile2 (2.
|
78
|
+
mini_portile2 (2.5.0)
|
79
79
|
minitest (5.14.2)
|
80
80
|
multi_json (1.15.0)
|
81
81
|
mustermann (1.1.1)
|
82
82
|
ruby2_keywords (~> 0.0.1)
|
83
|
-
nokogiri (1.
|
84
|
-
mini_portile2 (~> 2.
|
83
|
+
nokogiri (1.11.1)
|
84
|
+
mini_portile2 (~> 2.5.0)
|
85
|
+
racc (~> 1.4)
|
85
86
|
omniauth (1.9.1)
|
86
87
|
hashie (>= 3.4.6)
|
87
88
|
rack (>= 1.6.2, < 3)
|
@@ -94,10 +95,12 @@ GEM
|
|
94
95
|
parser (3.0.0.0)
|
95
96
|
ast (~> 2.4.1)
|
96
97
|
pg (1.2.3)
|
98
|
+
posthog-ruby (1.1.0)
|
97
99
|
pry (0.13.1)
|
98
100
|
coderay (~> 1.1)
|
99
101
|
method_source (~> 1.0)
|
100
102
|
public_suffix (4.0.6)
|
103
|
+
racc (1.5.2)
|
101
104
|
rack (2.2.3)
|
102
105
|
rack-contrib (2.3.0)
|
103
106
|
rack (~> 2.0)
|
@@ -153,11 +156,12 @@ GEM
|
|
153
156
|
activerecord (>= 4.2, < 7)
|
154
157
|
after_commit_everywhere (~> 0.1.5)
|
155
158
|
sequel (~> 5.16)
|
156
|
-
simplecov (0.
|
159
|
+
simplecov (0.21.1)
|
157
160
|
docile (~> 1.1)
|
158
|
-
|
159
|
-
|
160
|
-
simplecov-html (0.
|
161
|
+
simplecov-html (~> 0.11)
|
162
|
+
simplecov_json_formatter (~> 0.1)
|
163
|
+
simplecov-html (0.12.3)
|
164
|
+
simplecov_json_formatter (0.1.2)
|
161
165
|
sinatra (2.1.0)
|
162
166
|
mustermann (~> 1.0)
|
163
167
|
rack (~> 2.2)
|
@@ -197,7 +201,7 @@ DEPENDENCIES
|
|
197
201
|
rack-test
|
198
202
|
rspec (~> 3.10)
|
199
203
|
rubocop
|
200
|
-
simplecov (= 0.
|
204
|
+
simplecov (= 0.21.1)
|
201
205
|
webmock (~> 3.11)
|
202
206
|
|
203
207
|
BUNDLED WITH
|
data/lib/osso.rb
CHANGED
@@ -15,7 +15,10 @@ module Osso
|
|
15
15
|
def resolve(**args)
|
16
16
|
provider = identity_provider(**args)
|
17
17
|
|
18
|
-
|
18
|
+
if provider.update(args)
|
19
|
+
Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: args)
|
20
|
+
return response_data(identity_provider: provider)
|
21
|
+
end
|
19
22
|
|
20
23
|
response_error(provider.errors)
|
21
24
|
end
|
@@ -15,7 +15,10 @@ module Osso
|
|
15
15
|
def resolve(**args)
|
16
16
|
enterprise_account = Osso::Models::EnterpriseAccount.new(args)
|
17
17
|
|
18
|
-
|
18
|
+
if enterprise_account.save
|
19
|
+
Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: args)
|
20
|
+
return response_data(enterprise_account: enterprise_account)
|
21
|
+
end
|
19
22
|
|
20
23
|
response_error(enterprise_account.errors)
|
21
24
|
end
|
@@ -22,7 +22,12 @@ module Osso
|
|
22
22
|
oauth_client_id: oauth_client_id,
|
23
23
|
)
|
24
24
|
|
25
|
-
|
25
|
+
if identity_provider.save
|
26
|
+
Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: {
|
27
|
+
service: service, enterprise_account_id: enterprise_account_id, oauth_client_id: oauth_client_id
|
28
|
+
})
|
29
|
+
return response_data(identity_provider: identity_provider)
|
30
|
+
end
|
26
31
|
|
27
32
|
response_error(identity_provider.errors)
|
28
33
|
end
|
@@ -14,7 +14,10 @@ module Osso
|
|
14
14
|
def resolve(**args)
|
15
15
|
oauth_client = Osso::Models::OauthClient.new(args)
|
16
16
|
|
17
|
-
|
17
|
+
if oauth_client.save
|
18
|
+
Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: args)
|
19
|
+
return response_data(oauth_client: oauth_client)
|
20
|
+
end
|
18
21
|
|
19
22
|
response_error(oauth_client.errors)
|
20
23
|
end
|
@@ -18,7 +18,11 @@ module Osso
|
|
18
18
|
def resolve(**args)
|
19
19
|
customer = enterprise_account(**args)
|
20
20
|
|
21
|
-
|
21
|
+
if customer.destroy
|
22
|
+
Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: args)
|
23
|
+
return response_data(enterprise_account: nil)
|
24
|
+
end
|
25
|
+
|
22
26
|
|
23
27
|
response_error(customer.errors)
|
24
28
|
end
|
@@ -14,7 +14,10 @@ module Osso
|
|
14
14
|
def resolve(id:)
|
15
15
|
identity_provider = Osso::Models::IdentityProvider.find(id)
|
16
16
|
|
17
|
-
|
17
|
+
if identity_provider.destroy
|
18
|
+
Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: { id: id })
|
19
|
+
return response_data(identity_provider: nil)
|
20
|
+
end
|
18
21
|
|
19
22
|
response_error(identity_provider.errors)
|
20
23
|
end
|
@@ -14,7 +14,10 @@ module Osso
|
|
14
14
|
def resolve(id:)
|
15
15
|
oauth_client = Osso::Models::OauthClient.find(id)
|
16
16
|
|
17
|
-
|
17
|
+
if oauth_client.destroy
|
18
|
+
Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: { id: id })
|
19
|
+
return response_data(oauth_client: nil)
|
20
|
+
end
|
18
21
|
|
19
22
|
response_error(oauth_client.errors)
|
20
23
|
end
|
@@ -23,6 +23,12 @@ module Osso
|
|
23
23
|
if admin_user.save
|
24
24
|
verify_user(email)
|
25
25
|
|
26
|
+
Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: {
|
27
|
+
invited_email: email,
|
28
|
+
invited_role: role,
|
29
|
+
invited_oauth_client_id: oauth_client_id,
|
30
|
+
})
|
31
|
+
|
26
32
|
return response_data(admin_user: admin_user)
|
27
33
|
end
|
28
34
|
|
@@ -15,7 +15,10 @@ module Osso
|
|
15
15
|
oauth_client = Osso::Models::OauthClient.find(id)
|
16
16
|
oauth_client.regenerate_secrets!
|
17
17
|
|
18
|
-
|
18
|
+
if oauth_client.save
|
19
|
+
Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: { oauth_client_id: id })
|
20
|
+
return response_data(oauth_client: oauth_client)
|
21
|
+
end
|
19
22
|
|
20
23
|
response_error(oauth_client.errors)
|
21
24
|
end
|
@@ -18,6 +18,8 @@ module Osso
|
|
18
18
|
update_existing(oauth_client, redirect_uris)
|
19
19
|
create_new(oauth_client, redirect_uris)
|
20
20
|
|
21
|
+
Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: redirect_uris)
|
22
|
+
|
21
23
|
response_data(oauth_client: oauth_client.reload)
|
22
24
|
rescue StandardError => e
|
23
25
|
response_error(e)
|
@@ -15,7 +15,10 @@ module Osso
|
|
15
15
|
|
16
16
|
def resolve(**args)
|
17
17
|
app_config = Osso::Models::AppConfig.find
|
18
|
-
|
18
|
+
if app_config.update(**args)
|
19
|
+
Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: args)
|
20
|
+
return response_data(app_config: app_config)
|
21
|
+
end
|
19
22
|
|
20
23
|
response_error(app_config.errors)
|
21
24
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'posthog-ruby'
|
4
|
+
|
5
|
+
module Osso
|
6
|
+
# Osso::Analytics provides an interface to track product analytics for any provider.
|
7
|
+
# Osso recommends PostHog as an open source solution for your product analytics needs.
|
8
|
+
# If you want to use another product analytics provider, you can patch the Osso::Analytics
|
9
|
+
# class yourself in your parent application. Be sure to implement the public
|
10
|
+
# .identify and .capture class methods with the required method signatures and require
|
11
|
+
# your class after requiring Osso.
|
12
|
+
class Analytics
|
13
|
+
class << self
|
14
|
+
def identify(email:, properties: {})
|
15
|
+
return unless configured?
|
16
|
+
|
17
|
+
client.identify({
|
18
|
+
distinct_id: email,
|
19
|
+
properties: properties.merge(instance_properties),
|
20
|
+
})
|
21
|
+
end
|
22
|
+
|
23
|
+
def capture(email:, event:, properties: {})
|
24
|
+
return unless configured?
|
25
|
+
|
26
|
+
client.capture(
|
27
|
+
distinct_id: email,
|
28
|
+
event: event,
|
29
|
+
properties: properties.merge(instance_properties),
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def configured?
|
36
|
+
ENV['POSTHOG_API_KEY'].present?
|
37
|
+
end
|
38
|
+
|
39
|
+
def client
|
40
|
+
@client ||= PostHog::Client.new({
|
41
|
+
api_key: ENV['POSTHOG_API_KEY'],
|
42
|
+
api_host: ENV['POSTHOG_HOST'],
|
43
|
+
on_error: Proc.new { |status, msg| print msg }
|
44
|
+
})
|
45
|
+
end
|
46
|
+
|
47
|
+
def instance_properties
|
48
|
+
{
|
49
|
+
instance_url: ENV['BASE_URL'],
|
50
|
+
osso_plan: ENV['OSSO_PLAN'],
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/osso/routes/admin.rb
CHANGED
data/lib/osso/version.rb
CHANGED
data/osso-rb.gemspec
CHANGED
@@ -22,12 +22,13 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_runtime_dependency 'mail', '~> 2.7.1'
|
23
23
|
spec.add_runtime_dependency 'omniauth-multi-provider'
|
24
24
|
spec.add_runtime_dependency 'omniauth-saml'
|
25
|
+
spec.add_runtime_dependency 'posthog-ruby'
|
25
26
|
spec.add_runtime_dependency 'rack', '>= 2.1.4'
|
26
27
|
spec.add_runtime_dependency 'rack-contrib'
|
27
28
|
spec.add_runtime_dependency 'rack-oauth2'
|
28
29
|
spec.add_runtime_dependency 'rake'
|
29
30
|
spec.add_runtime_dependency 'rodauth', '>= 2.6', '< 2.8'
|
30
|
-
spec.add_runtime_dependency 'sequel', '>= 5.37', '< 5.
|
31
|
+
spec.add_runtime_dependency 'sequel', '>= 5.37', '< 5.41'
|
31
32
|
spec.add_runtime_dependency 'sequel-activerecord_connection', '>= 0.3', '< 2.0'
|
32
33
|
spec.add_runtime_dependency 'sinatra'
|
33
34
|
spec.add_runtime_dependency 'sinatra-activerecord'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Bauch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: posthog-ruby
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rack
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -193,7 +207,7 @@ dependencies:
|
|
193
207
|
version: '5.37'
|
194
208
|
- - "<"
|
195
209
|
- !ruby/object:Gem::Version
|
196
|
-
version: '5.
|
210
|
+
version: '5.41'
|
197
211
|
type: :runtime
|
198
212
|
prerelease: false
|
199
213
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -203,7 +217,7 @@ dependencies:
|
|
203
217
|
version: '5.37'
|
204
218
|
- - "<"
|
205
219
|
- !ruby/object:Gem::Version
|
206
|
-
version: '5.
|
220
|
+
version: '5.41'
|
207
221
|
- !ruby/object:Gem::Dependency
|
208
222
|
name: sequel-activerecord_connection
|
209
223
|
requirement: !ruby/object:Gem::Requirement
|
@@ -413,6 +427,7 @@ files:
|
|
413
427
|
- lib/osso/graphql/types/oauth_client.rb
|
414
428
|
- lib/osso/graphql/types/redirect_uri.rb
|
415
429
|
- lib/osso/graphql/types/redirect_uri_input.rb
|
430
|
+
- lib/osso/lib/analytics.rb
|
416
431
|
- lib/osso/lib/app_config.rb
|
417
432
|
- lib/osso/lib/oauth2_token.rb
|
418
433
|
- lib/osso/lib/route_map.rb
|