Sha256: fec8a4405fda414a433d9a48bcefaf17d4639706a2f6fb334ca393e857da0ac3

Contents?: true

Size: 992 Bytes

Versions: 5

Compression:

Stored size: 992 Bytes

Contents

module FacebookAds
  # An ad belongs to an ad set. It is created using an ad creative.
  # https://developers.facebook.com/docs/marketing-api/reference/adgroup
  class Ad < Base
    FIELDS   = %w(id account_id campaign_id adset_id adlabels bid_amount bid_info bid_type configured_status conversion_specs created_time creative effective_status last_updated_by_app_id name tracking_specs updated_time ad_review_feedback).freeze
    STATUSES = %w(ACTIVE PAUSED DELETED PENDING_REVIEW DISAPPROVED PREAPPROVED PENDING_BILLING_INFO CAMPAIGN_PAUSED ARCHIVED ADSET_PAUSED).freeze

    # belongs_to ad_account

    def ad_account
      @ad_set ||= AdAccount.find(account_id)
    end

    # belongs_to ad_campaign

    def ad_campaign
      @ad_set ||= AdCampaign.find(campaign_id)
    end

    # belongs_to ad_set

    def ad_set
      @ad_set ||= AdSet.find(adset_id)
    end

    # belongs_to ad_creative

    def ad_creative
      @ad_creative ||= AdCreative.find(creative['id'])
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
facebook_ads-0.1.11 lib/facebook_ads/ad.rb
facebook_ads-0.1.10 lib/facebook_ads/ad.rb
facebook_ads-0.1.9 lib/facebook_ads/ad.rb
facebook_ads-0.1.8 lib/facebook_ads/ad.rb
facebook_ads-0.1.7 lib/facebook_ads/ad.rb