README.md in infinum_id-1.6.0 vs README.md in infinum_id-2.0.0
- old
+ new
@@ -49,11 +49,11 @@
module InfinumId
class ResourceBlueprint < Blueprinter::Base
identifier :email
- fields :first_name, :last_name
+ fields :first_name, :last_name, :employee
field :slack_username
field :avatar_url, as: :avatar_remote_url
end
end
@@ -78,11 +78,11 @@
InfinumId.configure do |config|
config.service_name = 'Revisor'
config.resource_name = 'User'
config.send_invite_request = !Rails.env.test? # to disable in tests
- config.resource_attributes = [:uid, :email, :first_name, :last_name, :deactivated_at, :time_zone, :avatar_url, :slack_username]
+ config.resource_attributes = [:uid, :email, :first_name, :last_name, :deactivated_at, :time_zone, :avatar_url, :slack_username, :employee]
end
```
Configuration options:
* Service name - name of application
@@ -133,23 +133,25 @@
```
## Features
<details>
-<summary><big><b>Webhooks</b></big></summary>
+<summary><big><b id="webhooks">Webhooks</b></big></summary>
<hr />
-In engine there are two webhooks: UpdateResourceCallback & CreateResourceCallback.
+In engine there are two webhooks: `UpdateResourceCallback` & `CreateResourceCallback`.
When user is created or updated on InfinumID these webhooks are called and then resource is created or updated accordingly.
-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.
+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.
+`intent` is one of `InfinumId::AfterResourceIntent::CREATE` or `InfinumId::AfterResourceIntent::UPDATE.`
+
```ruby
# app/services/infinum_id/after_resource_create.rb
module InfinumId
- class AfterResourceCreate
- def self.call(person, params=nil)
+ class AfterResourceUpsert
+ def self.call(person, _params = nil, _intent = nil)
person.update(employee: true)
end
end
end
```