class FacebookAds::Ad
An ad belongs to an ad set. It is created using an ad creative. developers.facebook.com/docs/marketing-api/reference/adgroup
Constants
- FIELDS
- STATUSES
Public Instance Methods
ad_account()
click to toggle source
belongs_to ad_account
# File lib/facebook_ads/ad.rb, line 12 def ad_account @ad_account ||= AdAccount.find(account_id) end
ad_campaign()
click to toggle source
belongs_to ad_campaign
# File lib/facebook_ads/ad.rb, line 18 def ad_campaign @ad_campaign ||= AdCampaign.find(campaign_id) end
ad_creative()
click to toggle source
belongs_to ad_creative
# File lib/facebook_ads/ad.rb, line 30 def ad_creative @ad_creative ||= AdCreative.find(creative['id']) end
ad_insights(range: Date.today..Date.today, level: 'ad', time_increment: 1)
click to toggle source
has_many ad_insights
# File lib/facebook_ads/ad.rb, line 36 def ad_insights(range: Date.today..Date.today, level: 'ad', time_increment: 1) query = { level: level, time_increment: time_increment, time_range: { 'since': range.first.to_s, 'until': range.last.to_s } } AdInsight.paginate("/#{id}/insights", query: query) end
ad_set()
click to toggle source
belongs_to ad_set
# File lib/facebook_ads/ad.rb, line 24 def ad_set @ad_set ||= AdSet.find(adset_id) end