Module: Audiences
- Defined in:
- lib/audiences.rb,
lib/audiences/scim.rb,
lib/audiences/engine.rb,
lib/audiences/version.rb,
lib/audiences/scim/client.rb,
lib/audiences/notifications.rb,
app/models/audiences/context.rb,
app/models/audiences/criterion.rb,
app/models/audiences/membership.rb,
app/models/audiences/users_search.rb,
app/jobs/audiences/application_job.rb,
app/models/audiences/context_users.rb,
app/models/audiences/external_user.rb,
lib/audiences/scim/resources_query.rb,
app/models/audiences/criterion_users.rb,
app/models/audiences/application_record.rb,
app/controllers/audiences/contexts_controller.rb,
app/models/concerns/audiences/membership_group.rb,
app/controllers/audiences/scim_proxy_controller.rb,
app/controllers/audiences/application_controller.rb
Overview
Audiences system Audiences pushes notifications to your rails app when a SCIM backend updates a user, notifying matching audiences.
Defined Under Namespace
Modules: MembershipGroup, Notifications, Scim Classes: ApplicationController, ApplicationJob, ApplicationRecord, Context, ContextUsers, ContextsController, Criterion, CriterionUsers, Engine, ExternalUser, Membership, ScimProxyController, UsersSearch
Constant Summary collapse
- GID_RESOURCE =
"audiences"- VERSION =
"1.1.0"
Class Method Summary collapse
-
.load(key) ⇒ Object
Loads a context for the given context key.
-
.sign(owner) ⇒ String
Provides a key to load an audience context for the given owner.
-
.update(key, criteria: [], **attrs) ⇒ Object
Updates the given context.
Class Method Details
.load(key) ⇒ Object
Loads a context for the given context key
31 32 33 |
# File 'lib/audiences.rb', line 31 def load(key) locate_context(key, &:readonly!) end |
.sign(owner) ⇒ String
Provides a key to load an audience context for the given owner. An owner should implment GlobalID::Identification.
22 23 24 |
# File 'lib/audiences.rb', line 22 def sign(owner) owner.to_sgid(for: GID_RESOURCE) end |
.update(key, criteria: [], **attrs) ⇒ Object
Updates the given context
Params might contain:
match_all: Boolean criteria: Array<{ <group_type>: Array<Integer> }>
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/audiences.rb', line 46 def update(key, criteria: [], **attrs) locate_context(key) do |context| context.update!( criteria: ::Audiences::Criterion.map(criteria), **attrs ) context.refresh_users! context.readonly! end end |