userlist-rails 0.3.0 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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 +193 -21
- data/lib/userlist/rails.rb +98 -4
- data/lib/userlist/rails/config.rb +16 -5
- data/lib/userlist/rails/extensions/company.rb +30 -0
- data/lib/userlist/rails/extensions/event.rb +10 -3
- 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 +32 -10
- 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 +12 -7
- metadata +79 -26
- data/.travis.yml +0 -7
- data/lib/userlist/rails/company.rb +0 -45
- data/lib/userlist/rails/extensions/resource.rb +0 -35
- data/lib/userlist/rails/user.rb +0 -51
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,12 +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.3'
|
22
|
+
spec.required_ruby_version = '>= 2.4'
|
25
23
|
|
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'
|
26
30
|
spec.add_development_dependency 'bundler', '>= 1.15'
|
27
|
-
spec.add_development_dependency 'rake', '~>
|
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 '
|
33
|
+
spec.add_development_dependency 'rspec-rails', '~> 3.0'
|
34
|
+
spec.add_development_dependency 'sqlite3', '>= 1.4'
|
30
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.3
|
4
|
+
version: 0.5.3
|
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-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,42 +16,70 @@ 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.
|
47
|
+
version: '0.5'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
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:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
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'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: bundler
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +100,20 @@ dependencies:
|
|
72
100
|
requirements:
|
73
101
|
- - "~>"
|
74
102
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
103
|
+
version: '12.3'
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 12.3.3
|
76
107
|
type: :development
|
77
108
|
prerelease: false
|
78
109
|
version_requirements: !ruby/object:Gem::Requirement
|
79
110
|
requirements:
|
80
111
|
- - "~>"
|
81
112
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
113
|
+
version: '12.3'
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 12.3.3
|
83
117
|
- !ruby/object:Gem::Dependency
|
84
118
|
name: rspec
|
85
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,30 +129,44 @@ dependencies:
|
|
95
129
|
- !ruby/object:Gem::Version
|
96
130
|
version: '3.0'
|
97
131
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
132
|
+
name: rspec-rails
|
99
133
|
requirement: !ruby/object:Gem::Requirement
|
100
134
|
requirements:
|
101
135
|
- - "~>"
|
102
136
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
137
|
+
version: '3.0'
|
104
138
|
type: :development
|
105
139
|
prerelease: false
|
106
140
|
version_requirements: !ruby/object:Gem::Requirement
|
107
141
|
requirements:
|
108
142
|
- - "~>"
|
109
143
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
111
|
-
|
144
|
+
version: '3.0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: sqlite3
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '1.4'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '1.4'
|
159
|
+
description:
|
112
160
|
email:
|
113
|
-
- benedikt@userlist.
|
161
|
+
- benedikt@userlist.com
|
114
162
|
executables: []
|
115
163
|
extensions: []
|
116
164
|
extra_rdoc_files: []
|
117
165
|
files:
|
166
|
+
- ".github/workflows/test.yml"
|
118
167
|
- ".gitignore"
|
119
168
|
- ".rspec"
|
120
169
|
- ".rubocop.yml"
|
121
|
-
- ".travis.yml"
|
122
170
|
- CODE_OF_CONDUCT.md
|
123
171
|
- Gemfile
|
124
172
|
- Guardfile
|
@@ -128,23 +176,28 @@ files:
|
|
128
176
|
- bin/console
|
129
177
|
- bin/setup
|
130
178
|
- bin/test
|
131
|
-
- lib/tasks/userlist.rake
|
132
179
|
- lib/userlist/rails.rb
|
133
|
-
- lib/userlist/rails/company.rb
|
134
180
|
- lib/userlist/rails/config.rb
|
181
|
+
- lib/userlist/rails/extensions/company.rb
|
135
182
|
- lib/userlist/rails/extensions/event.rb
|
136
|
-
- lib/userlist/rails/extensions/
|
183
|
+
- lib/userlist/rails/extensions/relationship.rb
|
184
|
+
- lib/userlist/rails/extensions/user.rb
|
185
|
+
- lib/userlist/rails/helpers.rb
|
137
186
|
- lib/userlist/rails/importer.rb
|
138
187
|
- lib/userlist/rails/logger.rb
|
139
188
|
- lib/userlist/rails/railtie.rb
|
140
|
-
- 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
|
141
194
|
- lib/userlist/rails/version.rb
|
142
195
|
- userlist-rails.gemspec
|
143
196
|
homepage: https://github.com/userlistio/userlist-rails
|
144
197
|
licenses:
|
145
198
|
- MIT
|
146
199
|
metadata: {}
|
147
|
-
post_install_message:
|
200
|
+
post_install_message:
|
148
201
|
rdoc_options: []
|
149
202
|
require_paths:
|
150
203
|
- lib
|
@@ -152,15 +205,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
205
|
requirements:
|
153
206
|
- - ">="
|
154
207
|
- !ruby/object:Gem::Version
|
155
|
-
version: '
|
208
|
+
version: '2.4'
|
156
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
210
|
requirements:
|
158
211
|
- - ">="
|
159
212
|
- !ruby/object:Gem::Version
|
160
213
|
version: '0'
|
161
214
|
requirements: []
|
162
|
-
rubygems_version: 3.
|
163
|
-
signing_key:
|
215
|
+
rubygems_version: 3.1.4
|
216
|
+
signing_key:
|
164
217
|
specification_version: 4
|
165
|
-
summary: Rails integration for Userlist
|
218
|
+
summary: Rails integration for Userlist
|
166
219
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,45 +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
|
-
if method = [:after_commit, :after_save].find { |m| respond_to?(m) }
|
11
|
-
public_send(method, :userlist_push, on: [:create, :update])
|
12
|
-
public_send(method, :userlist_delete, on: [:destroy])
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def userlist_identifier
|
17
|
-
"#{self.class.name}-#{id}".parameterize
|
18
|
-
end
|
19
|
-
|
20
|
-
def userlist_properties
|
21
|
-
{}
|
22
|
-
end
|
23
|
-
|
24
|
-
def userlist_payload
|
25
|
-
{
|
26
|
-
identifier: userlist_identifier,
|
27
|
-
name: userlist_name,
|
28
|
-
properties: userlist_properties
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
|
-
def userlist_name
|
33
|
-
return name if respond_to?(:name)
|
34
|
-
end
|
35
|
-
|
36
|
-
def userlist_push
|
37
|
-
Userlist::Push.companies.push(userlist_payload)
|
38
|
-
end
|
39
|
-
|
40
|
-
def userlist_delete
|
41
|
-
Userlist::Push.companies.delete(userlist_identifier)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/hash/transform_values' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.5.0')
|
2
|
-
|
3
|
-
module Userlist
|
4
|
-
module Rails
|
5
|
-
module Extensions
|
6
|
-
module Resource
|
7
|
-
def initialize(payload = {})
|
8
|
-
super(transform_payload(payload))
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def transform_payload(payload)
|
14
|
-
payload = transform_value(payload)
|
15
|
-
|
16
|
-
return payload unless payload.is_a?(Hash)
|
17
|
-
|
18
|
-
payload.transform_values do |value|
|
19
|
-
result = transform_value(value)
|
20
|
-
result = transform_payload(result) if result.is_a?(Hash)
|
21
|
-
result
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def transform_value(value)
|
26
|
-
if value.respond_to?(:userlist_payload)
|
27
|
-
value.send(:userlist_payload)
|
28
|
-
else
|
29
|
-
value
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
data/lib/userlist/rails/user.rb
DELETED
@@ -1,51 +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
|
-
if method = [:after_commit, :after_save].find { |m| respond_to?(m) }
|
11
|
-
public_send(method, :userlist_push, on: [:create, :update])
|
12
|
-
public_send(method, :userlist_delete, on: [:destroy])
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def userlist_identifier
|
17
|
-
"#{self.class.name}-#{id}".parameterize
|
18
|
-
end
|
19
|
-
|
20
|
-
def userlist_properties
|
21
|
-
{}
|
22
|
-
end
|
23
|
-
|
24
|
-
def userlist_email
|
25
|
-
return email if respond_to?(:email)
|
26
|
-
end
|
27
|
-
|
28
|
-
def userlist_company
|
29
|
-
nil
|
30
|
-
end
|
31
|
-
|
32
|
-
def userlist_payload
|
33
|
-
{
|
34
|
-
identifier: userlist_identifier,
|
35
|
-
email: userlist_email,
|
36
|
-
company: userlist_company,
|
37
|
-
properties: userlist_properties,
|
38
|
-
signed_up_at: created_at
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
def userlist_push
|
43
|
-
Userlist::Push.users.push(userlist_payload)
|
44
|
-
end
|
45
|
-
|
46
|
-
def userlist_delete
|
47
|
-
Userlist::Push.users.delete(userlist_identifier)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|