facebookbusiness 0.10.0.0 → 0.10.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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/lib/facebook_ads/ad_objects/ad_account.rb +2 -15
  3. data/lib/facebook_ads/ad_objects/ad_account_targeting_unified.rb +2 -0
  4. data/lib/facebook_ads/ad_objects/ad_creative.rb +7 -7
  5. data/lib/facebook_ads/ad_objects/ad_creative_portrait_customizations.rb +1 -0
  6. data/lib/facebook_ads/ad_objects/ad_preview.rb +1 -0
  7. data/lib/facebook_ads/ad_objects/ad_rule_execution_spec.rb +1 -2
  8. data/lib/facebook_ads/ad_objects/ad_study.rb +8 -0
  9. data/lib/facebook_ads/ad_objects/ad_study_objective.rb +2 -0
  10. data/lib/facebook_ads/ad_objects/ad_video.rb +15 -5
  11. data/lib/facebook_ads/ad_objects/adgroup_activity.rb +0 -2
  12. data/lib/facebook_ads/ad_objects/adoptable_pet.rb +18 -0
  13. data/lib/facebook_ads/ad_objects/ads_insights.rb +1 -0
  14. data/lib/facebook_ads/ad_objects/ads_pixel.rb +1 -0
  15. data/lib/facebook_ads/ad_objects/application.rb +21 -0
  16. data/lib/facebook_ads/ad_objects/atlas_campaign.rb +0 -8
  17. data/lib/facebook_ads/ad_objects/automotive_model.rb +18 -0
  18. data/lib/facebook_ads/ad_objects/business.rb +16 -3
  19. data/lib/facebook_ads/ad_objects/business_asset_group.rb +1 -0
  20. data/lib/facebook_ads/ad_objects/catalog_sub_vertical_list.rb +0 -1
  21. data/lib/facebook_ads/ad_objects/comment.rb +2 -1
  22. data/lib/facebook_ads/ad_objects/commerce_merchant_settings.rb +1 -0
  23. data/lib/facebook_ads/ad_objects/content_delivery_report.rb +4 -0
  24. data/lib/facebook_ads/ad_objects/cpas_parent_catalog_settings.rb +1 -0
  25. data/lib/facebook_ads/ad_objects/custom_audience.rb +0 -2
  26. data/lib/facebook_ads/ad_objects/custom_audience_data_source.rb +1 -0
  27. data/lib/facebook_ads/ad_objects/delivery_window.rb +287 -0
  28. data/lib/facebook_ads/ad_objects/destination.rb +18 -0
  29. data/lib/facebook_ads/ad_objects/flight.rb +18 -0
  30. data/lib/facebook_ads/ad_objects/group.rb +17 -0
  31. data/lib/facebook_ads/ad_objects/home_listing.rb +18 -0
  32. data/lib/facebook_ads/ad_objects/hotel.rb +18 -0
  33. data/lib/facebook_ads/ad_objects/ig_media.rb +2 -0
  34. data/lib/facebook_ads/ad_objects/{invoice_campaign.rb → invoice_campaign_new.rb} +1 -1
  35. data/lib/facebook_ads/ad_objects/live_video.rb +8 -1
  36. data/lib/facebook_ads/ad_objects/omega_customer_trx.rb +64 -0
  37. data/lib/facebook_ads/ad_objects/oracle_transaction.rb +1 -6
  38. data/lib/facebook_ads/ad_objects/page.rb +18 -6
  39. data/lib/facebook_ads/ad_objects/private_lift_study_instance.rb +46 -0
  40. data/lib/facebook_ads/ad_objects/product_catalog.rb +15 -0
  41. data/lib/facebook_ads/ad_objects/product_feed.rb +16 -0
  42. data/lib/facebook_ads/ad_objects/product_item.rb +10 -0
  43. data/lib/facebook_ads/ad_objects/product_item_ar_data.rb +1 -0
  44. data/lib/facebook_ads/ad_objects/product_set.rb +7 -0
  45. data/lib/facebook_ads/ad_objects/saved_audience.rb +1 -0
  46. data/lib/facebook_ads/ad_objects/server_side/user_data.rb +290 -96
  47. data/lib/facebook_ads/ad_objects/server_side/util.rb +15 -0
  48. data/lib/facebook_ads/ad_objects/vehicle.rb +18 -0
  49. data/lib/facebook_ads/ad_objects/vehicle_offer.rb +18 -0
  50. data/lib/facebook_ads/ad_objects/whats_app_business_account.rb +1 -0
  51. data/lib/facebook_ads/ad_objects/whats_app_business_profile.rb +1 -0
  52. data/lib/facebook_ads/version.rb +1 -1
  53. metadata +6 -3
@@ -139,6 +139,10 @@ module FacebookAds
139
139
  end
140
140
  end
141
141
 
142
+ has_edge :auto_markets do |edge|
143
+ edge.get
144
+ end
145
+
142
146
  has_edge :automotive_models do |edge|
143
147
  edge.get 'AutomotiveModel' do |api|
144
148
  api.has_param :bulk_pagination, 'bool'
@@ -159,6 +163,10 @@ module FacebookAds
159
163
  end
160
164
  end
161
165
 
166
+ has_edge :autos do |edge|
167
+ edge.get
168
+ end
169
+
162
170
  has_edge :batch do |edge|
163
171
  edge.post 'ProductCatalog' do |api|
164
172
  api.has_param :allow_upsert, 'bool'
@@ -287,6 +295,13 @@ module FacebookAds
287
295
  end
288
296
  end
289
297
 
298
+ has_edge :media_titles do |edge|
299
+ edge.get do |api|
300
+ api.has_param :bulk_pagination, 'bool'
301
+ api.has_param :filter, 'object'
302
+ end
303
+ end
304
+
290
305
  has_edge :pricing_variables_batch do |edge|
291
306
  edge.get 'ProductCatalogPricingVariablesBatch' do |api|
292
307
  api.has_param :handle, 'string'
@@ -53,6 +53,7 @@ module FacebookAds
53
53
 
54
54
  FEED_TYPE = [
55
55
  "AUTO",
56
+ "AUTOMOTIVE_MODEL",
56
57
  "DESTINATION",
57
58
  "FLIGHT",
58
59
  "HOME_LISTING",
@@ -128,6 +129,10 @@ module FacebookAds
128
129
  field :rules, { list: 'string' }
129
130
  field :selected_override_fields, { list: 'string' }
130
131
 
132
+ has_edge :auto_markets do |edge|
133
+ edge.get
134
+ end
135
+
131
136
  has_edge :automotive_models do |edge|
132
137
  edge.get 'AutomotiveModel' do |api|
133
138
  api.has_param :bulk_pagination, 'bool'
@@ -135,6 +140,10 @@ module FacebookAds
135
140
  end
136
141
  end
137
142
 
143
+ has_edge :autos do |edge|
144
+ edge.get
145
+ end
146
+
138
147
  has_edge :destinations do |edge|
139
148
  edge.get 'Destination' do |api|
140
149
  api.has_param :bulk_pagination, 'bool'
@@ -163,6 +172,13 @@ module FacebookAds
163
172
  end
164
173
  end
165
174
 
175
+ has_edge :media_titles do |edge|
176
+ edge.get do |api|
177
+ api.has_param :bulk_pagination, 'bool'
178
+ api.has_param :filter, 'object'
179
+ end
180
+ end
181
+
166
182
  has_edge :products do |edge|
167
183
  edge.get 'ProductItem' do |api|
168
184
  api.has_param :bulk_pagination, 'bool'
@@ -62,6 +62,15 @@ module FacebookAds
62
62
  "unisex",
63
63
  ]
64
64
 
65
+ IMAGE_FETCH_STATUS = [
66
+ "DIRECT_UPLOAD",
67
+ "FETCHED",
68
+ "FETCH_FAILED",
69
+ "NO_STATUS",
70
+ "OUTDATED",
71
+ "PARTIAL_FETCH",
72
+ ]
73
+
65
74
  REVIEW_STATUS = [
66
75
  "",
67
76
  "approved",
@@ -317,6 +326,7 @@ module FacebookAds
317
326
  field :gtin, 'string'
318
327
  field :id, 'string'
319
328
  field :image_cdn_urls, 'hash'
329
+ field :image_fetch_status, { enum: -> { IMAGE_FETCH_STATUS }}
320
330
  field :image_url, 'string'
321
331
  field :images, { list: 'string' }
322
332
  field :inventory, 'int'
@@ -39,6 +39,7 @@ module FacebookAds
39
39
  "OFFLINE_CONVERSIONS",
40
40
  "SHOPS",
41
41
  "UNIVERSAL_CHECKOUT",
42
+ "WHATSAPP",
42
43
  ]
43
44
 
44
45
 
@@ -73,6 +73,13 @@ module FacebookAds
73
73
  end
74
74
  end
75
75
 
76
+ has_edge :media_titles do |edge|
77
+ edge.get do |api|
78
+ api.has_param :bulk_pagination, 'bool'
79
+ api.has_param :filter, 'object'
80
+ end
81
+ end
82
+
76
83
  has_edge :products do |edge|
77
84
  edge.get 'ProductItem' do |api|
78
85
  api.has_param :bulk_pagination, 'bool'
@@ -29,6 +29,7 @@ module FacebookAds
29
29
 
30
30
  field :account, 'AdAccount'
31
31
  field :approximate_count, 'int'
32
+ field :approximate_count_64bit, 'int'
32
33
  field :description, 'string'
33
34
  field :extra_info, 'string'
34
35
  field :id, 'string'
@@ -22,53 +22,157 @@ module FacebookAds
22
22
  # UserData is a set of identifiers Facebook can use for targeted attribution
23
23
  class UserData
24
24
 
25
+ # A list of email addresses, in lowercase.
26
+ # Example: ['joe@eg.com']
27
+ attr_accessor :emails
28
+
25
29
  # An email address, in lowercase.
26
30
  # Example: joe@eg.com
27
- attr_accessor :email
31
+ def email
32
+ @emails ? @emails[0] : nil
33
+ end
34
+ def email=(email)
35
+ @emails = [email]
36
+ end
37
+
38
+ # A list of phone numbers. Include only digits with country code, area code, and number.
39
+ # Example: ['16505551212']
40
+ attr_accessor :phones
28
41
 
29
42
  # A phone number. Include only digits with country code, area code, and number.
30
43
  # Example: 16505551212
31
- attr_accessor :phone
44
+ def phone
45
+ @phones ? @phones[0] : nil
46
+ end
47
+ def phone=(phone)
48
+ @phones = [phone]
49
+ end
50
+
51
+ # A list of genders, in lowercase.
52
+ # Example: ['f']
53
+ attr_accessor :genders
32
54
 
33
55
  # Gender, in lowercase. Either f or m.
34
- attr_accessor :gender
56
+ def gender
57
+ @genders ? @genders[0] : nil
58
+ end
59
+ def gender=(gender)
60
+ @genders = [gender]
61
+ end
62
+
63
+ # A list of dates of birth given as year, month, and day.
64
+ # Format should be 'YYYYMMDD'
65
+ # Example: ['19971226'] for December 26, 1997.
66
+ attr_accessor :dates_of_birth
35
67
 
36
68
  # A date of birth given as year, month, and day.
37
69
  # Format should be 'YYYYMMDD'
38
70
  # Example: 19971226 for December 26, 1997.
39
- attr_accessor :date_of_birth
71
+ def date_of_birth
72
+ @dates_of_birth ? @dates_of_birth[0] : nil
73
+ end
74
+ def date_of_birth=(date_of_birth)
75
+ @dates_of_birth = [date_of_birth]
76
+ end
77
+
78
+ # A list of last names in lowercase.
79
+ # Example: ['smith']
80
+ attr_accessor :last_names
40
81
 
41
82
  # A last name in lowercase.
42
83
  # Example: smith
43
- attr_accessor :last_name
84
+ def last_name
85
+ @last_names ? @last_names[0] : nil
86
+ end
87
+ def last_name=(last_name)
88
+ @last_names = [last_name]
89
+ end
90
+
91
+ # A list of first names in lowercase.
92
+ # Example: ['joe']
93
+ attr_accessor :first_names
44
94
 
45
95
  # A first name in lowercase.
46
96
  # Example: joe
47
- attr_accessor :first_name
97
+ def first_name
98
+ @first_names ? @first_names[0] : nil
99
+ end
100
+ def first_name=(first_name)
101
+ @first_names = [first_name]
102
+ end
103
+
104
+ # A list of cities in lower-case without spaces or punctuation.
105
+ # Example: ['menlopark']
106
+ attr_accessor :cities
48
107
 
49
108
  # A city in lower-case without spaces or punctuation.
50
109
  # Example: menlopark
51
- attr_accessor :city
110
+ def city
111
+ @cities ? @cities[0] : nil
112
+ end
113
+ def city=(city)
114
+ @cities = [city]
115
+ end
116
+
117
+ # A list of two-letter country codes in lowercase.
118
+ # Example: ['us']
119
+ attr_accessor :country_codes
52
120
 
53
121
  # A two-letter country code in lowercase.
54
122
  # Example: us
55
- attr_accessor :country_code
123
+ def country_code
124
+ @country_codes ? @country_codes[0] : nil
125
+ end
126
+ def country_code=(country_code)
127
+ @country_codes = [country_code]
128
+ end
129
+
130
+ # A list of two-letter state codes in lowercase.
131
+ # Example: ['ca']
132
+ attr_accessor :states
56
133
 
57
134
  # A two-letter state code in lowercase.
58
135
  # Example: ca
59
- attr_accessor :state
136
+ def state
137
+ @states ? @states[0] : nil
138
+ end
139
+ def state=(state)
140
+ @states = [state]
141
+ end
142
+
143
+ # A list of five-digit zip codes for United States.
144
+ # For other locations, follow each country's standards.
145
+ # Example: ['94035'] (for United States)
146
+ attr_accessor :zip_codes
60
147
 
61
148
  # A five-digit zip code for United States.
62
149
  # For other locations, follow each country's standards.
63
150
  # Example: 94035 (for United States)
64
- attr_accessor :zip_code
151
+ def zip_code
152
+ @zip_codes ? @zip_codes[0] : nil
153
+ end
154
+ def zip_code=(zip_code)
155
+ @zip_codes = [zip_code]
156
+ end
157
+
158
+ # A list of unique IDs from the advertiser, such as loyalty membership IDs, user IDs, and external cookie IDs.
159
+ # In the Offline Conversions API (https://www.facebook.com/business/help/104039186799009),
160
+ # this is known as extern_id. For more information, see Offline Conversions, Providing External IDs.
161
+ # If External ID is being sent via other channels, then it should be sent in the same format
162
+ # via the Conversions API.
163
+ attr_accessor :external_ids
65
164
 
66
165
  # Any unique ID from the advertiser, such as loyalty membership IDs, user IDs, and external cookie IDs.
67
166
  # In the Offline Conversions API (https://www.facebook.com/business/help/104039186799009),
68
167
  # this is known as extern_id. For more information, see Offline Conversions, Providing External IDs.
69
168
  # If External ID is being sent via other channels, then it should be sent in the same format
70
- # via the server-side API.
71
- attr_accessor :external_id
169
+ # via the Conversions API.
170
+ def external_id
171
+ @external_ids ? @external_ids[0] : nil
172
+ end
173
+ def external_id=(external_id)
174
+ @external_ids = [external_id]
175
+ end
72
176
 
73
177
  # The IP address of the browser corresponding to the event.
74
178
  attr_accessor :client_ip_address
@@ -78,13 +182,13 @@ module FacebookAds
78
182
 
79
183
  # The Facebook click ID value stored in the _fbc browser cookie under your domain.
80
184
  # See Managing fbc and fbp Parameters for how to get this value
81
- # (https://developers.facebook.com/docs/marketing-api/facebook-pixel/server-side-api/parameters#fbc),
185
+ # (https://developers.facebook.com/docs/marketing-api/facebook-pixel/conversions-api/parameters#fbc),
82
186
  # or generate this value from a fbclid query parameter.
83
187
  attr_accessor :fbc
84
188
 
85
189
  # The Facebook browser ID value stored in the _fbp browser cookie under your domain.
86
190
  # See Managing fbc and fbp Parameters for how to get this value
87
- # (https://developers.facebook.com/docs/marketing-api/facebook-pixel/server-side-api/parameters#fbc),
191
+ # (https://developers.facebook.com/docs/marketing-api/facebook-pixel/conversions-api/parameters#fbc),
88
192
  # or generate this value from a fbclid query parameter.
89
193
  attr_accessor :fbp
90
194
 
@@ -109,21 +213,32 @@ module FacebookAds
109
213
  # The date of birth month.
110
214
  attr_accessor :dobm
111
215
 
112
- # THe date of birth year.
216
+ # The date of birth year.
113
217
  attr_accessor :doby
114
218
 
115
219
  #UserData is a set of identifiers Facebook can use for targeted attribution
116
220
  # @param [String] email
221
+ # @param [Array<String>] emails
117
222
  # @param [String] phone
223
+ # @param [Array<String>] phones
118
224
  # @param [String] gender
225
+ # @param [Array<String>] genders
119
226
  # @param [String] date_of_birth
227
+ # @param [Array<String>] dates_of_births
120
228
  # @param [String] last_name
229
+ # @param [Array<String>] last_names
121
230
  # @param [String] first_name
231
+ # @param [Array<String>] first_names
122
232
  # @param [String] city
233
+ # @param [Array<String>] cities
123
234
  # @param [String] state
235
+ # @param [Array<String>] states
124
236
  # @param [String] country_code
237
+ # @param [Array<String>] country_codes
125
238
  # @param [String] zip_code
239
+ # @param [Array<String>] zip_codes
126
240
  # @param [String] external_id
241
+ # @param [Array<String>] external_ids
127
242
  # @param [String] client_ip_address
128
243
  # @param [String] client_user_agent
129
244
  # @param [String] fbc
@@ -136,44 +251,91 @@ module FacebookAds
136
251
  # @param [String] dobd
137
252
  # @param [String] dobm
138
253
  # @param [String] doby
139
- def initialize(email: nil, phone: nil, gender: nil, date_of_birth: nil,
140
- last_name: nil, first_name: nil, city: nil, state: nil,
141
- country_code: nil, zip_code: nil, external_id: nil, client_ip_address: nil,
254
+ def initialize(email: nil, emails: nil, phone: nil, phones: nil, gender: nil, genders: nil,
255
+ date_of_birth: nil, dates_of_birth: nil, last_name: nil, last_names: nil,
256
+ first_name: nil, first_names: nil, city: nil, cities: nil, state: nil, states: nil,
257
+ country_code: nil, country_codes: nil, zip_code: nil, zip_codes: nil,
258
+ external_id: nil, external_ids: nil, client_ip_address: nil,
142
259
  client_user_agent: nil, fbc: nil, fbp: nil, subscription_id: nil, lead_id: nil,
143
260
  f5first: nil, f5last: nil, fi: nil, dobd: nil, dobm: nil, doby: nil)
261
+ validate_constructor_values(emails, email, 'emails', 'email')
262
+ validate_constructor_values(phones, phone, 'phones', 'phone')
263
+ validate_constructor_values(genders, gender, 'genders', 'gender')
264
+ validate_constructor_values(dates_of_birth, date_of_birth, 'dates_of_birth', 'date_of_birth')
265
+ validate_constructor_values(first_names, first_name, 'first_names', 'first_name')
266
+ validate_constructor_values(last_names, last_name, 'last_names', 'last_name')
267
+ validate_constructor_values(cities, city, 'cities', 'city')
268
+ validate_constructor_values(country_codes, country_code, 'country_codes', 'country_code')
269
+ validate_constructor_values(states, state, 'states', 'state')
270
+ validate_constructor_values(zip_codes, zip_code, 'zip_codes', 'zip_code')
271
+ validate_constructor_values(external_ids, external_id, 'external_ids', 'external_id')
272
+
144
273
  unless email.nil?
145
274
  self.email = email
146
275
  end
276
+ unless emails.nil?
277
+ self.emails = emails
278
+ end
147
279
  unless phone.nil?
148
280
  self.phone = phone
149
281
  end
282
+ unless phones.nil?
283
+ self.phones = phones
284
+ end
150
285
  unless gender.nil?
151
286
  self.gender = gender
152
287
  end
288
+ unless genders.nil?
289
+ self.genders = genders
290
+ end
153
291
  unless date_of_birth.nil?
154
292
  self.date_of_birth = date_of_birth
155
293
  end
294
+ unless dates_of_birth.nil?
295
+ self.dates_of_birth = dates_of_birth
296
+ end
156
297
  unless last_name.nil?
157
298
  self.last_name = last_name
158
299
  end
300
+ unless last_names.nil?
301
+ self.last_names = last_names
302
+ end
159
303
  unless first_name.nil?
160
304
  self.first_name = first_name
161
305
  end
306
+ unless first_names.nil?
307
+ self.first_names = first_names
308
+ end
162
309
  unless city.nil?
163
310
  self.city = city
164
311
  end
312
+ unless cities.nil?
313
+ self.cities = cities
314
+ end
165
315
  unless state.nil?
166
316
  self.state = state
167
317
  end
318
+ unless states.nil?
319
+ self.states = states
320
+ end
168
321
  unless country_code.nil?
169
322
  self.country_code = country_code
170
323
  end
324
+ unless country_codes.nil?
325
+ self.country_codes = country_codes
326
+ end
171
327
  unless zip_code.nil?
172
328
  self.zip_code = zip_code
173
329
  end
330
+ unless zip_codes.nil?
331
+ self.zip_codes = zip_codes
332
+ end
174
333
  unless external_id.nil?
175
334
  self.external_id = external_id
176
335
  end
336
+ unless external_ids.nil?
337
+ self.external_ids = external_ids
338
+ end
177
339
  unless client_ip_address.nil?
178
340
  self.client_ip_address = client_ip_address
179
341
  end
@@ -220,48 +382,70 @@ module FacebookAds
220
382
  # convert string to symbol for hash key
221
383
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
222
384
 
223
- if attributes.has_key?(:'email')
224
- self.email = attributes[:'email']
385
+ if attributes.has_key?(:'emails')
386
+ self.emails = attributes[:'emails']
387
+ elsif attributes.has_key?(:'email')
388
+ self.emails = [attributes[:'email']]
225
389
  end
226
390
 
227
- if attributes.has_key?(:'phone')
228
- self.phone = attributes[:'phone']
391
+ if attributes.has_key?(:'phones')
392
+ self.phones = attributes[:'phones']
393
+ elsif attributes.has_key?(:'phone')
394
+ self.phones = [attributes[:'phone']]
229
395
  end
230
396
 
231
- if attributes.has_key?(:'gender')
232
- self.gender = attributes[:'gender']
397
+ if attributes.has_key?(:'genders')
398
+ self.genders = attributes[:'genders']
399
+ elsif attributes.has_key?(:'gender')
400
+ self.genders = [attributes[:'gender']]
233
401
  end
234
402
 
235
- if attributes.has_key?(:'date_of_birth')
236
- self.date_of_birth = attributes[:'date_of_birth']
403
+ if attributes.has_key?(:'dates_of_birth')
404
+ self.dates_of_birth = attributes[:'dates_of_birth']
405
+ elsif attributes.has_key?(:'date_of_birth')
406
+ self.dates_of_birth = [attributes[:'date_of_birth']]
237
407
  end
238
408
 
239
- if attributes.has_key?(:'last_name')
240
- self.last_name = attributes[:'last_name']
409
+ if attributes.has_key?(:'last_names')
410
+ self.last_names = attributes[:'last_names']
411
+ elsif attributes.has_key?(:'last_name')
412
+ self.last_names = [attributes[:'last_name']]
241
413
  end
242
414
 
243
- if attributes.has_key?(:'first_name')
244
- self.first_name = attributes[:'first_name']
415
+ if attributes.has_key?(:'first_names')
416
+ self.first_names = attributes[:'first_names']
417
+ elsif attributes.has_key?(:'first_name')
418
+ self.first_names = [attributes[:'first_name']]
245
419
  end
246
420
 
247
- if attributes.has_key?(:'city')
248
- self.city = attributes[:'city']
421
+ if attributes.has_key?(:'cities')
422
+ self.cities = attributes[:'cities']
423
+ elsif attributes.has_key?(:'city')
424
+ self.cities = [attributes[:'city']]
249
425
  end
250
426
 
251
- if attributes.has_key?(:'country_code')
252
- self.country_code = attributes[:'country_code']
427
+ if attributes.has_key?(:'country_codes')
428
+ self.country_codes = attributes[:'country_codes']
429
+ elsif attributes.has_key?(:'country_code')
430
+ self.country_codes = [attributes[:'country_code']]
253
431
  end
254
432
 
255
- if attributes.has_key?(:'state')
256
- self.state = attributes[:'state']
433
+ if attributes.has_key?(:'states')
434
+ self.states = attributes[:'states']
435
+ elsif attributes.has_key?(:'state')
436
+ self.states = [attributes[:'state']]
257
437
  end
258
438
 
259
- if attributes.has_key?(:'zip_code')
260
- self.zip_code = attributes[:'zip_code']
439
+ if attributes.has_key?(:'zip_codes')
440
+ self.zip_codes = attributes[:'zip_codes']
441
+ elsif attributes.has_key?(:'zip_code')
442
+ self.zip_codes = [attributes[:'zip_code']]
261
443
  end
262
444
 
263
- if attributes.has_key?(:'external_id')
264
- self.external_id = attributes[:'external_id']
445
+ if attributes.has_key?(:'external_ids')
446
+ self.external_ids = attributes[:'external_ids']
447
+ elsif attributes.has_key?(:'external_id')
448
+ self.external_ids = [attributes[:'external_id']]
265
449
  end
266
450
 
267
451
  if attributes.has_key?(:'client_ip_address')
@@ -313,17 +497,17 @@ module FacebookAds
313
497
  def ==(o)
314
498
  return true if self.equal?(o)
315
499
  self.class == o.class &&
316
- email == o.email &&
317
- phone == o.phone &&
318
- gender == o.gender &&
319
- date_of_birth == o.date_of_birth &&
320
- last_name == o.last_name &&
321
- first_name == o.first_name &&
322
- city == o.city &&
323
- country_code == o.country_code &&
324
- state == o.state &&
325
- zip_code == o.zip_code &&
326
- external_id == o.external_id &&
500
+ emails == o.emails &&
501
+ phones == o.phones &&
502
+ genders == o.genders &&
503
+ dates_of_birth == o.dates_of_birth &&
504
+ last_names == o.last_names &&
505
+ first_names == o.first_names &&
506
+ cities == o.cities &&
507
+ country_codes == o.country_codes &&
508
+ states == o.states &&
509
+ zip_codes == o.zip_codes &&
510
+ external_ids == o.external_ids &&
327
511
  client_ip_address == o.client_ip_address &&
328
512
  client_user_agent == o.client_user_agent &&
329
513
  fbc == o.fbc &&
@@ -347,17 +531,17 @@ module FacebookAds
347
531
  # @return [Fixnum] Hash code
348
532
  def hash
349
533
  [
350
- email,
351
- phone,
352
- gender,
353
- date_of_birth,
354
- last_name,
355
- first_name,
356
- city,
357
- country_code,
358
- state,
359
- zip_code,
360
- external_id,
534
+ emails,
535
+ phones,
536
+ genders,
537
+ dates_of_birth,
538
+ last_names,
539
+ first_names,
540
+ cities,
541
+ country_codes,
542
+ states,
543
+ zip_codes,
544
+ external_ids,
361
545
  client_ip_address,
362
546
  client_user_agent,
363
547
  fbc,
@@ -378,38 +562,38 @@ module FacebookAds
378
562
  # @return [String] String presentation of the object
379
563
  def to_s
380
564
  hash = {}
381
- unless email.nil?
382
- hash['email'] = email
565
+ unless emails.nil?
566
+ hash['emails'] = emails
383
567
  end
384
- unless phone.nil?
385
- hash['phone'] = phone
568
+ unless phones.nil?
569
+ hash['phones'] = phones
386
570
  end
387
- unless gender.nil?
388
- hash['gender'] = gender
571
+ unless genders.nil?
572
+ hash['genders'] = genders
389
573
  end
390
- unless date_of_birth.nil?
391
- hash['date_of_birth'] = date_of_birth
574
+ unless dates_of_birth.nil?
575
+ hash['dates_of_birth'] = dates_of_birth
392
576
  end
393
- unless last_name.nil?
394
- hash['last_name'] = last_name
577
+ unless last_names.nil?
578
+ hash['last_names'] = last_names
395
579
  end
396
- unless first_name.nil?
397
- hash['first_name'] = first_name
580
+ unless first_names.nil?
581
+ hash['first_names'] = first_names
398
582
  end
399
- unless city.nil?
400
- hash['city'] = city
583
+ unless cities.nil?
584
+ hash['cities'] = cities
401
585
  end
402
- unless country_code.nil?
403
- hash['country_code'] = country_code
586
+ unless country_codes.nil?
587
+ hash['country_codes'] = country_codes
404
588
  end
405
- unless state.nil?
406
- hash['state'] = state
589
+ unless states.nil?
590
+ hash['states'] = states
407
591
  end
408
- unless zip_code.nil?
409
- hash['zip_code'] = zip_code
592
+ unless zip_codes.nil?
593
+ hash['zip_codes'] = zip_codes
410
594
  end
411
- unless external_id.nil?
412
- hash['external_id'] = external_id
595
+ unless external_ids.nil?
596
+ hash['external_ids'] = external_ids
413
597
  end
414
598
  unless client_ip_address.nil?
415
599
  hash['client_ip_address'] = client_ip_address
@@ -455,37 +639,37 @@ module FacebookAds
455
639
  def normalize
456
640
  hash = {}
457
641
  unless email.nil?
458
- hash['em'] = FacebookAds::ServerSide::Util.normalize(email, 'em')
642
+ hash['em'] = FacebookAds::ServerSide::Util.normalize_array(emails, 'em')
459
643
  end
460
644
  unless phone.nil?
461
- hash['ph'] = FacebookAds::ServerSide::Util.normalize(phone, 'ph')
645
+ hash['ph'] = FacebookAds::ServerSide::Util.normalize_array(phones, 'ph')
462
646
  end
463
647
  unless gender.nil?
464
- hash['ge'] = FacebookAds::ServerSide::Util.normalize(gender, 'ge')
648
+ hash['ge'] = FacebookAds::ServerSide::Util.normalize_array(genders, 'ge')
465
649
  end
466
650
  unless date_of_birth.nil?
467
- hash['db'] = FacebookAds::ServerSide::Util.normalize(date_of_birth, 'db')
651
+ hash['db'] = FacebookAds::ServerSide::Util.normalize_array(dates_of_birth, 'db')
468
652
  end
469
653
  unless last_name.nil?
470
- hash['ln'] = FacebookAds::ServerSide::Util.normalize(last_name, 'ln')
654
+ hash['ln'] = FacebookAds::ServerSide::Util.normalize_array(last_names, 'ln')
471
655
  end
472
656
  unless first_name.nil?
473
- hash['fn'] = FacebookAds::ServerSide::Util.normalize(first_name, 'fn')
657
+ hash['fn'] = FacebookAds::ServerSide::Util.normalize_array(first_names, 'fn')
474
658
  end
475
659
  unless city.nil?
476
- hash['ct'] = FacebookAds::ServerSide::Util.normalize(city, 'ct')
660
+ hash['ct'] = FacebookAds::ServerSide::Util.normalize_array(cities, 'ct')
477
661
  end
478
662
  unless country_code.nil?
479
- hash['country'] = FacebookAds::ServerSide::Util.normalize(country_code, 'country')
663
+ hash['country'] = FacebookAds::ServerSide::Util.normalize_array(country_codes, 'country')
480
664
  end
481
665
  unless state.nil?
482
- hash['st'] = FacebookAds::ServerSide::Util.normalize(state, 'st')
666
+ hash['st'] = FacebookAds::ServerSide::Util.normalize_array(states, 'st')
483
667
  end
484
668
  unless zip_code.nil?
485
- hash['zp'] = FacebookAds::ServerSide::Util.normalize(zip_code, 'zp')
669
+ hash['zp'] = FacebookAds::ServerSide::Util.normalize_array(zip_codes, 'zp')
486
670
  end
487
671
  unless external_id.nil?
488
- hash['external_id'] = external_id
672
+ hash['external_id'] = external_ids
489
673
  end
490
674
  unless client_ip_address.nil?
491
675
  hash['client_ip_address'] = client_ip_address
@@ -523,7 +707,17 @@ module FacebookAds
523
707
  unless doby.nil?
524
708
  hash['doby'] = FacebookAds::ServerSide::Util.normalize(doby, 'doby')
525
709
  end
526
- hash
710
+ hash.select{|k, v| !v.nil?}
711
+ end
712
+
713
+ def validate_constructor_values(multi_value, single_value, multi_string, single_string)
714
+ if !multi_value.nil? && !single_value.nil?
715
+ raise ArgumentError.new(
716
+ 'Cannot set both %s and %s parameters via constructor. ' % [
717
+ multi_string, single_string
718
+ ] + 'Please set either the multi or single parameter, not both.'
719
+ )
720
+ end
527
721
  end
528
722
  end
529
723
  end