facebook_ads 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.approvals +0 -0
  3. data/.coveralls.yml +1 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +13 -1
  6. data/.rubocop_todo.yml +16 -0
  7. data/.travis.yml +3 -1
  8. data/CHANGELOG.md +5 -0
  9. data/Gemfile +10 -7
  10. data/Gemfile.lock +56 -19
  11. data/LICENSE.md +22 -0
  12. data/README.md +8 -0
  13. data/facebook_ads.gemspec +2 -2
  14. data/lib/facebook_ads/ad.rb +2 -2
  15. data/lib/facebook_ads/ad_account.rb +52 -19
  16. data/lib/facebook_ads/ad_audience.rb +1 -1
  17. data/lib/facebook_ads/ad_campaign.rb +47 -5
  18. data/lib/facebook_ads/ad_creative.rb +4 -4
  19. data/lib/facebook_ads/ad_exception.rb +7 -1
  20. data/lib/facebook_ads/ad_image.rb +6 -2
  21. data/lib/facebook_ads/ad_insight.rb +1 -1
  22. data/lib/facebook_ads/ad_product.rb +1 -1
  23. data/lib/facebook_ads/ad_product_catalog.rb +1 -1
  24. data/lib/facebook_ads/ad_product_feed.rb +1 -1
  25. data/lib/facebook_ads/ad_product_set.rb +1 -1
  26. data/lib/facebook_ads/ad_set.rb +5 -5
  27. data/lib/facebook_ads/ad_targeting.rb +3 -3
  28. data/lib/facebook_ads/base.rb +10 -9
  29. data/spec/facebook_ads/ad_account_spec.rb +93 -0
  30. data/spec/facebook_ads/ad_campaign_spec.rb +19 -0
  31. data/spec/facebook_ads/ad_creative_spec.rb +4 -0
  32. data/spec/facebook_ads/ad_image_spec.rb +4 -0
  33. data/spec/facebook_ads/ad_insight_spec.rb +4 -0
  34. data/spec/facebook_ads/ad_product_catalog_spec.rb +27 -0
  35. data/spec/facebook_ads/ad_product_feed_spec.rb +4 -0
  36. data/spec/facebook_ads/ad_product_set_spec.rb +4 -0
  37. data/spec/facebook_ads/ad_product_spec.rb +21 -0
  38. data/spec/facebook_ads/ad_set_spec.rb +47 -0
  39. data/spec/facebook_ads/ad_spec.rb +4 -0
  40. data/spec/facebook_ads/ad_targeting_spec.rb +4 -0
  41. data/spec/facebook_ads/facebook_ads_spec.rb +15 -0
  42. data/spec/fixtures/approvals/facebookads_adaccount/ad_campaigns/lists_campaigns.approved.json +15 -0
  43. data/spec/fixtures/approvals/facebookads_adaccount/ad_creatives/lists_creatives.approved.json +1047 -0
  44. data/spec/fixtures/approvals/facebookads_adaccount/ad_images/lists_images.approved.json +11 -0
  45. data/spec/fixtures/approvals/facebookads_adaccount/ad_sets/lists_ad_sets.approved.json +3 -0
  46. data/spec/fixtures/approvals/facebookads_adaccount/ads/lists_ads.approved.json +3 -0
  47. data/spec/fixtures/approvals/facebookads_adaccount/all/lists_all_accounts.approved.json +92 -0
  48. data/spec/fixtures/approvals/facebookads_adaccount/create_ad_campaign/creates_a_new_ad_campaign.approved.json +13 -0
  49. data/spec/fixtures/approvals/facebookads_adaccount/create_ad_images/creates_an_image.approved.json +11 -0
  50. data/spec/fixtures/approvals/facebookads_adaccount/find_by/finds_a_specific_account.approved.json +9 -0
  51. data/spec/fixtures/approvals/facebookads_adaccount/reach_estimate/estimates_the_reach_of_a_targeting_spec.approved.json +358 -0
  52. data/spec/fixtures/cassettes/FacebookAds_AdAccount/_ad_campaigns/lists_campaigns.yml +56 -0
  53. data/spec/fixtures/cassettes/FacebookAds_AdAccount/_ad_creatives/lists_creatives.yml +91 -0
  54. data/spec/fixtures/cassettes/FacebookAds_AdAccount/_ad_images/lists_images.yml +56 -0
  55. data/spec/fixtures/cassettes/FacebookAds_AdAccount/_ad_sets/lists_ad_sets.yml +56 -0
  56. data/spec/fixtures/cassettes/FacebookAds_AdAccount/_ads/lists_ads.yml +56 -0
  57. data/spec/fixtures/cassettes/FacebookAds_AdAccount/_all/lists_all_accounts.yml +58 -0
  58. data/spec/fixtures/cassettes/FacebookAds_AdAccount/_create_ad_campaign/creates_a_new_ad_campaign.yml +115 -0
  59. data/spec/fixtures/cassettes/FacebookAds_AdAccount/_create_ad_images/creates_an_image.yml +2865 -0
  60. data/spec/fixtures/cassettes/FacebookAds_AdAccount/_find_by/finds_a_specific_account.yml +58 -0
  61. data/spec/fixtures/cassettes/FacebookAds_AdAccount/_reach_estimate/estimates_the_reach_of_a_targeting_spec.yml +56 -0
  62. data/spec/fixtures/cassettes/FacebookAds_AdCampaign/_destroy/creates_a_new_ad_campaign.yml +164 -0
  63. data/spec/spec_helper.rb +7 -0
  64. data/spec/support/approvals.rb +10 -0
  65. data/spec/support/facebook_ads.rb +4 -0
  66. data/spec/support/rest_client.rb +13 -0
  67. data/spec/support/vcr.rb +16 -0
  68. metadata +47 -29
  69. data/test/ad_account_test.rb +0 -27
  70. data/test/ad_campaign_test.rb +0 -32
  71. data/test/ad_creative_test.rb +0 -7
  72. data/test/ad_image_test.rb +0 -27
  73. data/test/ad_insight_test.rb +0 -7
  74. data/test/ad_product_catalog_test.rb +0 -28
  75. data/test/ad_product_feed_test.rb +0 -7
  76. data/test/ad_product_set_test.rb +0 -7
  77. data/test/ad_product_test.rb +0 -22
  78. data/test/ad_set_test.rb +0 -48
  79. data/test/ad_targeting_test.rb +0 -7
  80. data/test/ad_test.rb +0 -7
  81. data/test/facebook_ads_test.rb +0 -8
  82. data/test/test_helper.rb +0 -64
  83. data/test/vcr_cassettes/AdAccountTest-test_all.yml +0 -70
  84. data/test/vcr_cassettes/AdAccountTest-test_applications.yml +0 -130
  85. data/test/vcr_cassettes/AdAccountTest-test_find_by.yml +0 -71
  86. data/test/vcr_cassettes/AdCampaignTest-test_create.yml +0 -295
  87. data/test/vcr_cassettes/AdCampaignTest-test_list.yml +0 -133
  88. data/test/vcr_cassettes/AdImageTest-test_create.yml +0 -2963
  89. data/test/vcr_cassettes/AdImageTest-test_list.yml +0 -137
  90. data/test/vcr_cassettes/AdProductCatalogTest-test_all.yml +0 -60
  91. data/test/vcr_cassettes/AdProductCatalogTest-test_create.yml +0 -256
  92. data/test/vcr_cassettes/AdProductTest-test_list.yml +0 -130
  93. data/test/vcr_cassettes/AdSetTest-test_create.yml +0 -189
  94. data/test/vcr_cassettes/AdSetTest-test_destroy.yml +0 -124
  95. data/test/vcr_cassettes/AdSetTest-test_update.yml +0 -134
@@ -0,0 +1,11 @@
1
+ [
2
+ {
3
+ "id": "<object_id>",
4
+ "hash": "d8fc613662fb5ef6cf5fb9d1fe779315",
5
+ "account_id": "<object_id>",
6
+ "name": "13006112.jpg",
7
+ "permalink_url": "https://www.facebook.com/ads/image/?d=AQLSiUGsZ84fclezlh6EppSetpCqajyC5977Xg-Ez51AOlAJw17zgcoauXutWgj8v4Ggg9BHXtKSQs351gRUmSfOxfGutEPX2c9fASaamvnfsK-3DENLiahsMn7Ck4sdzL5ah92Rsx25nZJO81Vp9SEy",
8
+ "original_width": 570,
9
+ "original_height": 707
10
+ }
11
+ ]
@@ -0,0 +1,92 @@
1
+ [
2
+ {
3
+ "id": "<object_id>",
4
+ "account_id": "<object_id>",
5
+ "account_status": 1,
6
+ "age": "<duration>",
7
+ "created_time": "<time>",
8
+ "currency": "USD",
9
+ "name": "International II"
10
+ },
11
+ {
12
+ "id": "<object_id>",
13
+ "account_id": "<object_id>",
14
+ "account_status": 1,
15
+ "age": "<duration>",
16
+ "created_time": "<time>",
17
+ "currency": "USD",
18
+ "name": "Retargeting"
19
+ },
20
+ {
21
+ "id": "<object_id>",
22
+ "account_id": "<object_id>",
23
+ "account_status": 1,
24
+ "age": "<duration>",
25
+ "created_time": "<time>",
26
+ "currency": "USD",
27
+ "name": "DollarStart"
28
+ },
29
+ {
30
+ "id": "<object_id>",
31
+ "account_id": "<object_id>",
32
+ "account_status": 1,
33
+ "age": "<duration>",
34
+ "created_time": "<time>",
35
+ "currency": "USD",
36
+ "name": "LuxeJoy"
37
+ },
38
+ {
39
+ "id": "<object_id>",
40
+ "account_id": "<object_id>",
41
+ "account_status": 1,
42
+ "age": "<duration>",
43
+ "created_time": "<time>",
44
+ "currency": "USD",
45
+ "name": "Ruby"
46
+ },
47
+ {
48
+ "id": "<object_id>",
49
+ "account_id": "<object_id>",
50
+ "account_status": 1,
51
+ "age": "<duration>",
52
+ "created_time": "<time>",
53
+ "currency": "USD",
54
+ "name": "International"
55
+ },
56
+ {
57
+ "id": "<object_id>",
58
+ "account_id": "<object_id>",
59
+ "account_status": 1,
60
+ "age": "<duration>",
61
+ "created_time": "<time>",
62
+ "currency": "USD",
63
+ "name": "Web"
64
+ },
65
+ {
66
+ "id": "<object_id>",
67
+ "account_id": "<object_id>",
68
+ "account_status": 1,
69
+ "age": "<duration>",
70
+ "created_time": "<time>",
71
+ "currency": "USD",
72
+ "name": "Android"
73
+ },
74
+ {
75
+ "id": "<object_id>",
76
+ "account_id": "<object_id>",
77
+ "account_status": 1,
78
+ "age": "<duration>",
79
+ "created_time": "<time>",
80
+ "currency": "USD",
81
+ "name": "iOS"
82
+ },
83
+ {
84
+ "id": "<object_id>",
85
+ "account_id": "<object_id>",
86
+ "account_status": 1,
87
+ "age": "<duration>",
88
+ "created_time": "<time>",
89
+ "currency": "USD",
90
+ "name": "Chris Estreich"
91
+ }
92
+ ]
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "<object_id>",
3
+ "account_id": "<object_id>",
4
+ "buying_type": "AUCTION",
5
+ "can_use_spend_cap": true,
6
+ "configured_status": "ACTIVE",
7
+ "created_time": "<time>",
8
+ "effective_status": "ACTIVE",
9
+ "name": "Test",
10
+ "objective": "MOBILE_APP_INSTALLS",
11
+ "start_time": "<time>",
12
+ "updated_time": "<time>"
13
+ }
@@ -0,0 +1,11 @@
1
+ [
2
+ {
3
+ "id": "<object_id>",
4
+ "hash": "d8fc613662fb5ef6cf5fb9d1fe779315",
5
+ "account_id": "<object_id>",
6
+ "name": "13006112.jpg",
7
+ "permalink_url": "https://www.facebook.com/ads/image/?d=AQLp8EY4ZBMuyA2IRu5KoMMGwOwspA0KGY9SK9uTTnraQslGCrCuNBdqGZeyJCuonk6EdxwMdMunNLPPo--FC8MNqYS0wuSON5orNs7iSiai_FE2jCWIN6GjXn2PEWCCmZ5tdn6Z7JYhUoLq1PAN7fUg",
8
+ "original_width": 570,
9
+ "original_height": 707
10
+ }
11
+ ]
@@ -0,0 +1,9 @@
1
+ {
2
+ "id": "<object_id>",
3
+ "account_id": "<object_id>",
4
+ "account_status": 1,
5
+ "age": "<duration>",
6
+ "created_time": "<time>",
7
+ "currency": "USD",
8
+ "name": "iOS"
9
+ }
@@ -0,0 +1,358 @@
1
+ {
2
+ "data": {
3
+ "users": 7800000,
4
+ "bid_estimations": [
5
+ {
6
+ "unsupported": false,
7
+ "location": 3,
8
+ "reach_min": 0,
9
+ "reach_max": 0,
10
+ "cpm_curve_data": "",
11
+ "cpc_curve_data": "",
12
+ "cpa_curve_data": "",
13
+ "dedup_winning_rate": 0,
14
+ "dedup_status": 0,
15
+ "pacing_status": 0,
16
+ "account_budget": 150000,
17
+ "estimate_DAU": 0,
18
+ "curve": [
19
+ {
20
+ "bid": 0,
21
+ "spend": 0,
22
+ "reach": 0,
23
+ "impressions": 0,
24
+ "actions": 0
25
+ },
26
+ {
27
+ "bid": 1,
28
+ "spend": 274,
29
+ "reach": 665.35523611293,
30
+ "impressions": 827.9031969689,
31
+ "actions": 1.844446952004
32
+ },
33
+ {
34
+ "bid": 2,
35
+ "spend": 526,
36
+ "reach": 1163.1983230804,
37
+ "impressions": 1498.1938839748,
38
+ "actions": 3.3097915123364
39
+ },
40
+ {
41
+ "bid": 2,
42
+ "spend": 663,
43
+ "reach": 1449.9428012725,
44
+ "impressions": 1965.3471118416,
45
+ "actions": 3.8865028313425
46
+ },
47
+ {
48
+ "bid": 4,
49
+ "spend": 812,
50
+ "reach": 1723.4117950617,
51
+ "impressions": 2473.5614735407,
52
+ "actions": 4.4628495280986
53
+ },
54
+ {
55
+ "bid": 5,
56
+ "spend": 936,
57
+ "reach": 1900.1942347956,
58
+ "impressions": 2851.3396208895,
59
+ "actions": 4.8916792752631
60
+ },
61
+ {
62
+ "bid": 8,
63
+ "spend": 1125,
64
+ "reach": 2112.2675174642,
65
+ "impressions": 3141.0211175368,
66
+ "actions": 5.4835039900258
67
+ },
68
+ {
69
+ "bid": 10,
70
+ "spend": 1298,
71
+ "reach": 2305.049580969,
72
+ "impressions": 3367.1317720084,
73
+ "actions": 5.730963529418
74
+ },
75
+ {
76
+ "bid": 15,
77
+ "spend": 1934,
78
+ "reach": 3230.5069725617,
79
+ "impressions": 4310.4008024568,
80
+ "actions": 6.4202204250965
81
+ },
82
+ {
83
+ "bid": 22,
84
+ "spend": 3238,
85
+ "reach": 4999.4757279719,
86
+ "impressions": 6152.5432742153,
87
+ "actions": 7.1834806443477
88
+ },
89
+ {
90
+ "bid": 27,
91
+ "spend": 4299,
92
+ "reach": 6533.721313125,
93
+ "impressions": 7699.448129965,
94
+ "actions": 8.6054391349527
95
+ },
96
+ {
97
+ "bid": 40,
98
+ "spend": 7899,
99
+ "reach": 11871.078977638,
100
+ "impressions": 13548.856717159,
101
+ "actions": 11.27562137411
102
+ },
103
+ {
104
+ "bid": 47,
105
+ "spend": 9490,
106
+ "reach": 14582.158446565,
107
+ "impressions": 16569.386121142,
108
+ "actions": 13.314717583351
109
+ },
110
+ {
111
+ "bid": 57,
112
+ "spend": 11723,
113
+ "reach": 17587.530425269,
114
+ "impressions": 21303.883577031,
115
+ "actions": 15.766131666688
116
+ },
117
+ {
118
+ "bid": 84,
119
+ "spend": 14431,
120
+ "reach": 21432.209480504,
121
+ "impressions": 26061.214471774,
122
+ "actions": 19.406462787096
123
+ },
124
+ {
125
+ "bid": 101,
126
+ "spend": 16022,
127
+ "reach": 24525.142003591,
128
+ "impressions": 29660.727503464,
129
+ "actions": 21.54425609427
130
+ },
131
+ {
132
+ "bid": 122,
133
+ "spend": 17700,
134
+ "reach": 26828.58937358,
135
+ "impressions": 31967.399503751,
136
+ "actions": 23.799962200198
137
+ },
138
+ {
139
+ "bid": 147,
140
+ "spend": 19628,
141
+ "reach": 30175.23244102,
142
+ "impressions": 35314.042571191,
143
+ "actions": 26.392152620471
144
+ },
145
+ {
146
+ "bid": 177,
147
+ "spend": 21694,
148
+ "reach": 32092.16258664,
149
+ "impressions": 37230.972716811,
150
+ "actions": 29.168515834035
151
+ },
152
+ {
153
+ "bid": 213,
154
+ "spend": 23596,
155
+ "reach": 34888.910126101,
156
+ "impressions": 40027.720256271,
157
+ "actions": 31.725230576813
158
+ },
159
+ {
160
+ "bid": 256,
161
+ "spend": 24939,
162
+ "reach": 36131.724236534,
163
+ "impressions": 41270.534366704,
164
+ "actions": 33.531023721496
165
+ },
166
+ {
167
+ "bid": 308,
168
+ "spend": 26186,
169
+ "reach": 37283.80781754,
170
+ "impressions": 42422.61794771,
171
+ "actions": 35.205910114206
172
+ },
173
+ {
174
+ "bid": 370,
175
+ "spend": 27383,
176
+ "reach": 37905.607606266,
177
+ "impressions": 43044.417736436,
178
+ "actions": 36.814312335639
179
+ },
180
+ {
181
+ "bid": 444,
182
+ "spend": 28499,
183
+ "reach": 38405.557187601,
184
+ "impressions": 43544.367317772,
185
+ "actions": 38.313739084408
186
+ },
187
+ {
188
+ "bid": 533,
189
+ "spend": 29698,
190
+ "reach": 39546.688281769,
191
+ "impressions": 44685.49841194,
192
+ "actions": 39.656810833811
193
+ },
194
+ {
195
+ "bid": 640,
196
+ "spend": 31184,
197
+ "reach": 41472.249614977,
198
+ "impressions": 46611.059745148,
199
+ "actions": 41.373272371441
200
+ },
201
+ {
202
+ "bid": 922,
203
+ "spend": 35827,
204
+ "reach": 48391.963932271,
205
+ "impressions": 53530.774062441,
206
+ "actions": 45.075853954274
207
+ },
208
+ {
209
+ "bid": 1107,
210
+ "spend": 39709,
211
+ "reach": 53747.037689427,
212
+ "impressions": 58885.847819598,
213
+ "actions": 49.489685866067
214
+ },
215
+ {
216
+ "bid": 1329,
217
+ "spend": 45179,
218
+ "reach": 60060.430481269,
219
+ "impressions": 65753.059986957,
220
+ "actions": 54.267655742793
221
+ },
222
+ {
223
+ "bid": 1595,
224
+ "spend": 53180,
225
+ "reach": 69786.743584613,
226
+ "impressions": 77317.033425851,
227
+ "actions": 62.359947825847
228
+ },
229
+ {
230
+ "bid": 1913,
231
+ "spend": 65276,
232
+ "reach": 84784.720400015,
233
+ "impressions": 95873.895875409,
234
+ "actions": 66.960827621477
235
+ },
236
+ {
237
+ "bid": 2297,
238
+ "spend": 81863,
239
+ "reach": 103041.98891234,
240
+ "impressions": 120697.15260441,
241
+ "actions": 77.269757936654
242
+ },
243
+ {
244
+ "bid": 3309,
245
+ "spend": 136501,
246
+ "reach": 167574.26626847,
247
+ "impressions": 189994.57016726,
248
+ "actions": 90.860754621151
249
+ },
250
+ {
251
+ "bid": 3971,
252
+ "spend": 182286,
253
+ "reach": 222048.88406388,
254
+ "impressions": 254973.91945963,
255
+ "actions": 109.32189156425
256
+ },
257
+ {
258
+ "bid": 4766,
259
+ "spend": 246337,
260
+ "reach": 299776.66361403,
261
+ "impressions": 342712.47277228,
262
+ "actions": 138.64450516775
263
+ },
264
+ {
265
+ "bid": 5719,
266
+ "spend": 341398,
267
+ "reach": 386588.9015888,
268
+ "impressions": 461779.5253937,
269
+ "actions": 181.37754407679
270
+ },
271
+ {
272
+ "bid": 6864,
273
+ "spend": 478510,
274
+ "reach": 496931.95796472,
275
+ "impressions": 607707.7247427,
276
+ "actions": 231.49943408876
277
+ },
278
+ {
279
+ "bid": 8237,
280
+ "spend": 676355,
281
+ "reach": 619538.42237559,
282
+ "impressions": 751645.34682434,
283
+ "actions": 274.9990270277
284
+ },
285
+ {
286
+ "bid": 9885,
287
+ "spend": 960405,
288
+ "reach": 748467.48474108,
289
+ "impressions": 928066.97109742,
290
+ "actions": 325.35941461337
291
+ },
292
+ {
293
+ "bid": 11862,
294
+ "spend": 1369167,
295
+ "reach": 928642.86327858,
296
+ "impressions": 1170092.1075589,
297
+ "actions": 360.04107458364
298
+ },
299
+ {
300
+ "bid": 14235,
301
+ "spend": 1957798,
302
+ "reach": 1178959.5945031,
303
+ "impressions": 1516323.3647044,
304
+ "actions": 409.85606432875
305
+ },
306
+ {
307
+ "bid": 17082,
308
+ "spend": 2806068,
309
+ "reach": 1371791.0770766,
310
+ "impressions": 1935441.7757471,
311
+ "actions": 485.28413349418
312
+ },
313
+ {
314
+ "bid": 20499,
315
+ "spend": 4028534,
316
+ "reach": 1496482.3840336,
317
+ "impressions": 2129988.0253193,
318
+ "actions": 514.5642743302
319
+ },
320
+ {
321
+ "bid": 24599,
322
+ "spend": 5790336,
323
+ "reach": 1539483.8268748,
324
+ "impressions": 2236800.8704945,
325
+ "actions": 538.37829905621
326
+ },
327
+ {
328
+ "bid": 29519,
329
+ "spend": 8273482,
330
+ "reach": 1551605.2113853,
331
+ "impressions": 2248922.2550049,
332
+ "actions": 554.45306018194
333
+ },
334
+ {
335
+ "bid": 35423,
336
+ "spend": 11576398,
337
+ "reach": 1551605.2113853,
338
+ "impressions": 2248922.2550049,
339
+ "actions": 562.93342303933
340
+ },
341
+ {
342
+ "bid": 40000,
343
+ "spend": 14647415,
344
+ "reach": 1551605.2113853,
345
+ "impressions": 2248922.2550049,
346
+ "actions": 562.93342303933
347
+ }
348
+ ],
349
+ "trace_id": "3bb7e83531ec9904bbb97953c7ab58b6",
350
+ "is_curve_eligible": false,
351
+ "bid_amount_min": 1172,
352
+ "bid_amount_median": 1495,
353
+ "bid_amount_max": 2014
354
+ }
355
+ ],
356
+ "estimate_ready": true
357
+ }
358
+ }