Class: Marketing::CustomerMatch::MemberBuilder
- Inherits:
-
Object
- Object
- Marketing::CustomerMatch::MemberBuilder
- Defined in:
- app/services/marketing/customer_match/member_builder.rb
Overview
Builds Data Manager API AudienceMember payloads from a segment's
customers AND their contacts (people on a trade account live on Contact
rows). One member per party, carrying that party's hashed email + phone
identifiers. Yields in batches so the caller can ingest ≤10k/request.
Phase 1 emits email + phone identifiers only (the strongest, already
E.164/normalized). Name+address identifiers are a future match-rate
enhancement — see the task doc.
Constant Summary collapse
- MAX_IDENTIFIERS_PER_MEMBER =
Google rejects an audience member with more than 10 user identifiers
(TOO_MANY_USER_IDENTIFIERS). When a party carries more, the most
recently updated identifiers win (see #most_recent_identifiers). 10
Instance Method Summary collapse
- #each_batch(batch_size: Client::MAX_MEMBERS_PER_REQUEST) {|batch| ... } ⇒ void
-
#initialize(customers) ⇒ MemberBuilder
constructor
A new instance of MemberBuilder.
Constructor Details
#initialize(customers) ⇒ MemberBuilder
Returns a new instance of MemberBuilder.
23 24 25 |
# File 'app/services/marketing/customer_match/member_builder.rb', line 23 def initialize(customers) @customers = customers end |
Instance Method Details
#each_batch(batch_size: Client::MAX_MEMBERS_PER_REQUEST) {|batch| ... } ⇒ void
This method returns an undefined value.
30 31 32 33 34 35 |
# File 'app/services/marketing/customer_match/member_builder.rb', line 30 def each_batch(batch_size: Client::MAX_MEMBERS_PER_REQUEST) member_parties.in_batches(of: batch_size) do |relation| members = build_members(relation.pluck(:id)) yield members if members.any? end end |