Sha256: 59fb0fe97fdd09727b624d2a39e06dd7a2101f0019b326f015ec3a96d7c441ed

Contents?: true

Size: 789 Bytes

Versions: 2

Compression:

Stored size: 789 Bytes

Contents

module FacebookAds
  # https://developers.facebook.com/docs/marketing-api/reference/custom-audience
  class AdAudience < Base
    FIELDS = %w(id account_id subtype name description approximate_count data_source delivery_status external_event_source lookalike_audience_ids lookalike_spec operation_status opt_out_link permission_for_actions pixel_id retention_days rule time_content_updated time_created time_updated).freeze

    # belongs_to ad_account

    def ad_account
      @ad_account ||= AdAccount.find("act_#{account_id}")
    end

    # actions

    def share(account_id)
      query = {
        share_with_object_id: account_id,
        share_with_object_type: 'Account'
      }
      AdAccount.post("/#{id}/share_with_objects", query: query, objectify: false)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facebook_ads-0.1.8 lib/facebook_ads/ad_audience.rb
facebook_ads-0.1.7 lib/facebook_ads/ad_audience.rb