Class: FacebookAds::ServerSide::EventResponse
- Inherits:
-
Object
- Object
- FacebookAds::ServerSide::EventResponse
- Defined in:
- lib/facebook_ads/ad_objects/server_side/event_response.rb
Instance Attribute Summary collapse
-
#events_received ⇒ Object
number of events received.
-
#fbtrace_id ⇒ Object
Facebook API trace id.
-
#messages ⇒ Object
Response message.
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(events_received: nil, messages: nil, fbtrace_id: nil) ⇒ EventResponse
constructor
A new instance of EventResponse.
- #to_s ⇒ Object
Constructor Details
#initialize(events_received: nil, messages: nil, fbtrace_id: nil) ⇒ EventResponse
Returns a new instance of EventResponse.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/facebook_ads/ad_objects/server_side/event_response.rb', line 36 def initialize(events_received: nil, messages: nil, fbtrace_id: nil) unless events_received.nil? self.events_received = events_received end unless .nil? self. = end unless fbtrace_id.nil? self.fbtrace_id = fbtrace_id end end |
Instance Attribute Details
#events_received ⇒ Object
number of events received.
25 26 27 |
# File 'lib/facebook_ads/ad_objects/server_side/event_response.rb', line 25 def events_received @events_received end |
#fbtrace_id ⇒ Object
Facebook API trace id
31 32 33 |
# File 'lib/facebook_ads/ad_objects/server_side/event_response.rb', line 31 def fbtrace_id @fbtrace_id end |
#messages ⇒ Object
Response message
28 29 30 |
# File 'lib/facebook_ads/ad_objects/server_side/event_response.rb', line 28 def @messages end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
72 73 74 75 76 77 78 |
# File 'lib/facebook_ads/ad_objects/server_side/event_response.rb', line 72 def ==(o) return true if self.equal?(o) self.class == o.class && events_received == o.events_received && == o. && fbtrace_id == o.fbtrace_id end |
#build(attributes = {}) ⇒ Object
build the object using the input hash
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/facebook_ads/ad_objects/server_side/event_response.rb', line 50 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?(:'events_received') self.events_received = attributes[:'events_received'] end if attributes.has_key?(:'messages') if (value = attributes[:'messages']).is_a?(Array) self. = value end end if attributes.has_key?(:'fbtrace_id') self.fbtrace_id = attributes[:'fbtrace_id'] end end |
#eql?(o) ⇒ Boolean
81 82 83 |
# File 'lib/facebook_ads/ad_objects/server_side/event_response.rb', line 81 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
87 88 89 |
# File 'lib/facebook_ads/ad_objects/server_side/event_response.rb', line 87 def hash [events_received, , fbtrace_id].hash end |
#to_s ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/facebook_ads/ad_objects/server_side/event_response.rb', line 91 def to_s hash = {} unless events_received.nil? hash['events_received'] = events_received end unless .nil? hash['messages'] = end unless fbtrace_id.nil? hash['fbtrace_id'] = fbtrace_id end hash.to_s end |