Skip to content

Commit

Permalink
update event payload to take original_event_data&attribution_data
Browse files Browse the repository at this point in the history
Summary: Add original_event_data & attribution_data to the event payload

Reviewed By: stcheng

Differential Revision: D59868067

fbshipit-source-id: 6ba0b94a96680ae91a10a48aa9447ccadd3369a9
  • Loading branch information
shuaiwa-meta authored and facebook-github-bot committed Jul 18, 2024
1 parent 02c4351 commit 38f9a07
Showing 1 changed file with 44 additions and 4 deletions.
48 changes: 44 additions & 4 deletions lib/facebook_ads/ad_objects/server_side/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require_relative './user_data'
require_relative './custom_data'
require_relative './app_data'
require_relative './original_event_data'
require_relative './attribution_data'

module FacebookAds
module ServerSide
Expand Down Expand Up @@ -78,6 +80,12 @@ class Event
# Messaging channel for the event
attr_accessor :messaging_channel

# Original event info
attr_accessor :original_event_data

# Attribution data info
attr_accessor :attribution_data

# @param [String] event_name
# @param [int] event_time
# @param [String] event_source_url
Expand All @@ -92,6 +100,8 @@ class Event
# @param String action_source
# @param [String] advanced_measurement_table
# @param [String] messaging_channel
# @param [FacebookAds::ServerSide::OriginalEventData] original_event_data
# @param [FacebookAds::ServerSide::AttributionData] attribution_data
def initialize(event_name: nil,
event_time: nil,
event_source_url: nil,
Expand All @@ -105,7 +115,9 @@ def initialize(event_name: nil,
data_processing_options_state: nil,
action_source: nil,
advanced_measurement_table: nil,
messaging_channel: nil
messaging_channel: nil,
original_event_data: nil,
attribution_data: nil
)

unless event_name.nil?
Expand Down Expand Up @@ -150,6 +162,12 @@ def initialize(event_name: nil,
unless messaging_channel.nil?
self.messaging_channel = messaging_channel
end
unless original_event_data.nil?
self.original_event_data = original_event_data
end
unless attribution_data.nil?
self.attribution_data = attribution_data
end
end

# build the object using the input hash
Expand Down Expand Up @@ -215,6 +233,14 @@ def build(attributes = {})
if attributes.has_key?(:'messaging_channel')
self.messaging_channel = attributes[:'messaging_channel']
end

if attributes.has_key?(:'original_event_data')
self.original_event_data = attributes[:'original_event_data']
end

if attributes.has_key?(:'attribution_data')
self.attribution_data = attributes[:'attribution_data']
end
end

# Show invalid properties with the reasons. Usually used together with valid?
Expand Down Expand Up @@ -261,8 +287,10 @@ def ==(o)
data_processing_options_country == o.data_processing_options_country &&
data_processing_options_state == o.data_processing_options_state &&
action_source == o.action_source &&
advanced_measurement_table == o.advanced_measurement_table
messaging_channel == o.messaging_channel
advanced_measurement_table == o.advanced_measurement_table &&
messaging_channel == o.messaging_channel &&
original_event_data == o.original_event_data &&
attribution_data == o.attribution_data
end

# @see the `==` method
Expand All @@ -276,7 +304,7 @@ def hash
[
event_name, event_time, event_source_url, opt_out, event_id, user_data, custom_data, app_data,
data_processing_options, data_processing_options_country, data_processing_options_state,
action_source, advanced_measurement_table, messaging_channel,
action_source, advanced_measurement_table, messaging_channel, original_event_data, attribution_data
].hash
end

Expand Down Expand Up @@ -324,6 +352,12 @@ def to_s
unless messaging_channel.nil?
hash['messaging_channel'] = messaging_channel
end
unless original_event_data.nil?
hash['original_event_data'] = original_event_data
end
unless attribution_data.nil?
hash['attribution_data'] = attribution_data
end
hash.to_s
end

Expand Down Expand Up @@ -376,6 +410,12 @@ def normalize
unless messaging_channel.nil?
hash['messaging_channel'] = messaging_channel
end
unless original_event_data.nil?
hash['original_event_data'] = original_event_data
end
unless attribution_data.nil?
hash['attribution_data'] = attribution_data
end
hash
end

Expand Down

0 comments on commit 38f9a07

Please sign in to comment.