Class: Marketing::Audiences::Target
- Inherits:
-
Object
- Object
- Marketing::Audiences::Target
- Defined in:
- app/services/marketing/audiences/target.rb
Overview
Adapts an ad-synced Audience (the model — formerly Audience) into the
platform-neutral shape the adapters consume: a stable key, a display name,
target platforms, and a consent-gated Customer scope resolved from the
audience's saved advanced-search query (dynamic) or its members
(customer). Named Target, not Audience, to avoid colliding with the
::Audience model it wraps.
Delegated Instance Attributes collapse
-
#name ⇒ Object
Alias for @audience#name.
Class Method Summary collapse
-
.all ⇒ Array<Target>
One per Audience flagged for ad sync.
Instance Method Summary collapse
-
#customer_scope ⇒ Object
Consent-gated Customer relation = the membership.
-
#initialize(audience) ⇒ Target
constructor
A new instance of Target.
-
#key ⇒ Object
Stable per-audience key — keys the Google user-list row and the OpenAI audience name so re-syncs hit the same remote audience.
-
#platforms ⇒ Array<String>
Platform keys (adapter labels) to sync to.
Constructor Details
#initialize(audience) ⇒ Target
Returns a new instance of Target.
16 17 18 |
# File 'app/services/marketing/audiences/target.rb', line 16 def initialize(audience) @audience = audience end |
Class Method Details
Instance Method Details
#customer_scope ⇒ Object
Consent-gated Customer relation = the membership. Opt-outs are excluded
here, which is also how snapshot (OpenAI) removal happens. Memoized so an
audience syncing to N platforms resolves its query once.
32 33 34 |
# File 'app/services/marketing/audiences/target.rb', line 32 def customer_scope @customer_scope ||= Customer.where(id: member_customer_ids). end |
#key ⇒ Object
Stable per-audience key — keys the Google user-list row and the OpenAI
audience name so re-syncs hit the same remote audience.
22 |
# File 'app/services/marketing/audiences/target.rb', line 22 def key = "audience-#{@audience.id}" |
#name ⇒ Object
Alias for @audience#name
24 |
# File 'app/services/marketing/audiences/target.rb', line 24 delegate :name, to: :@audience |
#platforms ⇒ Array<String>
Returns platform keys (adapter labels) to sync to.
27 |
# File 'app/services/marketing/audiences/target.rb', line 27 def platforms = Array(@audience.ad_platforms) |