Class: FacebookAds::ServerSide::OriginalEventData
- Inherits:
-
Object
- Object
- FacebookAds::ServerSide::OriginalEventData
- Defined in:
- lib/facebook_ads/ad_objects/server_side/original_event_data.rb
Overview
OriginalEventData contains original event info used for attribution passback event or generalized value optimization(GVO).
Instance Attribute Summary collapse
-
#event_name ⇒ Object
A Facebook pixel Standard Event or Custom Event name.
-
#event_time ⇒ Object
A Unix timestamp in seconds indicating when the original event occurred.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#build(attributes = {}) ⇒ Object
build the object using the input hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(event_name: nil, event_time: nil) ⇒ OriginalEventData
constructor
A new instance of OriginalEventData.
-
#normalize ⇒ Object
Normalize input fields to server request format.
- #to_s ⇒ Object
Constructor Details
#initialize(event_name: nil, event_time: nil) ⇒ OriginalEventData
Returns a new instance of OriginalEventData.
34 35 36 37 38 39 40 41 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 34 def initialize(event_name: nil, event_time: nil) unless event_name.nil? self.event_name = event_name end unless event_time.nil? self.event_time = event_time end end |
Instance Attribute Details
#event_name ⇒ Object
A Facebook pixel Standard Event or Custom Event name. This is used with event_id to determine if events are identical.
27 28 29 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 27 def event_name @event_name end |
#event_time ⇒ Object
A Unix timestamp in seconds indicating when the original event occurred.
30 31 32 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 30 def event_time @event_time end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
61 62 63 64 65 66 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 61 def ==(o) return true if self.equal?(o) self.class == o.class && event_name == o.event_name && event_time == o.event_time end |
#build(attributes = {}) ⇒ Object
build the object using the input hash
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 45 def build(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'event_name') self.event_name = attributes[:'event_name'] end if attributes.has_key?(:'event_time') self.event_time = attributes[:'event_time'] end end |
#eql?(o) ⇒ Boolean
69 70 71 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 69 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
75 76 77 78 79 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 75 def hash [ event_name, event_time, ].hash end |
#normalize ⇒ Object
Normalize input fields to server request format.
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 94 def normalize hash = {} unless event_name.nil? hash['event_name'] = event_name end unless event_time.nil? hash['event_time'] = event_time end hash end |
#to_s ⇒ Object
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 81 def to_s hash = {} unless event_name.nil? hash['event_name'] = event_name end unless event_time.nil? hash['event_time'] = event_time end hash.to_s end |