facebookbusiness 0.7.0.3 → 0.9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/lib/facebook_ads/ad_objects/ad_account.rb +24 -16
  3. data/lib/facebook_ads/ad_objects/ad_account_ad_volume.rb +24 -0
  4. data/lib/facebook_ads/ad_objects/ad_account_targeting_unified.rb +22 -5
  5. data/lib/facebook_ads/ad_objects/ad_activity.rb +0 -1
  6. data/lib/facebook_ads/ad_objects/ad_asset_feed_spec.rb +5 -0
  7. data/lib/facebook_ads/ad_objects/ad_async_request.rb +2 -0
  8. data/lib/facebook_ads/ad_objects/ad_campaign_activity.rb +4 -0
  9. data/lib/facebook_ads/ad_objects/ad_creative.rb +6 -0
  10. data/lib/facebook_ads/ad_objects/ad_creative_interactive_components_spec.rb +1 -0
  11. data/lib/facebook_ads/ad_objects/ad_creative_link_data_call_to_action.rb +4 -0
  12. data/lib/facebook_ads/ad_objects/ad_network_analytics_sync_query_result.rb +1 -0
  13. data/lib/facebook_ads/ad_objects/ad_place_page_set.rb +6 -0
  14. data/lib/facebook_ads/ad_objects/ad_preview.rb +1 -0
  15. data/lib/facebook_ads/ad_objects/ad_report_spec.rb +0 -1
  16. data/lib/facebook_ads/ad_objects/ad_rule_execution_spec.rb +4 -0
  17. data/lib/facebook_ads/ad_objects/ad_study.rb +1 -1
  18. data/lib/facebook_ads/ad_objects/ad_study_objective.rb +0 -4
  19. data/lib/facebook_ads/ad_objects/ad_video.rb +11 -0
  20. data/lib/facebook_ads/ad_objects/adgroup_activity.rb +2 -0
  21. data/lib/facebook_ads/ad_objects/adoptable_pet.rb +8 -0
  22. data/lib/facebook_ads/ad_objects/ads_insights.rb +1 -0
  23. data/lib/facebook_ads/ad_objects/ads_pixel.rb +4 -0
  24. data/lib/facebook_ads/ad_objects/application.rb +23 -0
  25. data/lib/facebook_ads/ad_objects/atlas_campaign.rb +1 -1
  26. data/lib/facebook_ads/ad_objects/automotive_model.rb +1 -0
  27. data/lib/facebook_ads/ad_objects/business.rb +62 -11
  28. data/lib/facebook_ads/ad_objects/business_asset_group.rb +1 -0
  29. data/lib/facebook_ads/ad_objects/business_role_request.rb +4 -0
  30. data/lib/facebook_ads/ad_objects/business_unit.rb +1 -2
  31. data/lib/facebook_ads/ad_objects/business_user.rb +4 -0
  32. data/lib/facebook_ads/ad_objects/campaign.rb +8 -0
  33. data/lib/facebook_ads/ad_objects/catalog_sub_vertical_list.rb +88 -0
  34. data/lib/facebook_ads/ad_objects/commerce_merchant_settings.rb +16 -19
  35. data/lib/facebook_ads/ad_objects/commerce_merchant_settings_setup_status.rb +1 -0
  36. data/lib/facebook_ads/ad_objects/commerce_order.rb +6 -0
  37. data/lib/facebook_ads/ad_objects/commerce_order_transaction_detail.rb +4 -0
  38. data/lib/facebook_ads/ad_objects/{work_meeting_link.rb → connections_targeting.rb} +3 -2
  39. data/lib/facebook_ads/ad_objects/{iterative_split_test_config.rb → cpas_advertiser_partnership_recommendation.rb} +9 -9
  40. data/lib/facebook_ads/ad_objects/{split_test_config.rb → cpas_collaboration_request.rb} +16 -7
  41. data/lib/facebook_ads/ad_objects/custom_audience_data_source.rb +1 -0
  42. data/lib/facebook_ads/ad_objects/da_check.rb +7 -0
  43. data/lib/facebook_ads/ad_objects/destination.rb +1 -0
  44. data/lib/facebook_ads/ad_objects/event.rb +1 -1
  45. data/lib/facebook_ads/ad_objects/extended_credit.rb +7 -1
  46. data/lib/facebook_ads/ad_objects/flight.rb +1 -0
  47. data/lib/facebook_ads/ad_objects/group.rb +8 -1
  48. data/lib/facebook_ads/ad_objects/home_listing.rb +1 -0
  49. data/lib/facebook_ads/ad_objects/hotel.rb +1 -0
  50. data/lib/facebook_ads/ad_objects/hotel_room.rb +1 -0
  51. data/lib/facebook_ads/ad_objects/life_event.rb +0 -4
  52. data/lib/facebook_ads/ad_objects/link.rb +6 -6
  53. data/lib/facebook_ads/ad_objects/live_video.rb +12 -16
  54. data/lib/facebook_ads/ad_objects/native_offer_view.rb +0 -1
  55. data/lib/facebook_ads/ad_objects/oracle_transaction.rb +0 -7
  56. data/lib/facebook_ads/ad_objects/page.rb +48 -70
  57. data/lib/facebook_ads/ad_objects/page_post.rb +2 -0
  58. data/lib/facebook_ads/ad_objects/photo.rb +6 -0
  59. data/lib/facebook_ads/ad_objects/playable_content.rb +1 -0
  60. data/lib/facebook_ads/ad_objects/post.rb +49 -2
  61. data/lib/facebook_ads/ad_objects/product_catalog.rb +43 -7
  62. data/lib/facebook_ads/ad_objects/product_feed.rb +31 -0
  63. data/lib/facebook_ads/ad_objects/product_group.rb +1 -0
  64. data/lib/facebook_ads/ad_objects/product_item.rb +4 -0
  65. data/lib/facebook_ads/ad_objects/product_set.rb +1 -0
  66. data/lib/facebook_ads/ad_objects/product_set_metadata.rb +1 -0
  67. data/lib/facebook_ads/ad_objects/publisher_block_list.rb +6 -0
  68. data/lib/facebook_ads/ad_objects/referral.rb +2 -0
  69. data/lib/facebook_ads/ad_objects/security_settings.rb +0 -1
  70. data/lib/facebook_ads/ad_objects/server_side/batch_processor.rb +73 -0
  71. data/lib/facebook_ads/ad_objects/server_side/content.rb +23 -4
  72. data/lib/facebook_ads/ad_objects/server_side/custom_data.rb +21 -0
  73. data/lib/facebook_ads/ad_objects/{page_about_story.rb → server_side/delivery_category.rb} +10 -16
  74. data/lib/facebook_ads/ad_objects/server_side/event_request.rb +61 -14
  75. data/lib/facebook_ads/ad_objects/server_side/event_request_async.rb +43 -0
  76. data/lib/facebook_ads/ad_objects/{atlas_url.rb → server_side/http_method.rb} +7 -16
  77. data/lib/facebook_ads/ad_objects/server_side/http_service_interface.rb +33 -0
  78. data/lib/facebook_ads/ad_objects/server_side/http_util.rb +31 -0
  79. data/lib/facebook_ads/ad_objects/server_side/user_data.rb +20 -1
  80. data/lib/facebook_ads/ad_objects/server_side/util.rb +13 -0
  81. data/lib/facebook_ads/ad_objects/system_user.rb +0 -20
  82. data/lib/facebook_ads/ad_objects/targeting.rb +3 -3
  83. data/lib/facebook_ads/ad_objects/third_party_measurement_report_dataset.rb +0 -1
  84. data/lib/facebook_ads/ad_objects/unified_thread.rb +1 -0
  85. data/lib/facebook_ads/ad_objects/user.rb +28 -30
  86. data/lib/facebook_ads/ad_objects/vehicle.rb +2 -0
  87. data/lib/facebook_ads/ad_objects/vehicle_offer.rb +1 -0
  88. data/lib/facebook_ads/ad_objects/whats_app_business_account.rb +25 -0
  89. data/lib/facebook_ads/errors.rb +1 -1
  90. data/lib/facebook_ads/session.rb +1 -1
  91. data/lib/facebook_ads/version.rb +2 -2
  92. metadata +30 -12
  93. data/lib/facebook_ads/ad_objects/user_taggable_friend.rb +0 -50
@@ -16,24 +16,18 @@
16
16
  # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
17
17
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18
18
 
19
- # FB:AUTOGEN
20
-
21
19
  module FacebookAds
22
- # This class is auto-generated.
23
-
24
- # For any issues or feature requests related to this class, please let us know
25
- # on github and we'll fix in our codegen framework. We'll not be able to accept
26
- # pull request for this class.
20
+ module ServerSide
21
+ DeliveryCategory = Set[
27
22
 
28
- class PageAboutStory < AdObject
23
+ # Customer needs to enter the store to get the purchased product.
24
+ 'in_store',
29
25
 
30
- field :composed_text, { list: 'object' }
31
- field :cover_photo, 'Photo'
32
- field :entity_map, { list: 'object' }
33
- field :id, 'string'
34
- field :is_published, 'bool'
35
- field :page_id, 'string'
36
- field :title, 'string'
26
+ # Customer picks up their order by driving to a store and waiting inside their vehicle.
27
+ 'curbside',
37
28
 
38
- end
29
+ # Purchase is delivered to the customer's home.
30
+ 'home_delivery'
31
+ ]
32
+ end
39
33
  end
@@ -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
- normalized_events = normalize
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
@@ -16,22 +16,13 @@
16
16
  # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
17
17
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18
18
 
19
- # FB:AUTOGEN
20
-
21
19
  module FacebookAds
22
- # This class is auto-generated.
23
-
24
- # For any issues or feature requests related to this class, please let us know
25
- # on github and we'll fix in our codegen framework. We'll not be able to accept
26
- # pull request for this class.
27
-
28
- class AtlasUrl < AdObject
29
-
30
- field :url, 'string'
31
- has_no_id
32
- has_no_get
33
- has_no_post
34
- has_no_delete
35
-
20
+ module ServerSide
21
+ class HttpMethod
22
+ POST = 'POST'
23
+ PUT = 'PUT'
24
+ GET = 'GET'
25
+ DELETE = 'DELETE'
26
+ end
36
27
  end
37
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
@@ -91,6 +91,9 @@ module FacebookAds
91
91
  # The subscription ID for the user in this transaction. This is similar to the order ID for an individual product.
92
92
  attr_accessor :subscription_id
93
93
 
94
+ # The lead ID for the user in this transaction. This ID is associated with a lead generated by Facebook's Lead Ads.
95
+ attr_accessor :lead_id
96
+
94
97
  # The first 5 letters of the first name.
95
98
  attr_accessor :f5first
96
99
 
@@ -126,6 +129,7 @@ module FacebookAds
126
129
  # @param [String] fbc
127
130
  # @param [String] fbp
128
131
  # @param [String] subscription_id
132
+ # @param [String] lead_id
129
133
  # @param [String] f5first
130
134
  # @param [String] f5last
131
135
  # @param [String] fi
@@ -135,7 +139,7 @@ module FacebookAds
135
139
  def initialize(email: nil, phone: nil, gender: nil, date_of_birth: nil,
136
140
  last_name: nil, first_name: nil, city: nil, state: nil,
137
141
  country_code: nil, zip_code: nil, external_id: nil, client_ip_address: nil,
138
- client_user_agent: nil, fbc: nil, fbp: nil, subscription_id: nil,
142
+ client_user_agent: nil, fbc: nil, fbp: nil, subscription_id: nil, lead_id: nil,
139
143
  f5first: nil, f5last: nil, fi: nil, dobd: nil, dobm: nil, doby: nil)
140
144
  unless email.nil?
141
145
  self.email = email
@@ -185,6 +189,9 @@ module FacebookAds
185
189
  unless subscription_id.nil?
186
190
  self.subscription_id = subscription_id
187
191
  end
192
+ unless lead_id.nil?
193
+ self.lead_id = lead_id
194
+ end
188
195
  unless f5first.nil?
189
196
  self.f5first = f5first
190
197
  end
@@ -273,6 +280,10 @@ module FacebookAds
273
280
  self.fbp = attributes[:'fbp']
274
281
  end
275
282
 
283
+ if attributes.has_key?(:'lead_id')
284
+ self.lead_id = attributes[:'lead_id']
285
+ end
286
+
276
287
  if attributes.has_key?(:'f5first')
277
288
  self.f5first = attributes[:'f5first']
278
289
  end
@@ -318,6 +329,7 @@ module FacebookAds
318
329
  fbc == o.fbc &&
319
330
  fbp == o.fbp &&
320
331
  subscription_id == o.subscription_id &&
332
+ lead_id == o.lead_id &&
321
333
  f5first == o.f5first &&
322
334
  f5last == o.f5last &&
323
335
  fi == o.fi &&
@@ -351,6 +363,7 @@ module FacebookAds
351
363
  fbc,
352
364
  fbp,
353
365
  subscription_id,
366
+ lead_id,
354
367
  f5first,
355
368
  f5last,
356
369
  fi,
@@ -413,6 +426,9 @@ module FacebookAds
413
426
  unless subscription_id.nil?
414
427
  hash['subscription_id'] = subscription_id
415
428
  end
429
+ unless lead_id.nil?
430
+ hash['lead_id'] = lead_id
431
+ end
416
432
  unless f5first.nil?
417
433
  hash['f5first'] = f5first
418
434
  end
@@ -486,6 +502,9 @@ module FacebookAds
486
502
  unless subscription_id.nil?
487
503
  hash['subscription_id'] = subscription_id
488
504
  end
505
+ unless lead_id.nil?
506
+ hash['lead_id'] = lead_id
507
+ end
489
508
  unless f5first.nil?
490
509
  hash['f5first'] = FacebookAds::ServerSide::Util.normalize(f5first, 'f5first')
491
510
  end
@@ -58,6 +58,8 @@ module FacebookAds
58
58
  normalized_input = normalize_city input
59
59
  when 'currency'
60
60
  return normalize_currency input
61
+ when 'delivery_category'
62
+ return normalize_delivery_category input
61
63
  when 'em'
62
64
  normalized_input = normalize_email input
63
65
  when 'ge'
@@ -277,6 +279,17 @@ module FacebookAds
277
279
  end
278
280
  doby
279
281
  end
282
+
283
+ # Normalizes the input delivery category and returns valid value (or throw exception if invalid).
284
+ def self.normalize_delivery_category(delivery_category)
285
+
286
+ unless FacebookAds::ServerSide::DeliveryCategory.include?(delivery_category)
287
+ raise ArgumentError.new("Invalid delivery_category passed: " + delivery_category + ". Please use one of the defined values #{FacebookAds::ServerSide::DeliveryCategory.to_a.join(',')}" )
288
+ end
289
+
290
+ delivery_category;
291
+ end
292
+
280
293
  end
281
294
  end
282
295
  end
@@ -26,20 +26,6 @@ module FacebookAds
26
26
  # pull request for this class.
27
27
 
28
28
  class SystemUser < AdObject
29
- ROLE = [
30
- "ADMIN",
31
- "ADS_RIGHTS_REVIEWER",
32
- "DEVELOPER",
33
- "EMPLOYEE",
34
- "FINANCE_ANALYST",
35
- "FINANCE_EDITOR",
36
- "PARTNER_CENTER_ADMIN",
37
- "PARTNER_CENTER_ANALYST",
38
- "PARTNER_CENTER_EDUCATION",
39
- "PARTNER_CENTER_MARKETING",
40
- "PARTNER_CENTER_OPERATIONS",
41
- ]
42
-
43
29
 
44
30
  field :created_by, 'User'
45
31
  field :created_time, 'datetime'
@@ -47,8 +33,6 @@ module FacebookAds
47
33
  field :id, 'string'
48
34
  field :ip_permission, 'string'
49
35
  field :name, 'string'
50
- field :role, { enum: -> { ROLE }}
51
- field :system_user_id, 'int'
52
36
  has_no_post
53
37
  has_no_delete
54
38
 
@@ -70,9 +54,5 @@ module FacebookAds
70
54
  edge.get 'ProductCatalog'
71
55
  end
72
56
 
73
- has_edge :updated_by do |edge|
74
- edge.get 'User'
75
- end
76
-
77
57
  end
78
58
  end