facebook_ads 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35a61cb9e965397a7e50da136ce697ed6ea3437e
4
- data.tar.gz: ce5c09cf7acd43f39b0aa8f82d87d3a21962d50e
3
+ metadata.gz: 2950d5afaedd6ff1eae3cc4c1748af994352f8c4
4
+ data.tar.gz: 45974dfe4489e421034063073afc60ff0da626ab
5
5
  SHA512:
6
- metadata.gz: 1ad4ac70297f77209589c34323fd9af60d5721e8824cd2b3380e9a320c89de7124b45dd7a1133be489a362a631d35a873e00f059e10c2b9835231eae7f41f9c1
7
- data.tar.gz: 365dda2ba4b84cdc4d7d86ca95ba1ccfdfd399dbc34664c2aa800cbba44b2cd41d3e181989653b03dc7821a9071dda4ef96f1b25f947aa71b7fd3861e1d8c236
6
+ metadata.gz: feb0abb421b099bac74ce6d4c2435b5e89ed5e130ac09b69fbcb27e8d3a3119c3996d3bcdaa41c80e499b7c1ea2e53094929145129b3bfb74b75101f801a8553
7
+ data.tar.gz: 5232f32b4a0db618c112eee2f6ed81290aaf9b39abce48e0800e8e947595cd375ad8d95380de8a2bbe7add8c4f9e31bfe2eb87d859ee1b15be1c6a640d6e1afb
data/README.md CHANGED
@@ -341,6 +341,25 @@ ad_set.destroy
341
341
 
342
342
  ___
343
343
 
344
+ ### [Ad Set Activities](https://developers.facebook.com/docs/marketing-api/reference/ad-activity) (Fetch)
345
+
346
+ You interact with activities via an ad set:
347
+ ```ruby
348
+ ad_set = account.ad_sets(effective_status: nil).first
349
+ ```
350
+
351
+ Fetch all activities in last 24 hours for an ad set:
352
+ ```ruby
353
+ activities = ad_set.activities
354
+ ```
355
+
356
+ Fetch all activities in last 48 hours for an ad set:
357
+ ```ruby
358
+ activities = ad_set.activities(since: 2.days.ago)
359
+ ```
360
+
361
+ ___
362
+
344
363
  ### [Ads](https://developers.facebook.com/docs/marketing-api/reference/adgroup) (Fetch, Find, Create, Update, Destroy)
345
364
 
346
365
  You interact with ads via an ad set:
data/facebook_ads.gemspec CHANGED
@@ -6,7 +6,7 @@
6
6
  # gem push facebook_ads-0.6.4.gem
7
7
  Gem::Specification.new do |s|
8
8
  s.name = 'facebook_ads'
9
- s.version = '0.6.4'
9
+ s.version = '0.6.5'
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.licenses = ['MIT']
12
12
  s.authors = ['Chris Estreich']
@@ -108,5 +108,10 @@ module FacebookAds
108
108
 
109
109
  AdInsight.paginate("/#{id}/insights", query: query)
110
110
  end
111
+
112
+ # Retrieves activities for ad set (in last 24 hours by default)
113
+ def activities(since: 1.day.ago)
114
+ AdSetActivity.get("/#{id}/activities", objectify: true).select { |activity| activity['event_time'] > since }
115
+ end
111
116
  end
112
117
  end
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FacebookAds
4
+ # https://developers.facebook.com/docs/marketing-api/reference/ad-activity/
5
+ class AdSetActivity < Base
6
+ FIELDS = %w[
7
+ actor_id
8
+ actor_name
9
+ event_time
10
+ event_type
11
+ extra_data
12
+ ].freeze
13
+
14
+ CATEGORIES = %w[
15
+ ACCOUNT
16
+ AD
17
+ AD_SET
18
+ AUDIENCE
19
+ BID
20
+ BUDGET
21
+ CAMPAIGN
22
+ DATE
23
+ STATUS
24
+ TARGETING
25
+ ].freeze
26
+
27
+ EVENT_TYPES = %w[
28
+ ad_account_update
29
+ spend_limit
30
+ ad_account_reset_spend_limit
31
+ ad_account_remove_spend_limit
32
+ ad_account_set_business_information
33
+ ad_account_update_status
34
+ ad_account_add_user_to_role
35
+ ad_account_remove_user_from_role
36
+ add_images
37
+ edit_images
38
+ delete_images
39
+ ad_account_billing_charge
40
+ ad_account_billing_charge_failed
41
+ ad_account_billing_chargeback
42
+ ad_account_billing_chargeback_reversal
43
+ ad_account_billing_decline
44
+ ad_account_billing_refund
45
+ billing_event
46
+ add_funding_source
47
+ remove_funding_source
48
+ create_campaign_group
49
+ update_campaign_name
50
+ update_campaign_run_status
51
+ update_campaign_group_spend_cap
52
+ create_campaign_legacy
53
+ update_campaign_budget
54
+ update_campaign_duration
55
+ campaign_ended
56
+ create_ad_set
57
+ update_ad_set_bidding
58
+ update_ad_set_bid_strategy
59
+ update_ad_set_budget
60
+ update_ad_set_duration
61
+ update_ad_set_run_status
62
+ update_ad_set_name
63
+ update_ad_set_optimization_goal
64
+ update_ad_set_target_spec
65
+ update_ad_set_bid_adjustments
66
+ create_ad
67
+ ad_review_approved
68
+ ad_review_declined
69
+ update_ad_creative
70
+ edit_and_update_ad_creative
71
+ update_ad_bid_info
72
+ update_ad_bid_type
73
+ update_ad_run_status
74
+ update_ad_run_status_to_be_set_after_review
75
+ update_ad_friendly_name
76
+ update_ad_targets_spec
77
+ update_adgroup_stop_delivery
78
+ first_delivery_event
79
+ create_audience
80
+ update_audience
81
+ delete_audience
82
+ share_audience
83
+ receive_audience
84
+ unshare_audience
85
+ remove_shared_audience
86
+ unknown
87
+ account_spending_limit_reached
88
+ campaign_spending_limit_reached
89
+ lifetime_budget_spent
90
+ funding_event_initiated
91
+ funding_event_successful
92
+ update_ad_labels
93
+ di_ad_set_learning_stage_exit
94
+ ].freeze
95
+
96
+ # belongs_to ad_set
97
+
98
+ def ad_set
99
+ @ad_set ||= AdSet.find(ad_set_id)
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe FacebookAds::AdSetActivity do
6
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebook_ads
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Estreich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-03 00:00:00.000000000 Z
11
+ date: 2018-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -74,6 +74,7 @@ files:
74
74
  - lib/facebook_ads/ad_product_feed.rb
75
75
  - lib/facebook_ads/ad_product_set.rb
76
76
  - lib/facebook_ads/ad_set.rb
77
+ - lib/facebook_ads/ad_set_activity.rb
77
78
  - lib/facebook_ads/ad_targeting.rb
78
79
  - lib/facebook_ads/ad_user.rb
79
80
  - lib/facebook_ads/advertisable_application.rb
@@ -87,6 +88,7 @@ files:
87
88
  - spec/facebook_ads/ad_product_feed_spec.rb
88
89
  - spec/facebook_ads/ad_product_set_spec.rb
89
90
  - spec/facebook_ads/ad_product_spec.rb
91
+ - spec/facebook_ads/ad_set_activity_spec.rb
90
92
  - spec/facebook_ads/ad_set_spec.rb
91
93
  - spec/facebook_ads/ad_spec.rb
92
94
  - spec/facebook_ads/ad_targeting_spec.rb
@@ -153,6 +155,7 @@ test_files:
153
155
  - spec/facebook_ads/ad_product_feed_spec.rb
154
156
  - spec/facebook_ads/ad_product_set_spec.rb
155
157
  - spec/facebook_ads/ad_product_spec.rb
158
+ - spec/facebook_ads/ad_set_activity_spec.rb
156
159
  - spec/facebook_ads/ad_set_spec.rb
157
160
  - spec/facebook_ads/ad_spec.rb
158
161
  - spec/facebook_ads/ad_targeting_spec.rb