userlist-rails 0.2.2 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/test.yml +22 -0
- data/.rubocop.yml +5 -6
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile +1 -1
- data/README.md +201 -23
- data/lib/userlist/rails.rb +98 -1
- data/lib/userlist/rails/config.rb +16 -5
- data/lib/userlist/rails/extensions/company.rb +30 -0
- data/lib/userlist/rails/extensions/event.rb +20 -0
- data/lib/userlist/rails/extensions/relationship.rb +30 -0
- data/lib/userlist/rails/extensions/user.rb +30 -0
- data/lib/userlist/rails/helpers.rb +31 -0
- data/lib/userlist/rails/railtie.rb +34 -9
- data/lib/{tasks → userlist/rails/tasks}/userlist.rake +5 -5
- data/lib/userlist/rails/transform.rb +42 -0
- data/lib/userlist/rails/transforms/company.rb +41 -0
- data/lib/userlist/rails/transforms/relationship.rb +33 -0
- data/lib/userlist/rails/transforms/user.rb +41 -0
- data/lib/userlist/rails/version.rb +1 -1
- data/userlist-rails.gemspec +13 -9
- metadata +73 -40
- data/.travis.yml +0 -7
- data/lib/userlist/rails/company.rb +0 -39
- data/lib/userlist/rails/push.rb +0 -41
- data/lib/userlist/rails/user.rb +0 -45
data/userlist-rails.gemspec
CHANGED
@@ -7,9 +7,9 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = 'userlist-rails'
|
8
8
|
spec.version = Userlist::Rails::VERSION
|
9
9
|
spec.authors = ['Benedikt Deicke']
|
10
|
-
spec.email = ['benedikt@userlist.
|
10
|
+
spec.email = ['benedikt@userlist.com']
|
11
11
|
spec.homepage = 'https://github.com/userlistio/userlist-rails'
|
12
|
-
spec.summary = 'Rails integration for Userlist
|
12
|
+
spec.summary = 'Rails integration for Userlist'
|
13
13
|
spec.license = 'MIT'
|
14
14
|
|
15
15
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
@@ -19,13 +19,17 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.
|
23
|
-
spec.add_dependency 'railties', '>= 3.0'
|
24
|
-
spec.add_dependency 'userlist', '~> 0.2', '>= 0.2.2'
|
22
|
+
spec.required_ruby_version = '>= 2.4'
|
25
23
|
|
26
|
-
spec.
|
27
|
-
spec.
|
24
|
+
spec.add_dependency 'activesupport', '>= 5.0'
|
25
|
+
spec.add_dependency 'railties', '>= 5.0'
|
26
|
+
spec.add_dependency 'userlist', '~> 0.5'
|
27
|
+
|
28
|
+
spec.add_development_dependency 'actionpack', '>= 5.0'
|
29
|
+
spec.add_development_dependency 'activerecord', '>= 5.0'
|
30
|
+
spec.add_development_dependency 'bundler', '>= 1.15'
|
31
|
+
spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
|
28
32
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
|
-
spec.add_development_dependency '
|
30
|
-
spec.add_development_dependency '
|
33
|
+
spec.add_development_dependency 'rspec-rails', '~> 3.0'
|
34
|
+
spec.add_development_dependency 'sqlite3', '>= 1.4'
|
31
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: userlist-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benedikt Deicke
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,60 +16,82 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: railties
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '5.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: userlist
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 0.2.2
|
47
|
+
version: '0.5'
|
51
48
|
type: :runtime
|
52
49
|
prerelease: false
|
53
50
|
version_requirements: !ruby/object:Gem::Requirement
|
54
51
|
requirements:
|
55
52
|
- - "~>"
|
56
53
|
- !ruby/object:Gem::Version
|
57
|
-
version: '0.
|
54
|
+
version: '0.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: actionpack
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
58
66
|
- - ">="
|
59
67
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0
|
68
|
+
version: '5.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activerecord
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.0'
|
61
83
|
- !ruby/object:Gem::Dependency
|
62
84
|
name: bundler
|
63
85
|
requirement: !ruby/object:Gem::Requirement
|
64
86
|
requirements:
|
65
|
-
- - "
|
87
|
+
- - ">="
|
66
88
|
- !ruby/object:Gem::Version
|
67
89
|
version: '1.15'
|
68
90
|
type: :development
|
69
91
|
prerelease: false
|
70
92
|
version_requirements: !ruby/object:Gem::Requirement
|
71
93
|
requirements:
|
72
|
-
- - "
|
94
|
+
- - ">="
|
73
95
|
- !ruby/object:Gem::Version
|
74
96
|
version: '1.15'
|
75
97
|
- !ruby/object:Gem::Dependency
|
@@ -78,14 +100,20 @@ dependencies:
|
|
78
100
|
requirements:
|
79
101
|
- - "~>"
|
80
102
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
103
|
+
version: '12.3'
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 12.3.3
|
82
107
|
type: :development
|
83
108
|
prerelease: false
|
84
109
|
version_requirements: !ruby/object:Gem::Requirement
|
85
110
|
requirements:
|
86
111
|
- - "~>"
|
87
112
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
113
|
+
version: '12.3'
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 12.3.3
|
89
117
|
- !ruby/object:Gem::Dependency
|
90
118
|
name: rspec
|
91
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,44 +129,44 @@ dependencies:
|
|
101
129
|
- !ruby/object:Gem::Version
|
102
130
|
version: '3.0'
|
103
131
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
132
|
+
name: rspec-rails
|
105
133
|
requirement: !ruby/object:Gem::Requirement
|
106
134
|
requirements:
|
107
|
-
- - "
|
135
|
+
- - "~>"
|
108
136
|
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
137
|
+
version: '3.0'
|
110
138
|
type: :development
|
111
139
|
prerelease: false
|
112
140
|
version_requirements: !ruby/object:Gem::Requirement
|
113
141
|
requirements:
|
114
|
-
- - "
|
142
|
+
- - "~>"
|
115
143
|
- !ruby/object:Gem::Version
|
116
|
-
version: '0'
|
144
|
+
version: '3.0'
|
117
145
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
146
|
+
name: sqlite3
|
119
147
|
requirement: !ruby/object:Gem::Requirement
|
120
148
|
requirements:
|
121
|
-
- - "
|
149
|
+
- - ">="
|
122
150
|
- !ruby/object:Gem::Version
|
123
|
-
version: '1.
|
151
|
+
version: '1.4'
|
124
152
|
type: :development
|
125
153
|
prerelease: false
|
126
154
|
version_requirements: !ruby/object:Gem::Requirement
|
127
155
|
requirements:
|
128
|
-
- - "
|
156
|
+
- - ">="
|
129
157
|
- !ruby/object:Gem::Version
|
130
|
-
version: '1.
|
131
|
-
description:
|
158
|
+
version: '1.4'
|
159
|
+
description:
|
132
160
|
email:
|
133
|
-
- benedikt@userlist.
|
161
|
+
- benedikt@userlist.com
|
134
162
|
executables: []
|
135
163
|
extensions: []
|
136
164
|
extra_rdoc_files: []
|
137
165
|
files:
|
166
|
+
- ".github/workflows/test.yml"
|
138
167
|
- ".gitignore"
|
139
168
|
- ".rspec"
|
140
169
|
- ".rubocop.yml"
|
141
|
-
- ".travis.yml"
|
142
170
|
- CODE_OF_CONDUCT.md
|
143
171
|
- Gemfile
|
144
172
|
- Guardfile
|
@@ -148,22 +176,28 @@ files:
|
|
148
176
|
- bin/console
|
149
177
|
- bin/setup
|
150
178
|
- bin/test
|
151
|
-
- lib/tasks/userlist.rake
|
152
179
|
- lib/userlist/rails.rb
|
153
|
-
- lib/userlist/rails/company.rb
|
154
180
|
- lib/userlist/rails/config.rb
|
181
|
+
- lib/userlist/rails/extensions/company.rb
|
182
|
+
- lib/userlist/rails/extensions/event.rb
|
183
|
+
- lib/userlist/rails/extensions/relationship.rb
|
184
|
+
- lib/userlist/rails/extensions/user.rb
|
185
|
+
- lib/userlist/rails/helpers.rb
|
155
186
|
- lib/userlist/rails/importer.rb
|
156
187
|
- lib/userlist/rails/logger.rb
|
157
|
-
- lib/userlist/rails/push.rb
|
158
188
|
- lib/userlist/rails/railtie.rb
|
159
|
-
- lib/userlist/rails/
|
189
|
+
- lib/userlist/rails/tasks/userlist.rake
|
190
|
+
- lib/userlist/rails/transform.rb
|
191
|
+
- lib/userlist/rails/transforms/company.rb
|
192
|
+
- lib/userlist/rails/transforms/relationship.rb
|
193
|
+
- lib/userlist/rails/transforms/user.rb
|
160
194
|
- lib/userlist/rails/version.rb
|
161
195
|
- userlist-rails.gemspec
|
162
196
|
homepage: https://github.com/userlistio/userlist-rails
|
163
197
|
licenses:
|
164
198
|
- MIT
|
165
199
|
metadata: {}
|
166
|
-
post_install_message:
|
200
|
+
post_install_message:
|
167
201
|
rdoc_options: []
|
168
202
|
require_paths:
|
169
203
|
- lib
|
@@ -171,16 +205,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
205
|
requirements:
|
172
206
|
- - ">="
|
173
207
|
- !ruby/object:Gem::Version
|
174
|
-
version: '
|
208
|
+
version: '2.4'
|
175
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
210
|
requirements:
|
177
211
|
- - ">="
|
178
212
|
- !ruby/object:Gem::Version
|
179
213
|
version: '0'
|
180
214
|
requirements: []
|
181
|
-
|
182
|
-
|
183
|
-
signing_key:
|
215
|
+
rubygems_version: 3.1.4
|
216
|
+
signing_key:
|
184
217
|
specification_version: 4
|
185
|
-
summary: Rails integration for Userlist
|
218
|
+
summary: Rails integration for Userlist
|
186
219
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'active_support/concern'
|
2
|
-
require 'userlist/push'
|
3
|
-
|
4
|
-
module Userlist
|
5
|
-
module Rails
|
6
|
-
module Company
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
|
9
|
-
included do
|
10
|
-
method = [:after_commit, :after_save].find { |m| respond_to?(m) }
|
11
|
-
public_send(method, :userlist_push) if method
|
12
|
-
end
|
13
|
-
|
14
|
-
def userlist_identifier
|
15
|
-
"#{self.class.name}-#{id}".parameterize
|
16
|
-
end
|
17
|
-
|
18
|
-
def userlist_properties
|
19
|
-
{}
|
20
|
-
end
|
21
|
-
|
22
|
-
def userlist_payload
|
23
|
-
{
|
24
|
-
identifier: userlist_identifier,
|
25
|
-
name: userlist_name,
|
26
|
-
properties: userlist_properties
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
def userlist_name
|
31
|
-
return name if respond_to?(:name)
|
32
|
-
end
|
33
|
-
|
34
|
-
def userlist_push
|
35
|
-
Userlist::Push.company(userlist_payload)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/lib/userlist/rails/push.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/hash/transform_values'
|
2
|
-
|
3
|
-
module Userlist
|
4
|
-
module Rails
|
5
|
-
module Push
|
6
|
-
def event(payload = {})
|
7
|
-
payload[:user] ||= Userlist::Rails.current_user
|
8
|
-
|
9
|
-
super(transform_payload(payload))
|
10
|
-
end
|
11
|
-
alias track event
|
12
|
-
|
13
|
-
def user(payload = {})
|
14
|
-
super(transform_payload(payload))
|
15
|
-
end
|
16
|
-
alias identify user
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def transform_payload(payload)
|
21
|
-
payload = transform_value(payload)
|
22
|
-
|
23
|
-
return payload unless payload.is_a?(Hash)
|
24
|
-
|
25
|
-
payload.transform_values do |value|
|
26
|
-
result = transform_value(value)
|
27
|
-
result = transform_payload(result) if result.is_a?(Hash)
|
28
|
-
result
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def transform_value(value)
|
33
|
-
if value.respond_to?(:userlist_payload)
|
34
|
-
value.send(:userlist_payload)
|
35
|
-
else
|
36
|
-
value
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
data/lib/userlist/rails/user.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'active_support/concern'
|
2
|
-
require 'userlist/push'
|
3
|
-
|
4
|
-
module Userlist
|
5
|
-
module Rails
|
6
|
-
module User
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
|
9
|
-
included do
|
10
|
-
method = [:after_commit, :after_save].find { |m| respond_to?(m) }
|
11
|
-
public_send(method, :userlist_push) if method
|
12
|
-
end
|
13
|
-
|
14
|
-
def userlist_identifier
|
15
|
-
"#{self.class.name}-#{id}".parameterize
|
16
|
-
end
|
17
|
-
|
18
|
-
def userlist_properties
|
19
|
-
{}
|
20
|
-
end
|
21
|
-
|
22
|
-
def userlist_email
|
23
|
-
return email if respond_to?(:email)
|
24
|
-
end
|
25
|
-
|
26
|
-
def userlist_company
|
27
|
-
nil
|
28
|
-
end
|
29
|
-
|
30
|
-
def userlist_payload
|
31
|
-
{
|
32
|
-
identifier: userlist_identifier,
|
33
|
-
email: userlist_email,
|
34
|
-
company: userlist_company,
|
35
|
-
properties: userlist_properties,
|
36
|
-
signed_up_at: created_at
|
37
|
-
}
|
38
|
-
end
|
39
|
-
|
40
|
-
def userlist_push
|
41
|
-
Userlist::Push.user(userlist_payload)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|