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_id ⇒ Object
A unique string chosen by the advertiser.
-
#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.
-
#order_id ⇒ Object
The order ID for this transaction as a string.
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, order_id: nil, event_id: 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, order_id: nil, event_id: nil) ⇒ OriginalEventData
Returns a new instance of OriginalEventData.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 42 def initialize(event_name: nil, event_time: nil, order_id: nil, event_id: nil) unless event_name.nil? self.event_name = event_name end unless event_time.nil? self.event_time = event_time end unless order_id.nil? self.order_id = order_id end unless event_id.nil? self.event_id = event_id end end |
Instance Attribute Details
#event_id ⇒ Object
A unique string chosen by the advertiser.
36 37 38 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 36 def event_id @event_id end |
#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 |
#order_id ⇒ Object
The order ID for this transaction as a string.
33 34 35 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 33 def order_id @order_id end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
83 84 85 86 87 88 89 90 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 83 def ==(o) return true if self.equal?(o) self.class == o.class && event_name == o.event_name && event_time == o.event_time && order_id == o.order_id && event_id == o.event_id end |
#build(attributes = {}) ⇒ Object
build the object using the input hash
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 59 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 if attributes.has_key?(:'order_id') self.order_id = attributes[:'order_id'] end if attributes.has_key?(:'event_id') self.event_id = attributes[:'event_id'] end end |
#eql?(o) ⇒ Boolean
93 94 95 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 93 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
99 100 101 102 103 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 99 def hash [ event_name, event_time, order_id, event_id, ].hash end |
#normalize ⇒ Object
Normalize input fields to server request format.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 124 def normalize hash = {} unless event_name.nil? hash['event_name'] = event_name end unless event_time.nil? hash['event_time'] = event_time end unless order_id.nil? hash['order_id'] = order_id end unless event_id.nil? hash['event_id'] = event_id end hash end |
#to_s ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/facebook_ads/ad_objects/server_side/original_event_data.rb', line 105 def to_s hash = {} unless event_name.nil? hash['event_name'] = event_name end unless event_time.nil? hash['event_time'] = event_time end unless order_id.nil? hash['order_id'] = order_id end unless event_id.nil? hash['event_id'] = event_id end hash.to_s end |