Class: FacebookAds::ServerSide::Preference
- Inherits:
-
Object
- Object
- FacebookAds::ServerSide::Preference
- Defined in:
- lib/facebook_ads/ad_objects/server_side/preference.rb
Overview
Preference is an allowlist specifying which fields are allowed to be automatically set on the CAPI event from the request context object. All fields default to true.
Instance Attribute Summary collapse
-
#is_client_ip_address_allowed ⇒ Object
Whether client_ip_address is allowed to be set from the request context.
-
#is_event_source_url_allowed ⇒ Object
Whether event_source_url is allowed to be set from the request context.
-
#is_fbc_allowed ⇒ Object
Whether fbc is allowed to be set from the request context.
-
#is_fbp_allowed ⇒ Object
Whether fbp is allowed to be set from the request context.
-
#is_referrer_url_allowed ⇒ Object
Whether referrer_url is allowed to be set from the request context.
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(is_fbc_allowed: true, is_fbp_allowed: true, is_client_ip_address_allowed: true, is_referrer_url_allowed: true, is_event_source_url_allowed: true) ⇒ Preference
constructor
A new instance of Preference.
-
#normalize ⇒ Object
Normalize input fields to a hash.
- #to_s ⇒ Object
Constructor Details
#initialize(is_fbc_allowed: true, is_fbp_allowed: true, is_client_ip_address_allowed: true, is_referrer_url_allowed: true, is_event_source_url_allowed: true) ⇒ Preference
Returns a new instance of Preference.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/facebook_ads/ad_objects/server_side/preference.rb', line 47 def initialize(is_fbc_allowed: true, is_fbp_allowed: true, is_client_ip_address_allowed: true, is_referrer_url_allowed: true, is_event_source_url_allowed: true) self.is_fbc_allowed = is_fbc_allowed self.is_fbp_allowed = is_fbp_allowed self.is_client_ip_address_allowed = is_client_ip_address_allowed self.is_referrer_url_allowed = is_referrer_url_allowed self.is_event_source_url_allowed = is_event_source_url_allowed end |
Instance Attribute Details
#is_client_ip_address_allowed ⇒ Object
Whether client_ip_address is allowed to be set from the request context.
34 35 36 |
# File 'lib/facebook_ads/ad_objects/server_side/preference.rb', line 34 def is_client_ip_address_allowed @is_client_ip_address_allowed end |
#is_event_source_url_allowed ⇒ Object
Whether event_source_url is allowed to be set from the request context.
40 41 42 |
# File 'lib/facebook_ads/ad_objects/server_side/preference.rb', line 40 def is_event_source_url_allowed @is_event_source_url_allowed end |
#is_fbc_allowed ⇒ Object
Whether fbc is allowed to be set from the request context.
28 29 30 |
# File 'lib/facebook_ads/ad_objects/server_side/preference.rb', line 28 def is_fbc_allowed @is_fbc_allowed end |
#is_fbp_allowed ⇒ Object
Whether fbp is allowed to be set from the request context.
31 32 33 |
# File 'lib/facebook_ads/ad_objects/server_side/preference.rb', line 31 def is_fbp_allowed @is_fbp_allowed end |
#is_referrer_url_allowed ⇒ Object
Whether referrer_url is allowed to be set from the request context.
37 38 39 |
# File 'lib/facebook_ads/ad_objects/server_side/preference.rb', line 37 def is_referrer_url_allowed @is_referrer_url_allowed end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
89 90 91 92 93 94 95 96 97 |
# File 'lib/facebook_ads/ad_objects/server_side/preference.rb', line 89 def ==(o) return true if self.equal?(o) self.class == o.class && is_fbc_allowed == o.is_fbc_allowed && is_fbp_allowed == o.is_fbp_allowed && is_client_ip_address_allowed == o.is_client_ip_address_allowed && is_referrer_url_allowed == o.is_referrer_url_allowed && is_event_source_url_allowed == o.is_event_source_url_allowed end |
#build(attributes = {}) ⇒ Object
build the object using the input hash
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/facebook_ads/ad_objects/server_side/preference.rb', line 61 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?(:'is_fbc_allowed') self.is_fbc_allowed = attributes[:'is_fbc_allowed'] end if attributes.has_key?(:'is_fbp_allowed') self.is_fbp_allowed = attributes[:'is_fbp_allowed'] end if attributes.has_key?(:'is_client_ip_address_allowed') self.is_client_ip_address_allowed = attributes[:'is_client_ip_address_allowed'] end if attributes.has_key?(:'is_referrer_url_allowed') self.is_referrer_url_allowed = attributes[:'is_referrer_url_allowed'] end if attributes.has_key?(:'is_event_source_url_allowed') self.is_event_source_url_allowed = attributes[:'is_event_source_url_allowed'] end end |
#eql?(o) ⇒ Boolean
100 101 102 |
# File 'lib/facebook_ads/ad_objects/server_side/preference.rb', line 100 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
106 107 108 109 110 111 112 |
# File 'lib/facebook_ads/ad_objects/server_side/preference.rb', line 106 def hash [ is_fbc_allowed, is_fbp_allowed, is_client_ip_address_allowed, is_referrer_url_allowed, is_event_source_url_allowed, ].hash end |
#normalize ⇒ Object
Normalize input fields to a hash.
125 126 127 128 129 130 131 132 133 |
# File 'lib/facebook_ads/ad_objects/server_side/preference.rb', line 125 def normalize { 'is_fbc_allowed' => is_fbc_allowed, 'is_fbp_allowed' => is_fbp_allowed, 'is_client_ip_address_allowed' => is_client_ip_address_allowed, 'is_referrer_url_allowed' => is_referrer_url_allowed, 'is_event_source_url_allowed' => is_event_source_url_allowed, } end |
#to_s ⇒ Object
114 115 116 117 118 119 120 121 122 |
# File 'lib/facebook_ads/ad_objects/server_side/preference.rb', line 114 def to_s { 'is_fbc_allowed' => is_fbc_allowed, 'is_fbp_allowed' => is_fbp_allowed, 'is_client_ip_address_allowed' => is_client_ip_address_allowed, 'is_referrer_url_allowed' => is_referrer_url_allowed, 'is_event_source_url_allowed' => is_event_source_url_allowed, }.to_s end |