-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* updated version to v9 * renamed/removed line item props * moved props out of beta * updated enums * added support for cards endpoint * renamed tailored audiences to custom audiences * removed old tailored audiences endpoint * added new cards endpoint with examples * updated tailored audiences to custom audiences * updated tests * merge conflicts Co-authored-by: John Babich <[email protected]>
- Loading branch information
1 parent
cd1b07c
commit 13fba8b
Showing
17 changed files
with
302 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# frozen_string_literal: true | ||
# Copyright (C) 2019 Twitter, Inc. | ||
require 'twitter-ads' | ||
|
||
CONSUMER_KEY = 'your consumer key' | ||
CONSUMER_SECRET = 'your consumer secret' | ||
ACCESS_TOKEN = 'user access token' | ||
ACCESS_TOKEN_SECRET = 'user access token secret' | ||
ADS_ACCOUNT = 'ads account id' | ||
|
||
# initialize the twitter ads api client | ||
client = TwitterAds::Client.new( | ||
CONSUMER_KEY, | ||
CONSUMER_SECRET, | ||
ACCESS_TOKEN, | ||
ACCESS_TOKEN_SECRET | ||
) | ||
|
||
# load up the account instance, campaign and line item | ||
account = client.accounts(ADS_ACCOUNT) | ||
|
||
# create the card | ||
name = 'video website card' | ||
components = [ | ||
{ | ||
type: 'MEDIA', | ||
media_key: '13_794652834998325248' | ||
}, | ||
{ | ||
type: 'DETAILS', | ||
title: 'Twitter', | ||
destination: { | ||
type: 'WEBSITE', | ||
url: 'http://twitter.com/' | ||
} | ||
} | ||
] | ||
|
||
vwc = TwitterAds::Creative::Cards.new(account) | ||
video_website_card = vwc.create(account, name, components) | ||
|
||
# get user_id for as_user_id parameter | ||
user_id = TwitterRestApi::UserIdLookup.load(account, screen_name: 'your_screen_name').id | ||
|
||
# create a draft tweet using this new card | ||
tweet = TwitterAds::Creative::DraftTweet.new(account) | ||
tweet.text = 'Created from SDK' | ||
tweet.as_user_id = user_id | ||
tweet.card_uri = video_website_card.card_uri | ||
tweet.save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.