Skip to content

Commit

Permalink
Cleans up class as well as updates readme (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
amosharrafa authored Nov 26, 2018
1 parent 3b18308 commit 48f4fb6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,25 @@ ad_set.destroy

___

### [Ad Set Activities](https://developers.facebook.com/docs/marketing-api/reference/ad-activity) (Fetch)

You interact with activities via an ad set:
```ruby
ad_set = account.ad_sets(effective_status: nil).first
```

Fetch all activities in last 24 hours for an ad set:
```ruby
activities = ad_set.activities
```

Fetch all activities in last 48 hours for an ad set:
```ruby
activities = ad_set.activities(since: 2.days.ago)
```

___

### [Ads](https://developers.facebook.com/docs/marketing-api/reference/adgroup) (Fetch, Find, Create, Update, Destroy)

You interact with ads via an ad set:
Expand Down
2 changes: 1 addition & 1 deletion lib/facebook_ads/ad_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def ad_insights(range: Date.today..Date.today, level: nil, breakdowns: [], field
end

# Retrieves activities for ad set (in last 24 hours by default)
def activities(since = 1.day.ago)
def activities(since: 1.day.ago)
AdSetActivity.get("/#{id}/activities", objectify: true).select { |activity| activity['event_time'] > since }
end
end
Expand Down
3 changes: 0 additions & 3 deletions lib/facebook_ads/ad_set_activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

module FacebookAds
# https://developers.facebook.com/docs/marketing-api/reference/ad-activity/
# curl -G
# -d 'fields=actor_id,actor_name,event_time,event_type,extra_data,translated_event_type'
# -d 'access_token=<access_token>' https://graph.facebook.com/v3.1/<ad_set_id>/activities
class AdSetActivity < Base
FIELDS = %w[
actor_id
Expand Down

0 comments on commit 48f4fb6

Please sign in to comment.