facebookbusiness 0.9.0.0 → 0.10.0.1

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.rb +4 -1
  3. data/lib/facebook_ads/ad_objects/ad_account.rb +11 -45
  4. data/lib/facebook_ads/ad_objects/ad_account_delivery_estimate.rb +1 -0
  5. data/lib/facebook_ads/ad_objects/ad_account_matched_search_applications_edge_data.rb +1 -0
  6. data/lib/facebook_ads/ad_objects/ad_account_targeting_unified.rb +3 -1
  7. data/lib/facebook_ads/ad_objects/ad_asset_feed_spec.rb +3 -0
  8. data/lib/facebook_ads/ad_objects/ad_campaign_activity.rb +6 -2
  9. data/lib/facebook_ads/ad_objects/ad_campaign_delivery_estimate.rb +1 -0
  10. data/lib/facebook_ads/ad_objects/ad_creative.rb +9 -7
  11. data/lib/facebook_ads/ad_objects/ad_creative_link_data_call_to_action.rb +2 -0
  12. data/lib/facebook_ads/ad_objects/{read_only_analytics_user_property_config.rb → ad_creative_omnichannel_link_spec.rb} +5 -3
  13. data/lib/facebook_ads/ad_objects/ad_creative_portrait_customizations.rb +1 -0
  14. data/lib/facebook_ads/ad_objects/ad_preview.rb +4 -0
  15. data/lib/facebook_ads/ad_objects/ad_report_run.rb +1 -0
  16. data/lib/facebook_ads/ad_objects/ad_rule_evaluation_spec.rb +1 -2
  17. data/lib/facebook_ads/ad_objects/ad_rule_execution_spec.rb +1 -2
  18. data/lib/facebook_ads/ad_objects/ad_set.rb +6 -2
  19. data/lib/facebook_ads/ad_objects/ad_study.rb +8 -11
  20. data/lib/facebook_ads/ad_objects/ad_study_objective.rb +3 -0
  21. data/lib/facebook_ads/ad_objects/ad_video.rb +18 -17
  22. data/lib/facebook_ads/ad_objects/adgroup_activity.rb +0 -2
  23. data/lib/facebook_ads/ad_objects/adgroup_placement_specific_review_feedback.rb +1 -0
  24. data/lib/facebook_ads/ad_objects/adoptable_pet.rb +18 -0
  25. data/lib/facebook_ads/ad_objects/ads_action_stats.rb +2 -0
  26. data/lib/facebook_ads/ad_objects/ads_insights.rb +3 -1
  27. data/lib/facebook_ads/ad_objects/ads_pixel.rb +5 -0
  28. data/lib/facebook_ads/ad_objects/album.rb +0 -10
  29. data/lib/facebook_ads/ad_objects/application.rb +22 -10
  30. data/lib/facebook_ads/ad_objects/atlas_campaign.rb +0 -8
  31. data/lib/facebook_ads/ad_objects/automotive_model.rb +43 -0
  32. data/lib/facebook_ads/ad_objects/business.rb +40 -3
  33. data/lib/facebook_ads/ad_objects/business_asset_group.rb +2 -0
  34. data/lib/facebook_ads/ad_objects/campaign.rb +5 -4
  35. data/lib/facebook_ads/ad_objects/{user_payment_modules_options.rb → catalog_item_channels_to_integrity_status.rb} +3 -5
  36. data/lib/facebook_ads/ad_objects/catalog_sub_vertical_list.rb +3 -1
  37. data/lib/facebook_ads/ad_objects/comment.rb +3 -1
  38. data/lib/facebook_ads/ad_objects/commerce_merchant_settings.rb +2 -0
  39. data/lib/facebook_ads/ad_objects/content_delivery_report.rb +4 -0
  40. data/lib/facebook_ads/ad_objects/{offline_terms_of_service.rb → contextual_bundling_spec.rb} +4 -4
  41. data/lib/facebook_ads/ad_objects/cpas_parent_catalog_settings.rb +1 -0
  42. data/lib/facebook_ads/ad_objects/custom_audience.rb +8 -12
  43. data/lib/facebook_ads/ad_objects/custom_audience_data_source.rb +1 -0
  44. data/lib/facebook_ads/ad_objects/delivery_window.rb +287 -0
  45. data/lib/facebook_ads/ad_objects/destination.rb +18 -0
  46. data/lib/facebook_ads/ad_objects/flight.rb +18 -0
  47. data/lib/facebook_ads/ad_objects/group.rb +38 -22
  48. data/lib/facebook_ads/ad_objects/home_listing.rb +18 -0
  49. data/lib/facebook_ads/ad_objects/hotel.rb +18 -0
  50. data/lib/facebook_ads/ad_objects/ig_media.rb +2 -1
  51. data/lib/facebook_ads/ad_objects/ig_user.rb +6 -1
  52. data/lib/facebook_ads/ad_objects/image_copyright.rb +302 -0
  53. data/lib/facebook_ads/ad_objects/insights_result.rb +1 -1
  54. data/lib/facebook_ads/ad_objects/instagram_user.rb +0 -3
  55. data/lib/facebook_ads/ad_objects/{invoice_campaign.rb → invoice_campaign_new.rb} +1 -1
  56. data/lib/facebook_ads/ad_objects/link.rb +0 -10
  57. data/lib/facebook_ads/ad_objects/live_video.rb +20 -13
  58. data/lib/facebook_ads/ad_objects/messenger_profile.rb +1 -0
  59. data/lib/facebook_ads/ad_objects/{event_tour.rb → omega_customer_trx.rb} +28 -20
  60. data/lib/facebook_ads/ad_objects/oracle_transaction.rb +1 -6
  61. data/lib/facebook_ads/ad_objects/page.rb +49 -11
  62. data/lib/facebook_ads/ad_objects/page_call_to_action.rb +3 -0
  63. data/lib/facebook_ads/ad_objects/page_commerce_eligibility.rb +38 -0
  64. data/lib/facebook_ads/ad_objects/page_post.rb +0 -10
  65. data/lib/facebook_ads/ad_objects/payment_engine_payment.rb +73 -0
  66. data/lib/facebook_ads/ad_objects/payment_subscription.rb +3 -3
  67. data/lib/facebook_ads/ad_objects/photo.rb +0 -10
  68. data/lib/facebook_ads/ad_objects/post.rb +12 -40
  69. data/lib/facebook_ads/ad_objects/private_lift_study_instance.rb +46 -0
  70. data/lib/facebook_ads/ad_objects/product_catalog.rb +29 -2
  71. data/lib/facebook_ads/ad_objects/product_feed.rb +17 -1
  72. data/lib/facebook_ads/ad_objects/product_feed_schedule.rb +2 -0
  73. data/lib/facebook_ads/ad_objects/product_item.rb +17 -1
  74. data/lib/facebook_ads/ad_objects/{user_payment_methods_info.rb → product_item_ar_data.rb} +24 -8
  75. data/lib/facebook_ads/ad_objects/product_set.rb +7 -0
  76. data/lib/facebook_ads/ad_objects/saved_audience.rb +1 -0
  77. data/lib/facebook_ads/ad_objects/server_side/action_source.rb +48 -0
  78. data/lib/facebook_ads/ad_objects/server_side/event.rb +32 -6
  79. data/lib/facebook_ads/ad_objects/server_side/user_data.rb +290 -96
  80. data/lib/facebook_ads/ad_objects/server_side/util.rb +29 -1
  81. data/lib/facebook_ads/ad_objects/system_user.rb +20 -0
  82. data/lib/facebook_ads/ad_objects/targeting.rb +0 -2
  83. data/lib/facebook_ads/ad_objects/unified_thread.rb +0 -1
  84. data/lib/facebook_ads/ad_objects/user.rb +18 -13
  85. data/lib/facebook_ads/ad_objects/vehicle.rb +18 -0
  86. data/lib/facebook_ads/ad_objects/vehicle_offer.rb +18 -0
  87. data/lib/facebook_ads/ad_objects/whats_app_business_account.rb +1 -0
  88. data/lib/facebook_ads/ad_objects/{friend_list.rb → whats_app_business_profile.rb} +3 -5
  89. data/lib/facebook_ads/edge.rb +2 -1
  90. data/lib/facebook_ads/version.rb +2 -2
  91. metadata +23 -19
  92. data/lib/facebook_ads/ad_objects/ad_account_creation_request.rb +0 -71
  93. data/lib/facebook_ads/ad_objects/ad_account_roas.rb +0 -65
@@ -25,15 +25,31 @@ module FacebookAds
25
25
  # on github and we'll fix in our codegen framework. We'll not be able to accept
26
26
  # pull request for this class.
27
27
 
28
- class UserPaymentMethodsInfo < AdObject
28
+ class ProductItemArData < AdObject
29
+ SURFACES = [
30
+ "B2C_MARKETPLACE",
31
+ "C2C_MARKETPLACE",
32
+ "DA",
33
+ "DAILY_DEALS",
34
+ "DAILY_DEALS_LEGACY",
35
+ "IG_PRODUCT_TAGGING",
36
+ "MARKETPLACE",
37
+ "MARKETPLACE_ADS_DEPRECATED",
38
+ "MARKETPLACE_SHOPS",
39
+ "OFFLINE_CONVERSIONS",
40
+ "SHOPS",
41
+ "UNIVERSAL_CHECKOUT",
42
+ "WHATSAPP",
43
+ ]
29
44
 
30
- field :account_id, 'string'
31
- field :available_card_types, { list: 'string' }
32
- field :available_payment_methods, { list: 'string' }
33
- field :available_payment_methods_details, { list: 'object' }
34
- field :country, 'string'
35
- field :currency, 'string'
36
- field :existing_payment_methods, { list: 'object' }
45
+
46
+ field :container_effect, 'string'
47
+ field :effect_icon, 'string'
48
+ field :effect_parameters, 'object'
49
+ field :picker_icon, 'string'
50
+ field :product_ar_link, 'object'
51
+ field :state, 'string'
52
+ field :surfaces, { list: { enum: -> { SURFACES }} }
37
53
  has_no_id
38
54
  has_no_get
39
55
  has_no_post
@@ -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'
@@ -0,0 +1,48 @@
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
+ ActionSource = Set[
22
+
23
+ # Conversion happened over email.
24
+ 'email',
25
+
26
+ # Conversion was made on your website.
27
+ 'website',
28
+
29
+ # Conversion was made using your app.
30
+ 'app',
31
+
32
+ # Conversion was made over the phone.
33
+ 'phone_call',
34
+
35
+ # Conversion was made via a messaging app, SMS, or online messaging feature.
36
+ 'chat',
37
+
38
+ # Conversion was made in person at your physical store.
39
+ 'physical_store',
40
+
41
+ # Conversion happened automatically, for example, a subscription renewal that's set on auto-pay each month.
42
+ 'system_generated',
43
+
44
+ # Conversion happened in a way that is not listed.
45
+ 'other'
46
+ ]
47
+ end
48
+ 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.custom_data = attributes[:'data_processing_options']
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.custom_data = attributes[:'data_processing_options_country']
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.custom_data = attributes[:'data_processing_options_state']
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
- [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
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
 
@@ -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