facebookbusiness 0.8.0.0 → 0.9.0.1
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 +22 -3
- data/lib/facebook_ads/ad_objects/ad_account_ad_volume.rb +24 -0
- data/lib/facebook_ads/ad_objects/ad_account_targeting_unified.rb +22 -5
- data/lib/facebook_ads/ad_objects/ad_activity.rb +0 -1
- data/lib/facebook_ads/ad_objects/ad_asset_feed_spec.rb +5 -0
- data/lib/facebook_ads/ad_objects/ad_async_request.rb +2 -0
- data/lib/facebook_ads/ad_objects/ad_campaign_activity.rb +4 -0
- data/lib/facebook_ads/ad_objects/ad_creative.rb +6 -0
- 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 +4 -0
- data/lib/facebook_ads/ad_objects/ad_network_analytics_sync_query_result.rb +1 -0
- data/lib/facebook_ads/ad_objects/ad_preview.rb +1 -0
- data/lib/facebook_ads/ad_objects/ad_rule_execution_spec.rb +4 -0
- data/lib/facebook_ads/ad_objects/ad_study.rb +1 -1
- data/lib/facebook_ads/ad_objects/ad_study_objective.rb +0 -4
- data/lib/facebook_ads/ad_objects/ad_video.rb +11 -0
- data/lib/facebook_ads/ad_objects/adgroup_activity.rb +2 -0
- data/lib/facebook_ads/ad_objects/adoptable_pet.rb +8 -0
- data/lib/facebook_ads/ad_objects/ads_insights.rb +1 -0
- data/lib/facebook_ads/ad_objects/ads_pixel.rb +4 -0
- data/lib/facebook_ads/ad_objects/application.rb +23 -0
- data/lib/facebook_ads/ad_objects/atlas_campaign.rb +1 -1
- data/lib/facebook_ads/ad_objects/automotive_model.rb +1 -0
- data/lib/facebook_ads/ad_objects/business.rb +62 -11
- data/lib/facebook_ads/ad_objects/business_asset_group.rb +1 -0
- data/lib/facebook_ads/ad_objects/business_role_request.rb +4 -0
- data/lib/facebook_ads/ad_objects/business_unit.rb +1 -2
- data/lib/facebook_ads/ad_objects/business_user.rb +4 -0
- data/lib/facebook_ads/ad_objects/campaign.rb +8 -0
- data/lib/facebook_ads/ad_objects/catalog_sub_vertical_list.rb +88 -0
- data/lib/facebook_ads/ad_objects/commerce_merchant_settings.rb +16 -19
- data/lib/facebook_ads/ad_objects/commerce_merchant_settings_setup_status.rb +1 -0
- data/lib/facebook_ads/ad_objects/commerce_order.rb +6 -0
- data/lib/facebook_ads/ad_objects/{work_meeting_link.rb → connections_targeting.rb} +3 -2
- data/lib/facebook_ads/ad_objects/cpas_advertiser_partnership_recommendation.rb +43 -0
- data/lib/facebook_ads/ad_objects/cpas_collaboration_request.rb +50 -0
- 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 +1 -0
- data/lib/facebook_ads/ad_objects/extended_credit.rb +7 -1
- data/lib/facebook_ads/ad_objects/flight.rb +1 -0
- data/lib/facebook_ads/ad_objects/group.rb +8 -0
- 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/hotel_room.rb +1 -0
- data/lib/facebook_ads/ad_objects/link.rb +6 -0
- data/lib/facebook_ads/ad_objects/live_video.rb +12 -12
- data/lib/facebook_ads/ad_objects/page.rb +40 -8
- data/lib/facebook_ads/ad_objects/page_post.rb +2 -0
- data/lib/facebook_ads/ad_objects/photo.rb +6 -0
- data/lib/facebook_ads/ad_objects/playable_content.rb +1 -0
- data/lib/facebook_ads/ad_objects/post.rb +49 -2
- data/lib/facebook_ads/ad_objects/product_catalog.rb +41 -7
- 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 +4 -0
- data/lib/facebook_ads/ad_objects/product_set.rb +1 -0
- data/lib/facebook_ads/ad_objects/product_set_metadata.rb +1 -0
- data/lib/facebook_ads/ad_objects/publisher_block_list.rb +6 -0
- data/lib/facebook_ads/ad_objects/referral.rb +2 -0
- data/lib/facebook_ads/ad_objects/security_settings.rb +0 -1
- data/lib/facebook_ads/ad_objects/server_side/action_source.rb +48 -0
- data/lib/facebook_ads/ad_objects/server_side/batch_processor.rb +73 -0
- data/lib/facebook_ads/ad_objects/server_side/content.rb +23 -4
- data/lib/facebook_ads/ad_objects/server_side/event.rb +32 -6
- data/lib/facebook_ads/ad_objects/server_side/event_request.rb +61 -14
- data/lib/facebook_ads/ad_objects/server_side/event_request_async.rb +43 -0
- data/lib/facebook_ads/ad_objects/server_side/http_method.rb +28 -0
- 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 +20 -1
- data/lib/facebook_ads/ad_objects/server_side/util.rb +13 -0
- data/lib/facebook_ads/ad_objects/system_user.rb +0 -16
- data/lib/facebook_ads/ad_objects/targeting.rb +3 -3
- data/lib/facebook_ads/ad_objects/third_party_measurement_report_dataset.rb +0 -1
- data/lib/facebook_ads/ad_objects/unified_thread.rb +1 -0
- data/lib/facebook_ads/ad_objects/user.rb +28 -25
- data/lib/facebook_ads/ad_objects/vehicle.rb +2 -0
- data/lib/facebook_ads/ad_objects/vehicle_offer.rb +1 -0
- data/lib/facebook_ads/ad_objects/whats_app_business_account.rb +25 -0
- data/lib/facebook_ads/errors.rb +1 -1
- data/lib/facebook_ads/session.rb +1 -1
- data/lib/facebook_ads/version.rb +2 -2
- metadata +32 -8
@@ -28,7 +28,8 @@ module FacebookAds
|
|
28
28
|
:title,
|
29
29
|
:description,
|
30
30
|
:brand,
|
31
|
-
:category
|
31
|
+
:category,
|
32
|
+
:delivery_category
|
32
33
|
|
33
34
|
# Initializes the object
|
34
35
|
# @param [String] product_id
|
@@ -38,7 +39,8 @@ module FacebookAds
|
|
38
39
|
# @param [String] description
|
39
40
|
# @param [String] brand
|
40
41
|
# @param [String] category
|
41
|
-
|
42
|
+
# @param [String] delivery_category
|
43
|
+
def initialize(product_id: nil, quantity: nil, item_price: nil, title: nil, description: nil, brand: nil, category: nil, delivery_category: nil)
|
42
44
|
unless product_id.nil?
|
43
45
|
self.product_id = String(product_id)
|
44
46
|
end
|
@@ -60,6 +62,9 @@ module FacebookAds
|
|
60
62
|
unless category.nil?
|
61
63
|
self.category = String(category)
|
62
64
|
end
|
65
|
+
unless delivery_category.nil?
|
66
|
+
self.delivery_category = String(delivery_category)
|
67
|
+
end
|
63
68
|
end
|
64
69
|
|
65
70
|
# build the object using the input hash
|
@@ -97,6 +102,10 @@ module FacebookAds
|
|
97
102
|
if attributes.has_key?(:'category')
|
98
103
|
self.category = attributes[:'category']
|
99
104
|
end
|
105
|
+
|
106
|
+
if attributes.has_key?(:'delivery_category')
|
107
|
+
self.delivery_category = attributes[:'delivery_category']
|
108
|
+
end
|
100
109
|
end
|
101
110
|
|
102
111
|
# Checks equality by comparing each attribute.
|
@@ -108,7 +117,8 @@ module FacebookAds
|
|
108
117
|
title == o.title &&
|
109
118
|
description == o.description &&
|
110
119
|
brand == o.brand &&
|
111
|
-
category == o.category
|
120
|
+
category == o.category &&
|
121
|
+
delivery_category == o.delivery_category
|
112
122
|
end
|
113
123
|
|
114
124
|
# @see the `==` method
|
@@ -126,7 +136,8 @@ module FacebookAds
|
|
126
136
|
title,
|
127
137
|
description,
|
128
138
|
brand,
|
129
|
-
category
|
139
|
+
category,
|
140
|
+
delivery_category
|
130
141
|
].hash
|
131
142
|
end
|
132
143
|
|
@@ -156,6 +167,9 @@ module FacebookAds
|
|
156
167
|
unless category.nil?
|
157
168
|
hash['category'] = category
|
158
169
|
end
|
170
|
+
unless delivery_category.nil?
|
171
|
+
hash['delivery_category'] = delivery_category
|
172
|
+
end
|
159
173
|
hash.to_s
|
160
174
|
end
|
161
175
|
|
@@ -183,6 +197,11 @@ module FacebookAds
|
|
183
197
|
unless category.nil?
|
184
198
|
hash['category'] = category
|
185
199
|
end
|
200
|
+
unless delivery_category.nil?
|
201
|
+
hash['delivery_category'] = FacebookAds::ServerSide::Util.normalize_delivery_category(
|
202
|
+
delivery_category
|
203
|
+
)
|
204
|
+
end
|
186
205
|
hash
|
187
206
|
end
|
188
207
|
end
|
@@ -64,6 +64,9 @@ module FacebookAds
|
|
64
64
|
# For more details see https://developers.facebook.com/docs/marketing-apis/data-processing-options
|
65
65
|
attr_accessor :data_processing_options_state
|
66
66
|
|
67
|
+
# Where the conversion occurred.
|
68
|
+
attr_accessor :action_source
|
69
|
+
|
67
70
|
# @param [String] event_name
|
68
71
|
# @param [int] event_time
|
69
72
|
# @param [String] event_source_url
|
@@ -74,6 +77,7 @@ module FacebookAds
|
|
74
77
|
# @param [Array<String>] data_processing_options
|
75
78
|
# @param [int] data_processing_options_country
|
76
79
|
# @param [int] data_processing_options_state
|
80
|
+
# @param String action_source
|
77
81
|
def initialize(event_name: nil,
|
78
82
|
event_time: nil,
|
79
83
|
event_source_url: nil,
|
@@ -83,7 +87,8 @@ module FacebookAds
|
|
83
87
|
custom_data: nil,
|
84
88
|
data_processing_options: nil,
|
85
89
|
data_processing_options_country: nil,
|
86
|
-
data_processing_options_state: nil
|
90
|
+
data_processing_options_state: nil,
|
91
|
+
action_source: nil)
|
87
92
|
|
88
93
|
unless event_name.nil?
|
89
94
|
self.event_name = event_name
|
@@ -115,6 +120,9 @@ module FacebookAds
|
|
115
120
|
unless data_processing_options_state.nil?
|
116
121
|
self.data_processing_options_state = data_processing_options_state
|
117
122
|
end
|
123
|
+
unless action_source.nil?
|
124
|
+
self.action_source = action_source
|
125
|
+
end
|
118
126
|
end
|
119
127
|
|
120
128
|
# build the object using the input hash
|
@@ -154,15 +162,19 @@ module FacebookAds
|
|
154
162
|
end
|
155
163
|
|
156
164
|
if attributes.has_key?(:'data_processing_options')
|
157
|
-
self.
|
165
|
+
self.data_processing_options = attributes[:'data_processing_options']
|
158
166
|
end
|
159
167
|
|
160
168
|
if attributes.has_key?(:'data_processing_options_country')
|
161
|
-
self.
|
169
|
+
self.data_processing_options_country = attributes[:'data_processing_options_country']
|
162
170
|
end
|
163
171
|
|
164
172
|
if attributes.has_key?(:'data_processing_options_state')
|
165
|
-
self.
|
173
|
+
self.data_processing_options_state = attributes[:'data_processing_options_state']
|
174
|
+
end
|
175
|
+
|
176
|
+
if attributes.has_key?(:'action_source')
|
177
|
+
self.action_source = attributes[:'action_source']
|
166
178
|
end
|
167
179
|
end
|
168
180
|
|
@@ -207,7 +219,8 @@ module FacebookAds
|
|
207
219
|
custom_data == o.custom_data &&
|
208
220
|
data_processing_options == o.data_processing_options &&
|
209
221
|
data_processing_options_country == o.data_processing_options_country &&
|
210
|
-
data_processing_options_state == o.data_processing_options_state
|
222
|
+
data_processing_options_state == o.data_processing_options_state &&
|
223
|
+
action_source == o.action_source
|
211
224
|
end
|
212
225
|
|
213
226
|
# @see the `==` method
|
@@ -218,7 +231,11 @@ module FacebookAds
|
|
218
231
|
# Calculates hash code according to all attributes.
|
219
232
|
# @return [Fixnum] Hash code
|
220
233
|
def hash
|
221
|
-
[
|
234
|
+
[
|
235
|
+
event_name, event_time, event_source_url, opt_out, event_id, user_data, custom_data,
|
236
|
+
data_processing_options, data_processing_options_country, data_processing_options_state,
|
237
|
+
action_source,
|
238
|
+
].hash
|
222
239
|
end
|
223
240
|
|
224
241
|
def to_s
|
@@ -253,6 +270,9 @@ module FacebookAds
|
|
253
270
|
unless data_processing_options_state.nil?
|
254
271
|
hash['data_processing_options_state'] = data_processing_options_state.to_s
|
255
272
|
end
|
273
|
+
unless action_source.nil?
|
274
|
+
hash['action_source'] = action_source
|
275
|
+
end
|
256
276
|
hash.to_s
|
257
277
|
end
|
258
278
|
|
@@ -290,6 +310,12 @@ module FacebookAds
|
|
290
310
|
unless data_processing_options_state.nil?
|
291
311
|
hash['data_processing_options_state'] = data_processing_options_state
|
292
312
|
end
|
313
|
+
unless action_source.nil?
|
314
|
+
hash['action_source'] = FacebookAds::ServerSide::Util.normalize(
|
315
|
+
action_source,
|
316
|
+
'action_source'
|
317
|
+
)
|
318
|
+
end
|
293
319
|
hash
|
294
320
|
end
|
295
321
|
|
@@ -51,6 +51,9 @@ module FacebookAds
|
|
51
51
|
# The origin/source of data for the dataset to be uploaded.
|
52
52
|
attr_accessor :upload_source
|
53
53
|
|
54
|
+
# The HttpServiceInterface client to use for executing the request.
|
55
|
+
attr_accessor :http_service_client
|
56
|
+
|
54
57
|
# @param [String] pixel_id
|
55
58
|
# @param [Array(FacebookAds::ServerSide::Event)] events
|
56
59
|
# @param [String] test_event_code
|
@@ -59,8 +62,10 @@ module FacebookAds
|
|
59
62
|
# @param [String] upload_id
|
60
63
|
# @param [String] upload_tag
|
61
64
|
# @param [String] upload_source
|
65
|
+
# @param [HttpServiceInterface] http_service_client
|
62
66
|
def initialize(pixel_id: nil, events: nil, test_event_code: nil, partner_agent: nil,
|
63
|
-
namespace_id: nil, upload_id: nil, upload_tag: nil, upload_source: nil
|
67
|
+
namespace_id: nil, upload_id: nil, upload_tag: nil, upload_source: nil,
|
68
|
+
http_service_client: nil)
|
64
69
|
unless pixel_id.nil?
|
65
70
|
self.pixel_id = pixel_id
|
66
71
|
end
|
@@ -85,6 +90,9 @@ module FacebookAds
|
|
85
90
|
unless upload_source.nil?
|
86
91
|
self.upload_source = upload_source
|
87
92
|
end
|
93
|
+
unless http_service_client.nil?
|
94
|
+
self.http_service_client = http_service_client
|
95
|
+
end
|
88
96
|
end
|
89
97
|
|
90
98
|
# build the object using the input hash
|
@@ -128,6 +136,10 @@ module FacebookAds
|
|
128
136
|
if attributes.has_key?(:'upload_source')
|
129
137
|
self.upload_source = attributes[:'upload_source']
|
130
138
|
end
|
139
|
+
|
140
|
+
if attributes.has_key?(:'http_service_client')
|
141
|
+
self.http_service_client = attributes[:'http_service_client']
|
142
|
+
end
|
131
143
|
end
|
132
144
|
|
133
145
|
# Execute request
|
@@ -135,19 +147,14 @@ module FacebookAds
|
|
135
147
|
unless valid?
|
136
148
|
raise list_invalid_properties
|
137
149
|
end
|
138
|
-
|
150
|
+
|
151
|
+
if http_service_client
|
152
|
+
return execute_with_client(http_service_client)
|
153
|
+
end
|
154
|
+
params = get_params()
|
155
|
+
params[:data] = normalize
|
139
156
|
ads_pixel = FacebookAds::AdsPixel.get(pixel_id)
|
140
|
-
response = ads_pixel.events.create(
|
141
|
-
{
|
142
|
-
data: normalized_events,
|
143
|
-
test_event_code: test_event_code,
|
144
|
-
partner_agent: partner_agent,
|
145
|
-
namespace_id: namespace_id,
|
146
|
-
upload_id: upload_id,
|
147
|
-
upload_tag: upload_tag,
|
148
|
-
upload_source: upload_source,
|
149
|
-
}
|
150
|
-
)
|
157
|
+
response = ads_pixel.events.create(params)
|
151
158
|
json_response_object = JSON.parse(JSON.generate(response), object_class: OpenStruct)
|
152
159
|
FacebookAds::ServerSide::EventResponse.new(
|
153
160
|
events_received: json_response_object.events_received,
|
@@ -164,6 +171,44 @@ module FacebookAds
|
|
164
171
|
normalized_events
|
165
172
|
end
|
166
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::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
|
+
|
167
212
|
# Show invalid properties with the reasons. Usually used together with valid?
|
168
213
|
# @return Array for valid properties with the reasons
|
169
214
|
def list_invalid_properties
|
@@ -193,7 +238,8 @@ module FacebookAds
|
|
193
238
|
namespace_id == o.namespace_id &&
|
194
239
|
upload_id == o.upload_id &&
|
195
240
|
upload_tag == o.upload_tag &&
|
196
|
-
upload_source == o.upload_source
|
241
|
+
upload_source == o.upload_source &&
|
242
|
+
http_service_client == o.http_service_client
|
197
243
|
end
|
198
244
|
|
199
245
|
# @see the `==` method
|
@@ -213,6 +259,7 @@ module FacebookAds
|
|
213
259
|
upload_id,
|
214
260
|
upload_tag,
|
215
261
|
upload_source,
|
262
|
+
http_service_client,
|
216
263
|
].hash
|
217
264
|
end
|
218
265
|
|
@@ -0,0 +1,43 @@
|
|
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
|
+
require 'concurrent'
|
20
|
+
|
21
|
+
module FacebookAds
|
22
|
+
module ServerSide
|
23
|
+
class EventRequestAsync < EventRequest
|
24
|
+
def execute
|
25
|
+
Concurrent::Promise.execute do
|
26
|
+
super
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def clone_without_events
|
31
|
+
FacebookAds::ServerSide::EventRequestAsync.new(
|
32
|
+
pixel_id: pixel_id,
|
33
|
+
test_event_code: test_event_code,
|
34
|
+
partner_agent: partner_agent,
|
35
|
+
namespace_id: namespace_id,
|
36
|
+
upload_id: upload_id,
|
37
|
+
upload_tag: upload_tag,
|
38
|
+
upload_source: upload_source,
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,28 @@
|
|
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
|
+
class HttpMethod
|
22
|
+
POST = 'POST'
|
23
|
+
PUT = 'PUT'
|
24
|
+
GET = 'GET'
|
25
|
+
DELETE = 'DELETE'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
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
|
+
|
20
|
+
module FacebookAds
|
21
|
+
module ServerSide
|
22
|
+
class HttpServiceInterface
|
23
|
+
|
24
|
+
# String url | The graph API endpoint that will be requested
|
25
|
+
# String request_method | The HTTP request method
|
26
|
+
# Hash headers | Contains HTTP request headers including User-Agent and Accept-Encoding
|
27
|
+
# Hash params | Contains request parameters including access_token, data, test_event_code, etc.
|
28
|
+
def execute(url, request_method, headers, params)
|
29
|
+
raise Exception.new("Method 'execute' not implemented")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,31 @@
|
|
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
|
+
class HttpUtil
|
22
|
+
def self.appsecret_proof(app_secret, access_token)
|
23
|
+
OpenSSL::HMAC.hexdigest(
|
24
|
+
OpenSSL::Digest.new('sha256'),
|
25
|
+
app_secret,
|
26
|
+
access_token
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|