facebookbusiness 0.7.0.1 → 0.8.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/facebook_ads/ad_objects/ad_account.rb +16 -19
- data/lib/facebook_ads/ad_objects/ad_account_ad_volume.rb +23 -0
- data/lib/facebook_ads/ad_objects/ad_account_delivery_estimate.rb +1 -0
- data/lib/facebook_ads/ad_objects/ad_account_matched_search_applications_edge_data.rb +1 -0
- data/lib/facebook_ads/ad_objects/ad_account_targeting_unified.rb +1 -0
- data/lib/facebook_ads/ad_objects/ad_activity.rb +7 -0
- data/lib/facebook_ads/ad_objects/ad_asset_feed_spec.rb +2 -0
- data/lib/facebook_ads/ad_objects/ad_campaign_activity.rb +2 -2
- data/lib/facebook_ads/ad_objects/ad_campaign_delivery_estimate.rb +1 -0
- data/lib/facebook_ads/ad_objects/ad_creative.rb +1 -0
- data/lib/facebook_ads/ad_objects/{atlas_url.rb → ad_creative_instagram_branded_content.rb} +1 -2
- data/lib/facebook_ads/ad_objects/ad_creative_interactive_components_spec.rb +1 -0
- data/lib/facebook_ads/ad_objects/ad_creative_link_data_call_to_action.rb +1 -0
- data/lib/facebook_ads/ad_objects/ad_network_analytics_sync_query_result.rb +1 -0
- data/lib/facebook_ads/ad_objects/ad_place_page_set.rb +6 -0
- data/lib/facebook_ads/ad_objects/ad_preview.rb +0 -1
- data/lib/facebook_ads/ad_objects/ad_report_spec.rb +0 -1
- data/lib/facebook_ads/ad_objects/ad_set.rb +2 -0
- data/lib/facebook_ads/ad_objects/ad_study.rb +2 -0
- data/lib/facebook_ads/ad_objects/ad_video.rb +12 -27
- data/lib/facebook_ads/ad_objects/adgroup_placement_specific_review_feedback.rb +4 -0
- data/lib/facebook_ads/ad_objects/{ads_interest.rb → adoptable_pet.rb} +19 -5
- data/lib/facebook_ads/ad_objects/ads_insights.rb +4 -0
- data/lib/facebook_ads/ad_objects/ads_pixel.rb +3 -0
- data/lib/facebook_ads/ad_objects/application.rb +26 -0
- data/lib/facebook_ads/ad_objects/atlas_campaign.rb +3 -3
- data/lib/facebook_ads/ad_objects/automotive_model.rb +1 -0
- data/lib/facebook_ads/ad_objects/business.rb +46 -117
- data/lib/facebook_ads/ad_objects/business_asset_group.rb +2 -3
- data/lib/facebook_ads/ad_objects/business_role_request.rb +9 -0
- data/lib/facebook_ads/ad_objects/business_unit.rb +1 -1
- data/lib/facebook_ads/ad_objects/business_user.rb +9 -0
- data/lib/facebook_ads/ad_objects/campaign.rb +257 -0
- data/lib/facebook_ads/ad_objects/catalog_sub_vertical_list.rb +88 -0
- data/lib/facebook_ads/ad_objects/commerce_merchant_settings.rb +27 -0
- data/lib/facebook_ads/ad_objects/commerce_order.rb +6 -0
- data/lib/facebook_ads/ad_objects/commerce_order_transaction_detail.rb +4 -0
- data/lib/facebook_ads/ad_objects/{creative_asset_tag.rb → connections_targeting.rb} +2 -2
- data/lib/facebook_ads/ad_objects/{business_creative_folder_sharing_agreement.rb → cpas_advertiser_partnership_recommendation.rb} +8 -11
- data/lib/facebook_ads/ad_objects/{brand_audience.rb → cpas_collaboration_request.rb} +15 -9
- data/lib/facebook_ads/ad_objects/custom_audience_data_source.rb +1 -0
- data/lib/facebook_ads/ad_objects/da_check.rb +7 -0
- data/lib/facebook_ads/ad_objects/destination.rb +1 -0
- data/lib/facebook_ads/ad_objects/event.rb +12 -1
- data/lib/facebook_ads/ad_objects/extended_credit.rb +7 -0
- data/lib/facebook_ads/ad_objects/external_event_source.rb +1 -0
- data/lib/facebook_ads/ad_objects/flight.rb +1 -0
- data/lib/facebook_ads/ad_objects/group.rb +10 -1
- data/lib/facebook_ads/ad_objects/home_listing.rb +1 -0
- data/lib/facebook_ads/ad_objects/hotel.rb +1 -0
- data/lib/facebook_ads/ad_objects/ig_media.rb +1 -0
- data/lib/facebook_ads/ad_objects/life_event.rb +0 -4
- data/lib/facebook_ads/ad_objects/link.rb +0 -6
- data/lib/facebook_ads/ad_objects/live_video.rb +12 -16
- data/lib/facebook_ads/ad_objects/media_fingerprint.rb +0 -1
- data/lib/facebook_ads/ad_objects/native_offer_view.rb +0 -1
- data/lib/facebook_ads/ad_objects/oracle_transaction.rb +0 -7
- data/lib/facebook_ads/ad_objects/page.rb +34 -65
- data/lib/facebook_ads/ad_objects/page_admin_note.rb +1 -0
- data/lib/facebook_ads/ad_objects/page_call_to_action.rb +3 -0
- data/lib/facebook_ads/ad_objects/page_change_proposal.rb +2 -0
- data/lib/facebook_ads/ad_objects/page_post.rb +2 -0
- data/lib/facebook_ads/ad_objects/{business_creative.rb → payment_subscription.rb} +24 -16
- data/lib/facebook_ads/ad_objects/photo.rb +6 -0
- data/lib/facebook_ads/ad_objects/post.rb +4 -2
- data/lib/facebook_ads/ad_objects/product_catalog.rb +42 -0
- data/lib/facebook_ads/ad_objects/product_feed.rb +31 -0
- data/lib/facebook_ads/ad_objects/product_group.rb +1 -0
- data/lib/facebook_ads/ad_objects/product_item.rb +2 -0
- data/lib/facebook_ads/ad_objects/product_set.rb +4 -0
- data/lib/facebook_ads/ad_objects/{client_transparency_status.rb → product_set_metadata.rb} +5 -5
- data/lib/facebook_ads/ad_objects/profile.rb +1 -0
- data/lib/facebook_ads/ad_objects/profile_picture_source.rb +4 -0
- data/lib/facebook_ads/ad_objects/publisher_block_list.rb +6 -0
- data/lib/facebook_ads/ad_objects/saved_audience.rb +1 -0
- data/lib/facebook_ads/ad_objects/security_settings.rb +0 -1
- data/lib/facebook_ads/ad_objects/server_side/batch_processor.rb +73 -0
- data/lib/facebook_ads/ad_objects/server_side/content.rb +75 -13
- data/lib/facebook_ads/ad_objects/server_side/custom_data.rb +45 -6
- data/lib/facebook_ads/ad_objects/server_side/delivery_category.rb +33 -0
- data/lib/facebook_ads/ad_objects/server_side/event.rb +62 -3
- data/lib/facebook_ads/ad_objects/server_side/event_request.rb +134 -13
- data/lib/facebook_ads/ad_objects/server_side/event_request_async.rb +43 -0
- data/lib/facebook_ads/ad_objects/{whats_app_business_profile.rb → server_side/http_method.rb} +7 -15
- data/lib/facebook_ads/ad_objects/server_side/http_service_interface.rb +33 -0
- data/lib/facebook_ads/ad_objects/server_side/http_util.rb +31 -0
- data/lib/facebook_ads/ad_objects/server_side/user_data.rb +145 -17
- data/lib/facebook_ads/ad_objects/server_side/util.rb +216 -149
- data/lib/facebook_ads/ad_objects/system_user.rb +9 -4
- data/lib/facebook_ads/ad_objects/targeting.rb +4 -3
- data/lib/facebook_ads/ad_objects/{user_influence.rb → targeting_relaxation.rb} +2 -4
- data/lib/facebook_ads/ad_objects/third_party_measurement_report_dataset.rb +1 -0
- data/lib/facebook_ads/ad_objects/unified_thread.rb +1 -0
- data/lib/facebook_ads/ad_objects/user.rb +9 -15
- data/lib/facebook_ads/ad_objects/vehicle.rb +1 -0
- data/lib/facebook_ads/ad_objects/vehicle_offer.rb +1 -0
- data/lib/facebook_ads/ad_objects/whats_app_business_account.rb +22 -0
- data/lib/facebook_ads/errors.rb +1 -1
- data/lib/facebook_ads/version.rb +2 -2
- metadata +64 -25
- data/lib/facebook_ads/ad_objects/business_creative_folder.rb +0 -79
- data/lib/facebook_ads/ad_objects/business_image.rb +0 -95
- data/lib/facebook_ads/ad_objects/iterative_split_test_config.rb +0 -43
- data/lib/facebook_ads/ad_objects/messenger_platform_referral.rb +0 -39
- data/lib/facebook_ads/ad_objects/page_about_story.rb +0 -39
- data/lib/facebook_ads/ad_objects/split_test_config.rb +0 -41
- data/lib/facebook_ads/ad_objects/streaming_reaction.rb +0 -51
- data/lib/facebook_ads/ad_objects/user_taggable_friend.rb +0 -49
@@ -22,20 +22,23 @@ module FacebookAds
|
|
22
22
|
# Content object contains information about the products.
|
23
23
|
class Content
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
attr_accessor :item_price
|
25
|
+
attr_accessor :product_id,
|
26
|
+
:quantity,
|
27
|
+
:item_price,
|
28
|
+
:title,
|
29
|
+
:description,
|
30
|
+
:brand,
|
31
|
+
:category
|
33
32
|
|
34
33
|
# Initializes the object
|
35
34
|
# @param [String] product_id
|
36
35
|
# @param [Integer] quantity
|
37
36
|
# @param [Float] item_price
|
38
|
-
|
37
|
+
# @param [String] title
|
38
|
+
# @param [String] description
|
39
|
+
# @param [String] brand
|
40
|
+
# @param [String] category
|
41
|
+
def initialize(product_id: nil, quantity: nil, item_price: nil, title: nil, description: nil, brand: nil, category: nil)
|
39
42
|
unless product_id.nil?
|
40
43
|
self.product_id = String(product_id)
|
41
44
|
end
|
@@ -45,6 +48,18 @@ module FacebookAds
|
|
45
48
|
unless item_price.nil?
|
46
49
|
self.item_price = Float(item_price)
|
47
50
|
end
|
51
|
+
unless title.nil?
|
52
|
+
self.title = String(title)
|
53
|
+
end
|
54
|
+
unless description.nil?
|
55
|
+
self.description = String(description)
|
56
|
+
end
|
57
|
+
unless brand.nil?
|
58
|
+
self.brand = String(brand)
|
59
|
+
end
|
60
|
+
unless category.nil?
|
61
|
+
self.category = String(category)
|
62
|
+
end
|
48
63
|
end
|
49
64
|
|
50
65
|
# build the object using the input hash
|
@@ -66,15 +81,34 @@ module FacebookAds
|
|
66
81
|
if attributes.has_key?(:'item_price')
|
67
82
|
self.item_price = attributes[:'item_price']
|
68
83
|
end
|
84
|
+
|
85
|
+
if attributes.has_key?(:'title')
|
86
|
+
self.title = attributes[:'title']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.has_key?(:'description')
|
90
|
+
self.description = attributes[:'description']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.has_key?(:'brand')
|
94
|
+
self.brand = attributes[:'brand']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.has_key?(:'category')
|
98
|
+
self.category = attributes[:'category']
|
99
|
+
end
|
69
100
|
end
|
70
101
|
|
71
102
|
# Checks equality by comparing each attribute.
|
72
103
|
def ==(o)
|
73
|
-
return
|
74
|
-
self.class == o.class &&
|
104
|
+
return self.class == o.class &&
|
75
105
|
product_id == o.product_id &&
|
76
106
|
quantity == o.quantity &&
|
77
|
-
item_price == o.item_price
|
107
|
+
item_price == o.item_price &&
|
108
|
+
title == o.title &&
|
109
|
+
description == o.description &&
|
110
|
+
brand == o.brand &&
|
111
|
+
category == o.category
|
78
112
|
end
|
79
113
|
|
80
114
|
# @see the `==` method
|
@@ -88,7 +122,11 @@ module FacebookAds
|
|
88
122
|
[
|
89
123
|
product_id,
|
90
124
|
quantity,
|
91
|
-
item_price
|
125
|
+
item_price,
|
126
|
+
title,
|
127
|
+
description,
|
128
|
+
brand,
|
129
|
+
category
|
92
130
|
].hash
|
93
131
|
end
|
94
132
|
|
@@ -106,6 +144,18 @@ module FacebookAds
|
|
106
144
|
unless item_price.nil?
|
107
145
|
hash['item_price'] = item_price
|
108
146
|
end
|
147
|
+
unless title.nil?
|
148
|
+
hash['title'] = title
|
149
|
+
end
|
150
|
+
unless description.nil?
|
151
|
+
hash['description'] = description
|
152
|
+
end
|
153
|
+
unless brand.nil?
|
154
|
+
hash['brand'] = brand
|
155
|
+
end
|
156
|
+
unless category.nil?
|
157
|
+
hash['category'] = category
|
158
|
+
end
|
109
159
|
hash.to_s
|
110
160
|
end
|
111
161
|
|
@@ -121,6 +171,18 @@ module FacebookAds
|
|
121
171
|
unless item_price.nil?
|
122
172
|
hash['item_price'] = item_price
|
123
173
|
end
|
174
|
+
unless title.nil?
|
175
|
+
hash['title'] = title
|
176
|
+
end
|
177
|
+
unless description.nil?
|
178
|
+
hash['description'] = description
|
179
|
+
end
|
180
|
+
unless brand.nil?
|
181
|
+
hash['brand'] = brand
|
182
|
+
end
|
183
|
+
unless category.nil?
|
184
|
+
hash['category'] = category
|
185
|
+
end
|
124
186
|
hash
|
125
187
|
end
|
126
188
|
end
|
@@ -69,7 +69,15 @@ module FacebookAds
|
|
69
69
|
# Use only with Search events. A search query made by a user.
|
70
70
|
# Example: 'lettuce'.
|
71
71
|
attr_accessor :search_string
|
72
|
-
|
72
|
+
|
73
|
+
# Type of delivery for a purchase event
|
74
|
+
# Example: 'home_delivery'.
|
75
|
+
attr_accessor :delivery_category
|
76
|
+
|
77
|
+
# The item number.
|
78
|
+
# Example: 'item1234'.
|
79
|
+
attr_accessor :item_number
|
80
|
+
|
73
81
|
# Custom Properties bag for storing other custom fields
|
74
82
|
attr_accessor :custom_properties
|
75
83
|
|
@@ -86,6 +94,8 @@ module FacebookAds
|
|
86
94
|
# @param [Integer] num_items
|
87
95
|
# @param [String] status
|
88
96
|
# @param [String] search_string
|
97
|
+
# @param [String] delivery_category
|
98
|
+
# @param [String] item_number
|
89
99
|
# @param [String] custom_properties
|
90
100
|
def initialize(value: nil,
|
91
101
|
currency: nil,
|
@@ -99,6 +109,8 @@ module FacebookAds
|
|
99
109
|
num_items: nil,
|
100
110
|
status: nil,
|
101
111
|
search_string: nil,
|
112
|
+
delivery_category: nil,
|
113
|
+
item_number: nil,
|
102
114
|
custom_properties: {})
|
103
115
|
|
104
116
|
unless value.nil?
|
@@ -137,6 +149,12 @@ module FacebookAds
|
|
137
149
|
unless search_string.nil?
|
138
150
|
self.search_string = search_string
|
139
151
|
end
|
152
|
+
unless delivery_category.nil?
|
153
|
+
self.delivery_category = delivery_category
|
154
|
+
end
|
155
|
+
unless item_number.nil?
|
156
|
+
self.item_number = item_number
|
157
|
+
end
|
140
158
|
unless custom_properties.nil?
|
141
159
|
self.custom_properties = custom_properties
|
142
160
|
end
|
@@ -203,6 +221,14 @@ module FacebookAds
|
|
203
221
|
self.search_string = attributes[:'search_string']
|
204
222
|
end
|
205
223
|
|
224
|
+
if attributes.has_key?(:'delivery_category')
|
225
|
+
self.delivery_category = attributes[:'delivery_category']
|
226
|
+
end
|
227
|
+
|
228
|
+
if attributes.has_key?(:'item_number')
|
229
|
+
self.item_number = attributes[:'item_number']
|
230
|
+
end
|
231
|
+
|
206
232
|
if attributes.has_key?(:'custom_properties')
|
207
233
|
self.custom_properties = attributes[:'custom_properties']
|
208
234
|
end
|
@@ -224,6 +250,8 @@ module FacebookAds
|
|
224
250
|
num_items == o.num_items &&
|
225
251
|
status == o.status &&
|
226
252
|
search_string == o.search_string &&
|
253
|
+
delivery_category == o.delivery_category &&
|
254
|
+
item_number == o.item_number &&
|
227
255
|
custom_properties == o.custom_properties
|
228
256
|
end
|
229
257
|
|
@@ -248,6 +276,8 @@ module FacebookAds
|
|
248
276
|
num_items,
|
249
277
|
status,
|
250
278
|
search_string,
|
279
|
+
delivery_category,
|
280
|
+
item_number,
|
251
281
|
custom_properties
|
252
282
|
].hash
|
253
283
|
end
|
@@ -292,25 +322,28 @@ module FacebookAds
|
|
292
322
|
unless search_string.nil?
|
293
323
|
hash['search_string'] = search_string
|
294
324
|
end
|
325
|
+
unless delivery_category.nil?
|
326
|
+
hash['delivery_category'] = delivery_category
|
327
|
+
end
|
295
328
|
unless custom_properties.nil?
|
296
329
|
hash['custom_properties'] = custom_properties
|
297
|
-
end
|
330
|
+
end
|
298
331
|
hash.to_s
|
299
332
|
end
|
300
333
|
|
301
334
|
# Add other custom fields to custom properties.
|
302
335
|
def add_custom_property(key, value)
|
303
|
-
custom_properties[key] = value;
|
336
|
+
custom_properties[key] = value;
|
304
337
|
end
|
305
338
|
|
306
339
|
# Normalize input fields to server request format.
|
307
|
-
def normalize
|
340
|
+
def normalize
|
308
341
|
hash = {}
|
309
342
|
unless value.nil?
|
310
343
|
hash['value'] = value
|
311
344
|
end
|
312
345
|
unless currency.nil?
|
313
|
-
hash['currency'] = FacebookAds::ServerSide::normalize(currency, 'currency')
|
346
|
+
hash['currency'] = FacebookAds::ServerSide::Util.normalize(currency, 'currency')
|
314
347
|
end
|
315
348
|
unless content_name.nil?
|
316
349
|
hash['content_name'] = content_name
|
@@ -339,6 +372,12 @@ module FacebookAds
|
|
339
372
|
unless search_string.nil?
|
340
373
|
hash['search_string'] = search_string
|
341
374
|
end
|
375
|
+
unless delivery_category.nil?
|
376
|
+
hash['delivery_category'] = FacebookAds::ServerSide::Util.normalize(delivery_category, 'delivery_category')
|
377
|
+
end
|
378
|
+
unless item_number.nil?
|
379
|
+
hash['item_number'] = item_number
|
380
|
+
end
|
342
381
|
|
343
382
|
unless contents.nil?
|
344
383
|
content_array = []
|
@@ -348,7 +387,7 @@ module FacebookAds
|
|
348
387
|
hash['contents'] = content_array
|
349
388
|
end
|
350
389
|
|
351
|
-
hash.merge!(custom_properties) unless custom_properties.nil?
|
390
|
+
hash.merge!(custom_properties) unless custom_properties.nil?
|
352
391
|
hash
|
353
392
|
end
|
354
393
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
4
|
+
# copy, modify, and distribute this software in source code or binary form for use
|
5
|
+
# in connection with the web services and APIs provided by Facebook.
|
6
|
+
#
|
7
|
+
# As with any software that integrates with the Facebook platform, your use of
|
8
|
+
# this software is subject to the Facebook Platform Policy
|
9
|
+
# [http://developers.facebook.com/policy/]. This copyright notice shall be
|
10
|
+
# included in all copies or substantial portions of the software.
|
11
|
+
#
|
12
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
14
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
15
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
16
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
17
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
18
|
+
|
19
|
+
module FacebookAds
|
20
|
+
module ServerSide
|
21
|
+
DeliveryCategory = Set[
|
22
|
+
|
23
|
+
# Customer needs to enter the store to get the purchased product.
|
24
|
+
'in_store',
|
25
|
+
|
26
|
+
# Customer picks up their order by driving to a store and waiting inside their vehicle.
|
27
|
+
'curbside',
|
28
|
+
|
29
|
+
# Purchase is delivered to the customer's home.
|
30
|
+
'home_delivery'
|
31
|
+
]
|
32
|
+
end
|
33
|
+
end
|
@@ -52,6 +52,17 @@ module FacebookAds
|
|
52
52
|
# An Object that includes additional business data about the event.
|
53
53
|
attr_accessor :custom_data
|
54
54
|
|
55
|
+
# Processing options you would like to enable for a specific event.
|
56
|
+
# For more details see https://developers.facebook.com/docs/marketing-apis/data-processing-options
|
57
|
+
attr_accessor :data_processing_options
|
58
|
+
|
59
|
+
# A country that you want to associate to this data processing option
|
60
|
+
# For more details see https://developers.facebook.com/docs/marketing-apis/data-processing-options
|
61
|
+
attr_accessor :data_processing_options_country
|
62
|
+
|
63
|
+
# A state that you want to associate with this data processing option.
|
64
|
+
# For more details see https://developers.facebook.com/docs/marketing-apis/data-processing-options
|
65
|
+
attr_accessor :data_processing_options_state
|
55
66
|
|
56
67
|
# @param [String] event_name
|
57
68
|
# @param [int] event_time
|
@@ -60,13 +71,19 @@ module FacebookAds
|
|
60
71
|
# @param [String] event_id
|
61
72
|
# @param [FacebookAds::ServerSide::UserData] user_data
|
62
73
|
# @param [FacebookAds::ServerSide::CustomData] custom_data
|
74
|
+
# @param [Array<String>] data_processing_options
|
75
|
+
# @param [int] data_processing_options_country
|
76
|
+
# @param [int] data_processing_options_state
|
63
77
|
def initialize(event_name: nil,
|
64
78
|
event_time: nil,
|
65
79
|
event_source_url: nil,
|
66
80
|
opt_out: nil,
|
67
81
|
event_id: nil,
|
68
82
|
user_data: nil,
|
69
|
-
custom_data: nil
|
83
|
+
custom_data: nil,
|
84
|
+
data_processing_options: nil,
|
85
|
+
data_processing_options_country: nil,
|
86
|
+
data_processing_options_state: nil)
|
70
87
|
|
71
88
|
unless event_name.nil?
|
72
89
|
self.event_name = event_name
|
@@ -89,6 +106,15 @@ module FacebookAds
|
|
89
106
|
unless custom_data.nil?
|
90
107
|
self.custom_data = custom_data
|
91
108
|
end
|
109
|
+
unless data_processing_options.nil?
|
110
|
+
self.data_processing_options = data_processing_options
|
111
|
+
end
|
112
|
+
unless data_processing_options_country.nil?
|
113
|
+
self.data_processing_options_country = data_processing_options_country
|
114
|
+
end
|
115
|
+
unless data_processing_options_state.nil?
|
116
|
+
self.data_processing_options_state = data_processing_options_state
|
117
|
+
end
|
92
118
|
end
|
93
119
|
|
94
120
|
# build the object using the input hash
|
@@ -126,6 +152,18 @@ module FacebookAds
|
|
126
152
|
if attributes.has_key?(:'custom_data')
|
127
153
|
self.custom_data = attributes[:'custom_data']
|
128
154
|
end
|
155
|
+
|
156
|
+
if attributes.has_key?(:'data_processing_options')
|
157
|
+
self.custom_data = attributes[:'data_processing_options']
|
158
|
+
end
|
159
|
+
|
160
|
+
if attributes.has_key?(:'data_processing_options_country')
|
161
|
+
self.custom_data = attributes[:'data_processing_options_country']
|
162
|
+
end
|
163
|
+
|
164
|
+
if attributes.has_key?(:'data_processing_options_state')
|
165
|
+
self.custom_data = attributes[:'data_processing_options_state']
|
166
|
+
end
|
129
167
|
end
|
130
168
|
|
131
169
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -166,7 +204,10 @@ module FacebookAds
|
|
166
204
|
opt_out == o.opt_out &&
|
167
205
|
event_id == o.event_id &&
|
168
206
|
user_data == o.user_data &&
|
169
|
-
custom_data == o.custom_data
|
207
|
+
custom_data == o.custom_data &&
|
208
|
+
data_processing_options == o.data_processing_options &&
|
209
|
+
data_processing_options_country == o.data_processing_options_country &&
|
210
|
+
data_processing_options_state == o.data_processing_options_state
|
170
211
|
end
|
171
212
|
|
172
213
|
# @see the `==` method
|
@@ -177,7 +218,7 @@ module FacebookAds
|
|
177
218
|
# Calculates hash code according to all attributes.
|
178
219
|
# @return [Fixnum] Hash code
|
179
220
|
def hash
|
180
|
-
[event_name, event_time, event_source_url, opt_out, event_id, user_data, custom_data].hash
|
221
|
+
[event_name, event_time, event_source_url, opt_out, event_id, user_data, custom_data, data_processing_options, data_processing_options_country, data_processing_options_state].hash
|
181
222
|
end
|
182
223
|
|
183
224
|
def to_s
|
@@ -203,6 +244,15 @@ module FacebookAds
|
|
203
244
|
unless custom_data.nil?
|
204
245
|
hash['custom_data'] = custom_data.to_s
|
205
246
|
end
|
247
|
+
unless data_processing_options.nil?
|
248
|
+
hash['data_processing_options'] = data_processing_options.to_s
|
249
|
+
end
|
250
|
+
unless data_processing_options_country.nil?
|
251
|
+
hash['data_processing_options_country'] = data_processing_options_country.to_s
|
252
|
+
end
|
253
|
+
unless data_processing_options_state.nil?
|
254
|
+
hash['data_processing_options_state'] = data_processing_options_state.to_s
|
255
|
+
end
|
206
256
|
hash.to_s
|
207
257
|
end
|
208
258
|
|
@@ -231,6 +281,15 @@ module FacebookAds
|
|
231
281
|
unless custom_data.nil?
|
232
282
|
hash['custom_data'] = custom_data.normalize
|
233
283
|
end
|
284
|
+
unless data_processing_options.nil?
|
285
|
+
hash['data_processing_options'] = data_processing_options
|
286
|
+
end
|
287
|
+
unless data_processing_options_country.nil?
|
288
|
+
hash['data_processing_options_country'] = data_processing_options_country
|
289
|
+
end
|
290
|
+
unless data_processing_options_state.nil?
|
291
|
+
hash['data_processing_options_state'] = data_processing_options_state
|
292
|
+
end
|
234
293
|
hash
|
235
294
|
end
|
236
295
|
|
@@ -39,11 +39,33 @@ module FacebookAds
|
|
39
39
|
# Platform from which the event is sent e.g. wordpress
|
40
40
|
attr_accessor :partner_agent
|
41
41
|
|
42
|
+
# Scope used to resolve extern_id or Third-party ID. Can be another data set or data partner ID.
|
43
|
+
attr_accessor :namespace_id
|
44
|
+
|
45
|
+
# Unique id used to denote the current set being uploaded.
|
46
|
+
attr_accessor :upload_id
|
47
|
+
|
48
|
+
# Tag string added to track your Offline event uploads.
|
49
|
+
attr_accessor :upload_tag
|
50
|
+
|
51
|
+
# The origin/source of data for the dataset to be uploaded.
|
52
|
+
attr_accessor :upload_source
|
53
|
+
|
54
|
+
# The HttpServiceInterface client to use for executing the request.
|
55
|
+
attr_accessor :http_service_client
|
56
|
+
|
42
57
|
# @param [String] pixel_id
|
43
58
|
# @param [Array(FacebookAds::ServerSide::Event)] events
|
44
59
|
# @param [String] test_event_code
|
45
60
|
# @param [String] partner_agent
|
46
|
-
|
61
|
+
# @param [String] namespace_id
|
62
|
+
# @param [String] upload_id
|
63
|
+
# @param [String] upload_tag
|
64
|
+
# @param [String] upload_source
|
65
|
+
# @param [HttpServiceInterface] http_service_client
|
66
|
+
def initialize(pixel_id: nil, events: nil, test_event_code: nil, partner_agent: nil,
|
67
|
+
namespace_id: nil, upload_id: nil, upload_tag: nil, upload_source: nil,
|
68
|
+
http_service_client: nil)
|
47
69
|
unless pixel_id.nil?
|
48
70
|
self.pixel_id = pixel_id
|
49
71
|
end
|
@@ -56,6 +78,21 @@ module FacebookAds
|
|
56
78
|
unless partner_agent.nil?
|
57
79
|
self.partner_agent = partner_agent
|
58
80
|
end
|
81
|
+
unless namespace_id.nil?
|
82
|
+
self.namespace_id = namespace_id
|
83
|
+
end
|
84
|
+
unless upload_id.nil?
|
85
|
+
self.upload_id = upload_id
|
86
|
+
end
|
87
|
+
unless upload_tag.nil?
|
88
|
+
self.upload_tag = upload_tag
|
89
|
+
end
|
90
|
+
unless upload_source.nil?
|
91
|
+
self.upload_source = upload_source
|
92
|
+
end
|
93
|
+
unless http_service_client.nil?
|
94
|
+
self.http_service_client = http_service_client
|
95
|
+
end
|
59
96
|
end
|
60
97
|
|
61
98
|
# build the object using the input hash
|
@@ -83,6 +120,26 @@ module FacebookAds
|
|
83
120
|
if attributes.has_key?(:'partner_agent')
|
84
121
|
self.partner_agent = attributes[:'partner_agent']
|
85
122
|
end
|
123
|
+
|
124
|
+
if attributes.has_key?(:'namespace_id')
|
125
|
+
self.namespace_id = attributes[:'namespace_id']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.has_key?(:'upload_id')
|
129
|
+
self.upload_id = attributes[:'upload_id']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.has_key?(:'upload_tag')
|
133
|
+
self.upload_tag = attributes[:'upload_tag']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.has_key?(:'upload_source')
|
137
|
+
self.upload_source = attributes[:'upload_source']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.has_key?(:'http_service_client')
|
141
|
+
self.http_service_client = attributes[:'http_service_client']
|
142
|
+
end
|
86
143
|
end
|
87
144
|
|
88
145
|
# Execute request
|
@@ -90,15 +147,14 @@ module FacebookAds
|
|
90
147
|
unless valid?
|
91
148
|
raise list_invalid_properties
|
92
149
|
end
|
93
|
-
|
150
|
+
|
151
|
+
if http_service_client
|
152
|
+
return execute_with_client(http_service_client)
|
153
|
+
end
|
154
|
+
params = get_params()
|
155
|
+
params[:data] = normalize
|
94
156
|
ads_pixel = FacebookAds::AdsPixel.get(pixel_id)
|
95
|
-
response = ads_pixel.events.create(
|
96
|
-
{
|
97
|
-
data: normalized_events,
|
98
|
-
test_event_code: test_event_code,
|
99
|
-
partner_agent: partner_agent
|
100
|
-
}
|
101
|
-
)
|
157
|
+
response = ads_pixel.events.create(params)
|
102
158
|
json_response_object = JSON.parse(JSON.generate(response), object_class: OpenStruct)
|
103
159
|
FacebookAds::ServerSide::EventResponse.new(
|
104
160
|
events_received: json_response_object.events_received,
|
@@ -115,6 +171,44 @@ module FacebookAds
|
|
115
171
|
normalized_events
|
116
172
|
end
|
117
173
|
|
174
|
+
def get_params
|
175
|
+
params = {}
|
176
|
+
params[:test_event_code] = test_event_code unless test_event_code.nil?
|
177
|
+
params[:partner_agent] = partner_agent unless partner_agent.nil?
|
178
|
+
params[:namespace_id] = namespace_id unless namespace_id.nil?
|
179
|
+
params[:upload_id] = upload_id unless upload_id.nil?
|
180
|
+
params[:upload_tag] = upload_tag unless upload_tag.nil?
|
181
|
+
params[:upload_source] = upload_source unless upload_source.nil?
|
182
|
+
params
|
183
|
+
end
|
184
|
+
|
185
|
+
def execute_with_client http_client
|
186
|
+
url = [
|
187
|
+
"https://#{FacebookAds::DEFAULT_HOST}",
|
188
|
+
FacebookAds::DEFAULT_API_VERSION,
|
189
|
+
pixel_id,
|
190
|
+
'events',
|
191
|
+
].join('/')
|
192
|
+
headers = {
|
193
|
+
'User-Agent' => "fbbizsdk-ruby-v#{FacebookAds::API_VERSION}"
|
194
|
+
}
|
195
|
+
params = get_params
|
196
|
+
params[:data] = events.map(&:normalize)
|
197
|
+
appsecret = FacebookAds.config.app_secret
|
198
|
+
access_token = FacebookAds.config.access_token
|
199
|
+
params[:access_token] = access_token
|
200
|
+
if appsecret
|
201
|
+
params[:appsecret_proof] = FacebookAds::ServerSide::HttpUtil.appsecret_proof(appsecret, access_token)
|
202
|
+
end
|
203
|
+
|
204
|
+
http_client.execute(
|
205
|
+
url,
|
206
|
+
FacebookAds::ServerSide::HttpMethod::POST,
|
207
|
+
headers,
|
208
|
+
params
|
209
|
+
)
|
210
|
+
end
|
211
|
+
|
118
212
|
# Show invalid properties with the reasons. Usually used together with valid?
|
119
213
|
# @return Array for valid properties with the reasons
|
120
214
|
def list_invalid_properties
|
@@ -137,9 +231,15 @@ module FacebookAds
|
|
137
231
|
def ==(o)
|
138
232
|
return true if self.equal?(o)
|
139
233
|
self.class == o.class &&
|
234
|
+
pixel_id == o.pixel_id &&
|
140
235
|
events == o.events &&
|
141
|
-
test_event_code == o.test_event_code
|
142
|
-
partner_agent == o.partner_agent
|
236
|
+
test_event_code == o.test_event_code &&
|
237
|
+
partner_agent == o.partner_agent &&
|
238
|
+
namespace_id == o.namespace_id &&
|
239
|
+
upload_id == o.upload_id &&
|
240
|
+
upload_tag == o.upload_tag &&
|
241
|
+
upload_source == o.upload_source &&
|
242
|
+
http_service_client == o.http_service_client
|
143
243
|
end
|
144
244
|
|
145
245
|
# @see the `==` method
|
@@ -150,7 +250,17 @@ module FacebookAds
|
|
150
250
|
# Calculates hash code according to all attributes.
|
151
251
|
# @return [Fixnum] Hash code
|
152
252
|
def hash
|
153
|
-
[
|
253
|
+
[
|
254
|
+
pixel_id,
|
255
|
+
events,
|
256
|
+
test_event_code,
|
257
|
+
partner_agent,
|
258
|
+
namespace_id,
|
259
|
+
upload_id,
|
260
|
+
upload_tag,
|
261
|
+
upload_source,
|
262
|
+
http_service_client,
|
263
|
+
].hash
|
154
264
|
end
|
155
265
|
|
156
266
|
def to_s
|
@@ -167,9 +277,20 @@ module FacebookAds
|
|
167
277
|
unless partner_agent.nil?
|
168
278
|
hash['partner_agent'] = partner_agent
|
169
279
|
end
|
280
|
+
unless namespace_id.nil?
|
281
|
+
hash['namespace_id'] = namespace_id
|
282
|
+
end
|
283
|
+
unless upload_id.nil?
|
284
|
+
hash['upload_id'] = upload_id
|
285
|
+
end
|
286
|
+
unless upload_tag.nil?
|
287
|
+
hash['upload_tag'] = upload_tag
|
288
|
+
end
|
289
|
+
unless upload_source.nil?
|
290
|
+
hash['upload_source'] = upload_source
|
291
|
+
end
|
170
292
|
hash.to_s
|
171
293
|
end
|
172
294
|
end
|
173
295
|
end
|
174
296
|
end
|
175
|
-
|