class TwitterAds::LineItem
Constants
- RESOURCE
- RESOURCE_BATCH
- RESOURCE_COLLECTION
- RESOURCE_PLACEMENTS
Attributes
account[R]
Public Class Methods
new(account)
click to toggle source
# File lib/twitter-ads/campaign/line_item.rb, line 56 def initialize(account) @account = account self end
placements(client, product_type = nil)
click to toggle source
Helper method to return a list a valid placement combinations by Product
.
@example
LineItem.placements(Product::PROMOTED_TWEETS)
@param product_type [Product] The enum value for the Product
type being targeted.
@return [Array] An array of valid placement combinations.
@since 0.3.2 @see dev.twitter.com/ads/reference/get/line_items/placements
# File lib/twitter-ads/campaign/line_item.rb, line 74 def placements(client, product_type = nil) params = { product_type: product_type } if product_type response = TwitterAds::Request.new(client, :get, RESOURCE_PLACEMENTS, params: params).perform response.body[:data][0][:placements] end
Public Instance Methods
targeting_criteria(id = nil, opts = {})
click to toggle source
Returns a collection of targeting criteria available to the current line item.
@param id [String] The TargetingCriteria
ID value. @param opts [Hash] A Hash of extended options. @option opts [Boolean] :with_deleted Indicates if deleted items should be included. @option opts [String] :sort_by The object param to sort the API response by.
@since 0.3.1
@return A Cursor
or object instance.
# File lib/twitter-ads/campaign/line_item.rb, line 93 def targeting_criteria(id = nil, opts = {}) id ? TargetingCriteria.load(account, id, opts) : TargetingCriteria.all(account, @id, opts) end