Class: FacebookAds::ServerSide::AttributionSetting
- Inherits:
-
Object
- Object
- FacebookAds::ServerSide::AttributionSetting
- Defined in:
- lib/facebook_ads/ad_objects/server_side/attribution_setting.rb
Overview
AttributionSetting contains attribution window settings used for attribution.
Instance Attribute Summary collapse
-
#inactivity_window_hours ⇒ Object
Inactivity window in hours.
-
#reattribution_window_hours ⇒ Object
Reattribution window in hours.
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(inactivity_window_hours: nil, reattribution_window_hours: nil) ⇒ AttributionSetting
constructor
A new instance of AttributionSetting.
-
#normalize ⇒ Object
Normalize input fields to server request format.
- #to_s ⇒ Object
Constructor Details
#initialize(inactivity_window_hours: nil, reattribution_window_hours: nil) ⇒ AttributionSetting
Returns a new instance of AttributionSetting.
34 35 36 37 38 39 40 41 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_setting.rb', line 34 def initialize(inactivity_window_hours: nil, reattribution_window_hours: nil) unless inactivity_window_hours.nil? self.inactivity_window_hours = inactivity_window_hours end unless reattribution_window_hours.nil? self.reattribution_window_hours = reattribution_window_hours end end |
Instance Attribute Details
#inactivity_window_hours ⇒ Object
Inactivity window in hours.
26 27 28 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_setting.rb', line 26 def inactivity_window_hours @inactivity_window_hours end |
#reattribution_window_hours ⇒ Object
Reattribution window in hours.
29 30 31 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_setting.rb', line 29 def reattribution_window_hours @reattribution_window_hours 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/attribution_setting.rb', line 61 def ==(o) return true if self.equal?(o) self.class == o.class && inactivity_window_hours == o.inactivity_window_hours && reattribution_window_hours == o.reattribution_window_hours 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/attribution_setting.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?(:'inactivity_window_hours') self.inactivity_window_hours = attributes[:'inactivity_window_hours'] end if attributes.has_key?(:'reattribution_window_hours') self.reattribution_window_hours = attributes[:'reattribution_window_hours'] end end |
#eql?(o) ⇒ Boolean
69 70 71 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_setting.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/attribution_setting.rb', line 75 def hash [ inactivity_window_hours, reattribution_window_hours ].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/attribution_setting.rb', line 94 def normalize hash = {} unless inactivity_window_hours.nil? hash['inactivity_window_hours'] = inactivity_window_hours end unless reattribution_window_hours.nil? hash['reattribution_window_hours'] = reattribution_window_hours end hash end |
#to_s ⇒ Object
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_setting.rb', line 81 def to_s hash = {} unless inactivity_window_hours.nil? hash['inactivity_window_hours'] = inactivity_window_hours end unless reattribution_window_hours.nil? hash['reattribution_window_hours'] = reattribution_window_hours end hash.to_s end |