class Eucalyptus::CustomAudience
Public Class Methods
api_path()
click to toggle source
# File lib/eucalyptus/custom_audience.rb, line 5 def self.api_path "customaudiences" end
create(graph: Eucalyptus.graph, name:)
click to toggle source
# File lib/eucalyptus/custom_audience.rb, line 9 def self.create(graph: Eucalyptus.graph, name:) response = graph.put_connections(parent.id, 'customaudiences', name: name) self.new(response) end
known_fields()
click to toggle source
# File lib/eucalyptus/custom_audience.rb, line 34 def self.known_fields [:name, :description, :approximate_count] end
Public Instance Methods
ad_sets(from_collection: AdSet.all)
click to toggle source
# File lib/eucalyptus/custom_audience.rb, line 26 def ad_sets(from_collection: AdSet.all) from_collection.collect do |ad_set| if ad_set.targeting.custom_audiences ad_set if ad_set.targeting.custom_audiences.any?{|a| a["id"] == self.id } end end.compact end
populate(emails, graph: Eucalyptus.graph)
click to toggle source
# File lib/eucalyptus/custom_audience.rb, line 14 def populate(emails, graph: Eucalyptus.graph) emails = emails.collect{|email| Digest::SHA256.hexdigest(email)} payload = {schema: "EMAIL_SHA256", data: emails}.to_json graph.put_connections(self.id, 'users', payload: payload) end
remove(emails, graph: Eucalyptus.graph)
click to toggle source
# File lib/eucalyptus/custom_audience.rb, line 20 def remove(emails, graph: Eucalyptus.graph) emails = emails.collect{|email| Digest::SHA256.hexdigest(email)} payload = {schema: "EMAIL_SHA256", data: emails}.to_json graph.delete_connections(self.id, 'users', payload: payload) end