class TwitterAds::Creative::Tweets

Constants

RESOURCE_COLLECTION

Attributes

account[R]

Public Class Methods

all(account, opts = {}) click to toggle source

Retrieve Tweet details for the account's full promotable user (default) or the user specified in the user_id parameter.

@example

tweets = TwitterAds::Creative::Tweets.all(
  account,
  tweet_type: 'PUBLISHED',
  tweet_ids: %w(1122911801354510336 1102836745790316550),
  timeline_type: 'ORGANIC'
)

@param account [Account] The Account object instance. @param tweet_type [String] The Tweet type for the specified tweet_ids. @option opts [Int] :count The number of records to try and retrieve per distinct request. @option opts [String] :cursor A cursor to get the next page of results. @option opts [String] :timeline_type The granularity to use (default: NULLCAST). @option opts [Boolean] :trim_user Whether to exclude the user object

in the Tweet response (default: false).

@option opts [Array] :tweet_ids A collection of tweet IDs to be fetched. @option opts [Long] :user_id The user ID to scope Tweets to.

@return A list of tweets details.

@see developer.twitter.com/en/docs/ads/creatives/api-reference/tweets#get-accounts-account-id-tweets @since 6.0.0

# File lib/twitter-ads/creative/tweets.rb, line 43
def self.all(account, opts = {})
  params = TwitterAds::Utils.flatten_params(opts)
  resource = self::RESOURCE_COLLECTION % { account_id: account.id }
  request = Request.new(account.client, :get, resource, params: params)
  Cursor.new(nil, request, init_with: [account])
end