infinum_id 1.5.0 → 2.1.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: 5e62591afc2dcf87b83746e0cfbfa6ce4e1490f252e4f120dcd46bc44bbacc2c
4
- data.tar.gz: 6bd93953e12d36d8c1bc068286b7a772ceb380d2a8d4f89f693ef7e85605a12e
3
+ metadata.gz: 329d0ad24f2ba1d83ec0c27266cadac9ed807b07cd584dbe18a8dfb4169296a5
4
+ data.tar.gz: 4838ee5875f33586b23624caf73c29b6557e640bbb098efc751db12557d011b3
5
5
  SHA512:
6
- metadata.gz: a5084163467986c28e70a91922302dc7eb22e2e363a71cbda47ea3abf36d9e070a258e81505705c1c80c8f6317adeaef7205b8581cbdb9787c0d7d1287cc5db5
7
- data.tar.gz: 8d998e72deeb6b77dd268a168522aad5842975c3b9455f4f047cd021e6cab7076bd381ba6162ca3c7a775a2b48aa95ce1e0c771211090e0dd4b3dde0fd550ecd
6
+ metadata.gz: 2e5b657db01abbfd58ec2e2a44041d19706c26582368583828c6df38fe19aab167f2c9ca1c2da9fef242ea79a7b2ac93ec178eae7814a5d3dd053ac084a5104e
7
+ data.tar.gz: 90a9e7f28e77c64c387346caac811b09105575b39078e5978f75b462f91ea786e3c471d885b5c657128f4c1bc53b7df0c16096cbbc6bf5bcd53c2cd2bf1a2c6f
data/CHANGES.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ ## Version 2.0.0
4
+
5
+ Released of September 18, 2020
6
+
7
+ Changes:
8
+ * [BREAKING] Removed `InfinumId::AfterResourceCreate` and `InfinumId::AfterResourceUpdate` classes.
9
+ * [BREAKING] Added `InfinumId::AfterResourceUpsert` and `InfinumId::AfterResourceIntent` classes. see [Webhooks](README.md#webhooks) for more info
10
+ * [BREAKING] Removed `/webhooks#update_resource_callback` and `/webhooks#create_resource_callback` routes.
11
+ * [BREAKING] Added `/webhook#upsert_resource_callback` route.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- infinum_id (1.5.0)
4
+ infinum_id (2.1.0)
5
5
  blueprinter
6
6
  bundler
7
7
  devise
@@ -13,60 +13,77 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- actioncable (5.2.2)
17
- actionpack (= 5.2.2)
16
+ actioncable (6.1.3.2)
17
+ actionpack (= 6.1.3.2)
18
+ activesupport (= 6.1.3.2)
18
19
  nio4r (~> 2.0)
19
20
  websocket-driver (>= 0.6.1)
20
- actionmailer (5.2.2)
21
- actionpack (= 5.2.2)
22
- actionview (= 5.2.2)
23
- activejob (= 5.2.2)
21
+ actionmailbox (6.1.3.2)
22
+ actionpack (= 6.1.3.2)
23
+ activejob (= 6.1.3.2)
24
+ activerecord (= 6.1.3.2)
25
+ activestorage (= 6.1.3.2)
26
+ activesupport (= 6.1.3.2)
27
+ mail (>= 2.7.1)
28
+ actionmailer (6.1.3.2)
29
+ actionpack (= 6.1.3.2)
30
+ actionview (= 6.1.3.2)
31
+ activejob (= 6.1.3.2)
32
+ activesupport (= 6.1.3.2)
24
33
  mail (~> 2.5, >= 2.5.4)
25
34
  rails-dom-testing (~> 2.0)
26
- actionpack (5.2.2)
27
- actionview (= 5.2.2)
28
- activesupport (= 5.2.2)
29
- rack (~> 2.0)
35
+ actionpack (6.1.3.2)
36
+ actionview (= 6.1.3.2)
37
+ activesupport (= 6.1.3.2)
38
+ rack (~> 2.0, >= 2.0.9)
30
39
  rack-test (>= 0.6.3)
31
40
  rails-dom-testing (~> 2.0)
32
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
33
- actionview (5.2.2)
34
- activesupport (= 5.2.2)
41
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
+ actiontext (6.1.3.2)
43
+ actionpack (= 6.1.3.2)
44
+ activerecord (= 6.1.3.2)
45
+ activestorage (= 6.1.3.2)
46
+ activesupport (= 6.1.3.2)
47
+ nokogiri (>= 1.8.5)
48
+ actionview (6.1.3.2)
49
+ activesupport (= 6.1.3.2)
35
50
  builder (~> 3.1)
36
51
  erubi (~> 1.4)
37
52
  rails-dom-testing (~> 2.0)
38
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
39
- activejob (5.2.2)
40
- activesupport (= 5.2.2)
53
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
54
+ activejob (6.1.3.2)
55
+ activesupport (= 6.1.3.2)
41
56
  globalid (>= 0.3.6)
42
- activemodel (5.2.2)
43
- activesupport (= 5.2.2)
44
- activerecord (5.2.2)
45
- activemodel (= 5.2.2)
46
- activesupport (= 5.2.2)
47
- arel (>= 9.0)
48
- activestorage (5.2.2)
49
- actionpack (= 5.2.2)
50
- activerecord (= 5.2.2)
51
- marcel (~> 0.3.1)
52
- activesupport (5.2.2)
57
+ activemodel (6.1.3.2)
58
+ activesupport (= 6.1.3.2)
59
+ activerecord (6.1.3.2)
60
+ activemodel (= 6.1.3.2)
61
+ activesupport (= 6.1.3.2)
62
+ activestorage (6.1.3.2)
63
+ actionpack (= 6.1.3.2)
64
+ activejob (= 6.1.3.2)
65
+ activerecord (= 6.1.3.2)
66
+ activesupport (= 6.1.3.2)
67
+ marcel (~> 1.0.0)
68
+ mini_mime (~> 1.0.2)
69
+ activesupport (6.1.3.2)
53
70
  concurrent-ruby (~> 1.0, >= 1.0.2)
54
- i18n (>= 0.7, < 2)
55
- minitest (~> 5.1)
56
- tzinfo (~> 1.1)
71
+ i18n (>= 1.6, < 2)
72
+ minitest (>= 5.1)
73
+ tzinfo (~> 2.0)
74
+ zeitwerk (~> 2.3)
57
75
  addressable (2.6.0)
58
76
  public_suffix (>= 2.0.2, < 4.0)
59
- arel (9.0.0)
60
- bcrypt (3.1.13)
61
- blueprinter (0.22.0)
62
- builder (3.2.3)
77
+ bcrypt (3.1.16)
78
+ blueprinter (0.25.3)
79
+ builder (3.2.4)
63
80
  byebug (10.0.2)
64
81
  coderay (1.1.2)
65
- concurrent-ruby (1.1.4)
82
+ concurrent-ruby (1.1.8)
66
83
  crack (0.4.3)
67
84
  safe_yaml (~> 1.0.0)
68
- crass (1.0.4)
69
- devise (4.7.1)
85
+ crass (1.0.6)
86
+ devise (4.8.0)
70
87
  bcrypt (~> 3.0)
71
88
  orm_adapter (~> 0.1)
72
89
  railties (>= 4.1.0)
@@ -76,12 +93,12 @@ GEM
76
93
  docile (1.3.1)
77
94
  domain_name (0.5.20190701)
78
95
  unf (>= 0.0.5, < 1.0.0)
79
- dry-configurable (0.9.0)
96
+ dry-configurable (0.12.1)
80
97
  concurrent-ruby (~> 1.0)
81
- dry-core (~> 0.4, >= 0.4.7)
82
- dry-core (0.4.9)
98
+ dry-core (~> 0.5, >= 0.5.0)
99
+ dry-core (0.5.0)
83
100
  concurrent-ruby (~> 1.0)
84
- erubi (1.8.0)
101
+ erubi (1.10.0)
85
102
  factory_bot (5.0.0)
86
103
  activesupport (>= 4.2.0)
87
104
  factory_bot_rails (5.0.0)
@@ -89,62 +106,73 @@ GEM
89
106
  railties (>= 4.2.0)
90
107
  faker (1.9.1)
91
108
  i18n (>= 0.7)
92
- faraday (1.0.0)
109
+ faraday (1.4.2)
110
+ faraday-em_http (~> 1.0)
111
+ faraday-em_synchrony (~> 1.0)
112
+ faraday-excon (~> 1.1)
113
+ faraday-net_http (~> 1.0)
114
+ faraday-net_http_persistent (~> 1.1)
93
115
  multipart-post (>= 1.2, < 3)
94
- ffi (1.11.3)
116
+ ruby2_keywords (>= 0.0.4)
117
+ faraday-em_http (1.0.0)
118
+ faraday-em_synchrony (1.0.0)
119
+ faraday-excon (1.1.0)
120
+ faraday-net_http (1.0.1)
121
+ faraday-net_http_persistent (1.1.0)
122
+ ffi (1.15.1)
95
123
  ffi-compiler (1.0.1)
96
124
  ffi (>= 1.0.0)
97
125
  rake
98
126
  globalid (0.4.2)
99
127
  activesupport (>= 4.2.0)
100
128
  hashdiff (0.3.8)
101
- hashie (3.6.0)
102
- http (4.3.0)
129
+ hashie (4.1.0)
130
+ http (4.4.1)
103
131
  addressable (~> 2.3)
104
132
  http-cookie (~> 1.0)
105
133
  http-form_data (~> 2.2)
106
134
  http-parser (~> 1.2.0)
107
135
  http-cookie (1.0.3)
108
136
  domain_name (~> 0.5)
109
- http-form_data (2.2.0)
110
- http-parser (1.2.1)
137
+ http-form_data (2.3.0)
138
+ http-parser (1.2.3)
111
139
  ffi-compiler (>= 1.0, < 2.0)
112
- i18n (1.5.3)
140
+ i18n (1.8.10)
113
141
  concurrent-ruby (~> 1.0)
114
142
  json (2.1.0)
115
- jwt (2.2.1)
116
- loofah (2.2.3)
143
+ jwt (2.2.3)
144
+ loofah (2.9.1)
117
145
  crass (~> 1.0.2)
118
146
  nokogiri (>= 1.5.9)
119
147
  mail (2.7.1)
120
148
  mini_mime (>= 0.1.1)
121
- marcel (0.3.3)
122
- mimemagic (~> 0.3.2)
149
+ marcel (1.0.1)
123
150
  method_source (0.9.2)
124
- mimemagic (0.3.3)
125
- mini_mime (1.0.1)
126
- mini_portile2 (2.4.0)
127
- minitest (5.11.3)
128
- multi_json (1.14.1)
151
+ mini_mime (1.0.3)
152
+ mini_portile2 (2.5.1)
153
+ minitest (5.14.4)
154
+ multi_json (1.15.0)
129
155
  multi_xml (0.6.0)
130
156
  multipart-post (2.1.1)
131
- nio4r (2.3.1)
132
- nokogiri (1.10.1)
133
- mini_portile2 (~> 2.4.0)
134
- oauth2 (1.4.2)
157
+ nio4r (2.5.7)
158
+ nokogiri (1.11.5)
159
+ mini_portile2 (~> 2.5.0)
160
+ racc (~> 1.4)
161
+ oauth2 (1.4.7)
135
162
  faraday (>= 0.8, < 2.0)
136
163
  jwt (>= 1.0, < 3.0)
137
164
  multi_json (~> 1.3)
138
165
  multi_xml (~> 0.5)
139
166
  rack (>= 1.2, < 3)
140
- omniauth (1.9.0)
141
- hashie (>= 3.4.6, < 3.7.0)
167
+ omniauth (2.0.4)
168
+ hashie (>= 3.4.6)
142
169
  rack (>= 1.6.2, < 3)
143
- omniauth-infinum_id (1.1.0)
170
+ rack-protection
171
+ omniauth-infinum_id (1.2.1)
144
172
  omniauth-oauth2
145
- omniauth-oauth2 (1.6.0)
146
- oauth2 (~> 1.1)
147
- omniauth (~> 1.9)
173
+ omniauth-oauth2 (1.7.1)
174
+ oauth2 (~> 1.4)
175
+ omniauth (>= 1.9, < 3)
148
176
  orm_adapter (0.5.0)
149
177
  pry (0.12.2)
150
178
  coderay (~> 1.1.0)
@@ -155,35 +183,40 @@ GEM
155
183
  pry-rails (0.3.9)
156
184
  pry (>= 0.10.4)
157
185
  public_suffix (3.0.3)
158
- rack (2.0.6)
186
+ racc (1.5.2)
187
+ rack (2.2.3)
188
+ rack-protection (2.1.0)
189
+ rack
159
190
  rack-test (1.1.0)
160
191
  rack (>= 1.0, < 3)
161
- rails (5.2.2)
162
- actioncable (= 5.2.2)
163
- actionmailer (= 5.2.2)
164
- actionpack (= 5.2.2)
165
- actionview (= 5.2.2)
166
- activejob (= 5.2.2)
167
- activemodel (= 5.2.2)
168
- activerecord (= 5.2.2)
169
- activestorage (= 5.2.2)
170
- activesupport (= 5.2.2)
171
- bundler (>= 1.3.0)
172
- railties (= 5.2.2)
192
+ rails (6.1.3.2)
193
+ actioncable (= 6.1.3.2)
194
+ actionmailbox (= 6.1.3.2)
195
+ actionmailer (= 6.1.3.2)
196
+ actionpack (= 6.1.3.2)
197
+ actiontext (= 6.1.3.2)
198
+ actionview (= 6.1.3.2)
199
+ activejob (= 6.1.3.2)
200
+ activemodel (= 6.1.3.2)
201
+ activerecord (= 6.1.3.2)
202
+ activestorage (= 6.1.3.2)
203
+ activesupport (= 6.1.3.2)
204
+ bundler (>= 1.15.0)
205
+ railties (= 6.1.3.2)
173
206
  sprockets-rails (>= 2.0.0)
174
207
  rails-dom-testing (2.0.3)
175
208
  activesupport (>= 4.2.0)
176
209
  nokogiri (>= 1.6)
177
- rails-html-sanitizer (1.0.4)
178
- loofah (~> 2.2, >= 2.2.2)
179
- railties (5.2.2)
180
- actionpack (= 5.2.2)
181
- activesupport (= 5.2.2)
210
+ rails-html-sanitizer (1.3.0)
211
+ loofah (~> 2.3)
212
+ railties (6.1.3.2)
213
+ actionpack (= 6.1.3.2)
214
+ activesupport (= 6.1.3.2)
182
215
  method_source
183
216
  rake (>= 0.8.7)
184
- thor (>= 0.19.0, < 2.0)
217
+ thor (~> 1.0)
185
218
  rake (10.5.0)
186
- responders (3.0.0)
219
+ responders (3.0.1)
187
220
  actionpack (>= 5.0)
188
221
  railties (>= 5.0)
189
222
  rspec (3.8.0)
@@ -207,36 +240,37 @@ GEM
207
240
  rspec-mocks (~> 3.8.0)
208
241
  rspec-support (~> 3.8.0)
209
242
  rspec-support (3.8.0)
243
+ ruby2_keywords (0.0.4)
210
244
  safe_yaml (1.0.4)
211
245
  simplecov (0.16.1)
212
246
  docile (~> 1.1)
213
247
  json (>= 1.8, < 3)
214
248
  simplecov-html (~> 0.10.0)
215
249
  simplecov-html (0.10.2)
216
- sprockets (3.7.2)
250
+ sprockets (4.0.2)
217
251
  concurrent-ruby (~> 1.0)
218
252
  rack (> 1, < 3)
219
- sprockets-rails (3.2.1)
253
+ sprockets-rails (3.2.2)
220
254
  actionpack (>= 4.0)
221
255
  activesupport (>= 4.0)
222
256
  sprockets (>= 3.0.0)
223
257
  sqlite3 (1.3.13)
224
- thor (0.20.3)
225
- thread_safe (0.3.6)
226
- tzinfo (1.2.5)
227
- thread_safe (~> 0.1)
258
+ thor (1.1.0)
259
+ tzinfo (2.0.4)
260
+ concurrent-ruby (~> 1.0)
228
261
  unf (0.1.4)
229
262
  unf_ext
230
- unf_ext (0.0.7.6)
231
- warden (1.2.8)
232
- rack (>= 2.0.6)
263
+ unf_ext (0.0.7.7)
264
+ warden (1.2.9)
265
+ rack (>= 2.0.9)
233
266
  webmock (3.5.1)
234
267
  addressable (>= 2.3.6)
235
268
  crack (>= 0.3.2)
236
269
  hashdiff
237
- websocket-driver (0.7.0)
270
+ websocket-driver (0.7.4)
238
271
  websocket-extensions (>= 0.1.0)
239
- websocket-extensions (0.1.3)
272
+ websocket-extensions (0.1.5)
273
+ zeitwerk (2.4.2)
240
274
 
241
275
  PLATFORMS
242
276
  ruby
@@ -258,4 +292,4 @@ DEPENDENCIES
258
292
  webmock
259
293
 
260
294
  BUNDLED WITH
261
- 2.0.2
295
+ 2.1.4
data/README.md CHANGED
@@ -51,7 +51,7 @@ module InfinumId
51
51
  class ResourceBlueprint < Blueprinter::Base
52
52
  identifier :email
53
53
 
54
- fields :first_name, :last_name
54
+ fields :first_name, :last_name, :employee
55
55
 
56
56
  field :slack_username
57
57
  field :avatar_url, as: :avatar_remote_url
@@ -79,8 +79,8 @@ Devise is used like middleware for authentication that uses Omniauth with infinu
79
79
  InfinumId.configure do |config|
80
80
  config.service_name = 'Revisor'
81
81
  config.resource_name = 'User'
82
- config.infinum_id_send_email = false
83
- config.resource_attributes = [:uid, :email, :first_name, :last_name, :deactivated_at, :time_zone, :avatar_url, :slack_username]
82
+ config.send_invite_request = !Rails.env.test? # to disable in tests
83
+ config.resource_attributes = [:uid, :email, :first_name, :last_name, :deactivated_at, :time_zone, :avatar_url, :slack_username, :employee]
84
84
  end
85
85
  ```
86
86
 
@@ -135,20 +135,22 @@ end
135
135
  ## Features
136
136
 
137
137
  <details>
138
- <summary><big><b>Webhooks</b></big></summary>
138
+ <summary><big><b id="webhooks">Webhooks</b></big></summary>
139
139
  <hr />
140
- In engine there are two webhooks: UpdateResourceCallback & CreateResourceCallback.
140
+ In engine there are two webhooks: `UpdateResourceCallback` & `CreateResourceCallback`.
141
141
 
142
142
  When user is created or updated on InfinumID these webhooks are called and then resource is created or updated accordingly.
143
143
 
144
- After resource is created or updated methods InfinumId::AfterResourceCreate/InfinumId::AfterResourceUpdate are called. So if resource can't be created before setting role, you can override those methods and set role that way.
144
+ After resource is created or updated methods `InfinumId::AfterResourceUpsert` is called. So if resource can't be created before setting role, you can override this class and set role that way.
145
+
146
+ `intent` is one of `InfinumId::AfterResourceIntent::CREATE` or `InfinumId::AfterResourceIntent::UPDATE.`
145
147
 
146
148
  ```ruby
147
149
  # app/services/infinum_id/after_resource_create.rb
148
150
 
149
151
  module InfinumId
150
- class AfterResourceCreate
151
- def self.call(person, params=nil)
152
+ class AfterResourceUpsert
153
+ def self.call(person, _params = nil, _intent = nil)
152
154
  person.update(employee: true)
153
155
  end
154
156
  end
@@ -2,7 +2,7 @@ module InfinumId
2
2
  class ResourceBlueprint < Blueprinter::Base
3
3
  identifier :email
4
4
 
5
- fields :first_name, :last_name
5
+ fields :first_name, :last_name, :employee
6
6
 
7
7
  # field :slack_username
8
8
  # field :avatar_url, as: :avatar_remote_url
@@ -1,40 +1,52 @@
1
1
  module InfinumId
2
2
  module Api
3
3
  class WebhooksController < Api::BaseController
4
- def update_resource_callback
5
- return render_not_found unless resource
4
+ def upsert_resource_callback
5
+ intent, resource = upsert
6
6
 
7
- resource.update(user_params)
8
- InfinumId::AfterResourceUpdate.call(resource, params[:user])
7
+ InfinumId::AfterResourceUpsert.call(resource, params[:user], intent)
9
8
 
10
9
  render json: { resource_name.underscore => 'updated' }
11
10
  end
12
11
 
13
- def create_resource_callback
14
- return render_already_exists if resource
12
+ def update_resource_callback
13
+ return head :not_found if resource.blank?
14
+
15
+ intent, resource = update
15
16
 
16
- resource = resource_class.create(user_params.merge(provider: params[:provider]))
17
- InfinumId::AfterResourceCreate.call(resource, params[:user])
17
+ InfinumId::AfterResourceUpsert.call(resource, params[:user], intent)
18
18
 
19
- render json: { resource_name.underscore => 'created' }
19
+ render json: { resource_name.underscore => 'updated' }
20
20
  end
21
21
 
22
22
  private
23
23
 
24
24
  def user_params
25
- params.require(:user).permit(InfinumId.resource_attributes)
25
+ params.require(:user)
26
+ .permit(InfinumId.resource_attributes)
27
+ .merge(provider: params[:provider])
26
28
  end
27
29
 
28
30
  def resource
29
- @resource ||= resource_class.find_by(uid: user_params[:uid])
31
+ @resource ||=
32
+ resource_class.find_by(uid: user_params[:uid], provider: params[:provider]) ||
33
+ resource_class.find_by(email: user_params[:email])
30
34
  end
31
35
 
32
- def render_not_found
33
- render json: { resource_name.underscore => 'not found' }, status: :not_found
36
+ def update
37
+ resource.update(user_params)
38
+ [InfinumId::AfterResourceIntent::UPDATE, resource]
34
39
  end
35
40
 
36
- def render_already_exists
37
- render json: { resource_name.underscore => 'already exists' }, status: :unprocessable_entity
41
+ def upsert
42
+ if resource
43
+ resource.update(user_params)
44
+ [InfinumId::AfterResourceIntent::UPDATE, resource]
45
+ else
46
+ @resource = resource_class.create(user_params)
47
+
48
+ [InfinumId::AfterResourceIntent::CREATE, resource]
49
+ end
38
50
  end
39
51
  end
40
52
  end
@@ -0,0 +1,6 @@
1
+ module InfinumId
2
+ class AfterResourceIntent
3
+ CREATE = :create
4
+ UPDATE = :update
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module InfinumId
2
+ class AfterResourceUpsert
3
+ def self.call(resource, params, intent); end
4
+ end
5
+ end
@@ -11,6 +11,8 @@ module InfinumId
11
11
  end
12
12
 
13
13
  def call
14
+ return unless InfinumId.send_invite_request
15
+
14
16
  send_invite_request
15
17
  handle_response
16
18
  end
@@ -37,7 +39,11 @@ module InfinumId
37
39
 
38
40
  def update_resource
39
41
  resource.update(user_params.merge(provider: 'infinum_id'))
40
- InfinumId::AfterResourceUpdate.call(resource, params[:user])
42
+ InfinumId::AfterResourceUpsert.call(
43
+ resource,
44
+ params[:user],
45
+ InfinumId::AfterResourceIntent::UPDATE
46
+ )
41
47
  end
42
48
 
43
49
  def send_email
@@ -12,7 +12,11 @@ module InfinumId
12
12
 
13
13
  def call
14
14
  update_resource
15
- InfinumId::AfterResourceUpdate.call(resource, @params)
15
+ InfinumId::AfterResourceUpsert.call(
16
+ resource,
17
+ @params,
18
+ InfinumId::AfterResourceIntent::UPDATE
19
+ )
16
20
  end
17
21
 
18
22
  private
data/config/routes.rb CHANGED
@@ -7,9 +7,9 @@ Rails.application.routes.draw do
7
7
 
8
8
  namespace :infinum_id do
9
9
  namespace :api do
10
- scope '/webhooks', :controller => :webhooks do
10
+ scope '/webhooks', controller: :webhooks do
11
+ post :upsert_resource_callback
11
12
  post :update_resource_callback
12
- post :create_resource_callback
13
13
  end
14
14
  end
15
15
  end
@@ -5,6 +5,7 @@ class CreateUsers < ActiveRecord::Migration<%= migration_version %>
5
5
 
6
6
  t.string :first_name
7
7
  t.string :last_name
8
+ t.boolean :employee
8
9
 
9
10
  t.string :slack_username
10
11
  t.string :time_zone
@@ -13,6 +13,7 @@ class User < ApplicationRecord
13
13
  first_name: first_name,
14
14
  last_name: last_name,
15
15
  slack_username: slack_username,
16
+ employee: employee,
16
17
  time_zone: time_zone
17
18
  }
18
19
  end
data/lib/infinum_id.rb CHANGED
@@ -12,9 +12,11 @@ module InfinumId
12
12
  setting :service_name, reader: true
13
13
  setting :resource_name, 'User', reader: true
14
14
  setting :infinum_id_send_email, false, reader: true
15
+ setting :send_invite_request, true, reader: true
15
16
 
16
- setting :resource_attributes, [:uid, :email, :first_name, :last_name, :deactivated_at],
17
- reader: true
17
+ setting :resource_attributes,
18
+ [:uid, :email, :first_name, :last_name, :deactivated_at, :employee],
19
+ reader: true
18
20
 
19
21
  def self.resource_class
20
22
  resource_name.constantize
@@ -1,3 +1,3 @@
1
1
  module InfinumId
2
- VERSION = '1.5.0'
2
+ VERSION = '2.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infinum_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dajana Jeroncic
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-13 00:00:00.000000000 Z
11
+ date: 2021-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -301,6 +301,7 @@ files:
301
301
  - ".rspec"
302
302
  - ".rubocop.yml"
303
303
  - ".travis.yml"
304
+ - CHANGES.md
304
305
  - CODE_OF_CONDUCT.md
305
306
  - Gemfile
306
307
  - Gemfile.lock
@@ -317,8 +318,8 @@ files:
317
318
  - app/mailers/infinum_id/application_mailer.rb
318
319
  - app/mailers/infinum_id/mailer.rb
319
320
  - app/models/infinum_id/application_record.rb
320
- - app/services/infinum_id/after_resource_create.rb
321
- - app/services/infinum_id/after_resource_update.rb
321
+ - app/services/infinum_id/after_resource_intent.rb
322
+ - app/services/infinum_id/after_resource_upsert.rb
322
323
  - app/services/infinum_id/requests/invite_sender.rb
323
324
  - app/services/infinum_id/resources/finder.rb
324
325
  - app/services/infinum_id/resources/invite.rb
@@ -343,7 +344,7 @@ licenses:
343
344
  - MIT
344
345
  metadata:
345
346
  allowed_push_host: https://rubygems.org
346
- post_install_message:
347
+ post_install_message:
347
348
  rdoc_options: []
348
349
  require_paths:
349
350
  - lib
@@ -358,9 +359,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
358
359
  - !ruby/object:Gem::Version
359
360
  version: '0'
360
361
  requirements: []
361
- rubyforge_project:
362
- rubygems_version: 2.7.6
363
- signing_key:
362
+ rubygems_version: 3.1.4
363
+ signing_key:
364
364
  specification_version: 4
365
365
  summary: Write a short summary, because RubyGems requires one.
366
366
  test_files: []
@@ -1,5 +0,0 @@
1
- module InfinumId
2
- class AfterResourceCreate
3
- def self.call(resource, params=nil); end
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- module InfinumId
2
- class AfterResourceUpdate
3
- def self.call(resource, params=nil); end
4
- end
5
- end