class TwitterAds::Client

Included Modules

Defined in:

twitter-ads/api/account_media.cr
twitter-ads/api/accounts.cr
twitter-ads/api/authenticated_user_access.cr
twitter-ads/api/campaigns.cr
twitter-ads/api/cards.cr
twitter-ads/api/cards_all.cr
twitter-ads/api/cards_image_app_download.cr
twitter-ads/api/cards_image_conversation.cr
twitter-ads/api/cards_image_direct_message.cr
twitter-ads/api/cards_poll.cr
twitter-ads/api/cards_video_app_download.cr
twitter-ads/api/cards_video_conversation.cr
twitter-ads/api/cards_video_direct_message.cr
twitter-ads/api/cards_video_website.cr
twitter-ads/api/cards_website.cr
twitter-ads/api/custom_audiences.cr
twitter-ads/api/draft_tweets.cr
twitter-ads/api/funding_instruments.cr
twitter-ads/api/line_item_placements.cr
twitter-ads/api/line_items.cr
twitter-ads/api/media_creatives.cr
twitter-ads/api/media_library.cr
twitter-ads/api/preroll_call_to_actions.cr
twitter-ads/api/promotable_users.cr
twitter-ads/api/promoted_accounts.cr
twitter-ads/api/promoted_tweets.cr
twitter-ads/api/scheduled_promoted_tweets.cr
twitter-ads/api/scheduled_tweets.cr
twitter-ads/api/stats.cr
twitter-ads/api/statuses_lookup.cr
twitter-ads/api/targeting_criteria.cr
twitter-ads/api/targeting_criteria_app_store_categories.cr
twitter-ads/api/targeting_criteria_conversations.cr
twitter-ads/api/targeting_criteria_devices.cr
twitter-ads/api/targeting_criteria_events.cr
twitter-ads/api/targeting_criteria_interests.cr
twitter-ads/api/targeting_criteria_languages.cr
twitter-ads/api/targeting_criteria_locations.cr
twitter-ads/api/targeting_criteria_network_operators.cr
twitter-ads/api/targeting_criteria_platform_versions.cr
twitter-ads/api/targeting_criteria_platforms.cr
twitter-ads/api/targeting_criteria_tv_markets.cr
twitter-ads/api/targeting_criteria_tv_shows.cr
twitter-ads/api/tweet_previews.cr
twitter-ads/api/tweets.cr
twitter-ads/api/tweets_lookup.cr
twitter-ads/client.cr

Constant Summary

ADS_DEFAULT_DOMAIN = "https://ads-api.twitter.com"
ADS_SANDBOX_DOMAIN = "https://ads-api-sandbox.twitter.com"
API_DEFAULT_DOMAIN = "https://api.twitter.com"
API_DEFAULT_VERSION = "12"

Constructors

Instance Method Summary

Instance methods inherited from module TwitterAds::Api::Executable

after_execute
after_execute(&callback : Request, HTTP::Client::Response | Nil -> )
after_execute
, before_execute
before_execute(&callback : Request -> )
before_execute
, execute(req : Request) : Response execute

Constructor Detail

def self.from_twurlrc(path = "~/.twurlrc") : Client #

[View source]
def self.new(consumer_key : Nil | String, consumer_secret : Nil | String, access_token : Nil | String, access_token_secret : Nil | String, bearer_token : Nil | String = nil, url : String | Nil = nil, logger : Logger | Nil = nil) #

[View source]

Instance Method Detail

def _stats(account_id : String, entity : String | Api::Stats::Entity, entity_ids : Array(String), start_time : String | Time, end_time : String | Time, metrics : String | Array(String) | Array(Api::Stats::Metric), granularity : String | Api::Stats::Granularity = "HOUR", placement : String | Api::Stats::Placement = "ALL_ON_TWITTER") #

[View source]
def access_token : String #

def access_token=(v : String) : String #

def access_token=(v : Nil) #

nil assignments are always ignored


def access_token? : String | Nil #

def access_token_secret : String #

def access_token_secret=(v : String) : String #

def access_token_secret=(v : Nil) #

nil assignments are always ignored


def access_token_secret? : String | Nil #

def account_media(account_id : String, count : Int32 = 200, cursor : String = "") : Api::AccountMedia #

[View source]
def accounts(with_deleted : Bool = false, count : Int32 = 200, cursor : String = "") : Api::Accounts #

[View source]
def api_suffix : String #

def api_suffix=(v : String) : String #

def api_suffix=(v : Nil) #

nil assignments are always ignored


def api_suffix? : String | Nil #

def api_version : String #

API


def api_version=(v : String) : String #

API


def api_version=(v : Nil) #

nil assignments are always ignored


def api_version? : String | Nil #

API


def authenticated_user_access(account_id : String) : Api::AuthenticatedUserAccess #

[View source]
def authorized? #

#####################################################################

Accessor methods


[View source]
def bearer_token : String #

def bearer_token=(v : String) : String #

def bearer_token=(v : Nil) #

nil assignments are always ignored


def bearer_token? : String | Nil #

def campaigns(account_id : String, with_deleted : Bool = false, with_draft : Bool = false, count : Int32 = 200, cursor : String = "") : Api::Campaigns #

[View source]
def cards(account_id : String, count : Int32 = 200, cursor : String = "") : Api::Cards #

[View source]
def cards_all(account_id : String, card_uris : Array(String)) : Api::CardsAll #

[View source]
def cards_image_app_download(account_id : String, count : Int32 = 200, cursor : String = "") : Api::CardsImageAppDownload #

[View source]
def cards_image_conversation(account_id : String, count : Int32 = 200, cursor : String = "") : Api::CardsImageConversation #

[View source]
def cards_image_direct_message(account_id : String, count : Int32 = 200, cursor : String = "") : Api::CardsImageDirectMessage #

[View source]
def cards_poll(account_id : String, count : Int32 = 200, cursor : String = "") : Api::CardsPoll #

[View source]
def cards_video_app_download(account_id : String, count : Int32 = 200, cursor : String = "") : Api::CardsVideoAppDownload #

[View source]
def cards_video_conversation(account_id : String, count : Int32 = 200, cursor : String = "") : Api::CardsVideoConversation #

[View source]
def cards_video_direct_message(account_id : String, count : Int32 = 200, cursor : String = "") : Api::CardsVideoDirectMessage #

[View source]
def cards_video_website(account_id : String, count : Int32 = 200, cursor : String = "") : Api::CardsVideoWebsite #

[View source]
def cards_website(account_id : String, count : Int32 = 200, cursor : String = "") : Api::CardsWebsite #

[View source]
def connect_timeout : Float64 #

def connect_timeout=(v : Float64) : Float64 #

def connect_timeout=(v : Nil) #

nil assignments are always ignored


def connect_timeout? : Float64 | Nil #

def consumer_key : String #

OAuth


def consumer_key=(v : String) : String #

OAuth


def consumer_key=(v : Nil) #

nil assignments are always ignored


def consumer_key? : String | Nil #

OAuth


def consumer_secret : String #

def consumer_secret=(v : String) : String #

def consumer_secret=(v : Nil) #

nil assignments are always ignored


def consumer_secret? : String | Nil #

def custom_audiences(account_id : String, with_deleted : Bool = false, count : Int32 = 200, cursor : String = "") : Api::CustomAudiences #

[View source]
def dns_timeout : Float64 #

def dns_timeout=(v : Float64) : Float64 #

def dns_timeout=(v : Nil) #

nil assignments are always ignored


def dns_timeout? : Float64 | Nil #

def draft_tweets(account_id : String, count : Int32 = 200, cursor : String = "") : Api::DraftTweets #

[View source]
def dryrun : Bool #

def dryrun=(v : Bool) : Bool #

def dryrun=(v : Nil) #

nil assignments are always ignored


def dryrun? : Bool #

def funding_instruments(account_id : String, count : Int32 = 200, cursor : String = "") : Api::FundingInstruments #

[View source]
def get(path : String, params = {} of String => String) : Response #

See ./api/*.cr #####################################################################

HTTP methods


[View source]
def jq : Jq #

JQ


def jq=(v : Jq) : Jq #

JQ


def jq=(v : Nil) #

nil assignments are always ignored


def jq? : Jq | Nil #

JQ


def line_item_placements : Api::LineItemPlacements #

[View source]
def line_items(account_id : String, with_deleted : Bool = false, with_draft : Bool = false, count : Int32 = 200, cursor : String = "") : Api::LineItems #

[View source]
def logger : Logger #

def logger=(v : Logger) : Logger #

def logger=(v : Nil) #

nil assignments are always ignored


def logger? : Logger | Nil #

def media_creatives(account_id : String, with_deleted : Bool = false, count : Int32 = 200, cursor : String = "") : Api::MediaCreatives #

[View source]
def media_library(account_id : String, count : Int32 = 200, cursor : String = "") : Api::MediaLibrary #

[View source]
def oauth2_ads : Bool #

def oauth2_ads=(v : Bool) : Bool #

def oauth2_ads=(v : Nil) #

nil assignments are always ignored


def oauth2_ads? : Bool #

def oauth2_standard : Bool #

def oauth2_standard=(v : Bool) : Bool #

def oauth2_standard=(v : Nil) #

nil assignments are always ignored


def oauth2_standard? : Bool #

def post(path : String, form = {} of String => String) : Response #

[View source]
def preroll_call_to_actions(account_id : String, count : Int32 = 200, cursor : String = "") : Api::PrerollCallToActions #

[View source]
def promotable_users(account_id : String, with_deleted : Bool = false, count : Int32 = 200, cursor : String = "") : Api::PromotableUsers #

[View source]
def read_timeout : Float64 #

def read_timeout=(v : Float64) : Float64 #

def read_timeout=(v : Nil) #

nil assignments are always ignored


def read_timeout? : Float64 | Nil #

def scheduled_promoted_tweets(account_id : String, with_deleted : Bool = false, count : Int32 = 200, cursor : String = "") : Api::ScheduledPromotedTweets #

[View source]
def scheduled_tweets(account_id : String, count : Int32 = 200, cursor : String = "") : Api::ScheduledTweets #

[View source]
def stats(account_id : String, entity : String | Api::Stats::Entity, entity_ids : Array(String), start_time : String | Time, end_time : String | Time, metrics : String | Array(String) | Array(Api::Stats::Metric), granularity : String | Api::Stats::Granularity = "HOUR", placement : String | Api::Stats::Placement = "ALL_ON_TWITTER") : TwitterAds::StatsAccount #

[View source]
def statuses_lookup(id : String | Array(String)) : Api::StatusesLookup #

This is not "twitter-ads-api" but "twitter-api" that requires ".json" extension. So the setting of TwitterAds::Client#api_suffix should be ignored.


[View source]
def switch_domain : Bool #

def switch_domain=(v : Bool) : Bool #

def switch_domain=(v : Nil) #

nil assignments are always ignored


def switch_domain? : Bool #

def targeting_criteria(account_id : String, line_item_ids : Array(String), with_deleted : Bool = false, count : Int32 = 200, cursor : String = "") : Api::TargetingCriteria #

[View source]
def targeting_criteria_app_store_categories(q : String | Nil = nil, store : String | Api::TargetingCriteriaAppStoreCategories::Store | Nil = nil) : Api::TargetingCriteriaAppStoreCategories #

[View source]
def targeting_criteria_conversations(conversation_type : String | Api::TargetingCriteriaConversations::ConversationType | Nil = nil, count : Int32 = 200, cursor : String = "") : Api::TargetingCriteriaConversations #

[View source]
def targeting_criteria_devices(q : String | Nil = nil, count : Int32 = 200) : Api::TargetingCriteriaDevices #

[View source]
def targeting_criteria_events(event_types : String | Api::TargetingCriteriaEvents::EventTypes, country_codes : String | Nil = nil, ids : String | Array(String) | Nil = nil, start_time : String | Time | Nil = nil, end_time : String | Time | Nil = nil, count : Int32 = 200, cursor : String = "") : Api::TargetingCriteriaEvents #

[View source]
def targeting_criteria_interests(q : String | Nil = nil, count : Int32 = 200, cursor : String = "") : Api::TargetingCriteriaInterests #

[View source]
def targeting_criteria_languages(q : String | Nil = nil, count : Int32 = 200, cursor : String = "") : Api::TargetingCriteriaLanguages #

[View source]
def targeting_criteria_locations(country_code : String | Nil = nil, location_type : String | Nil = nil, q : String | Nil = nil, count : Int32 = 200, cursor : String = "") : Api::TargetingCriteriaLocations #

[View source]
def targeting_criteria_network_operators(country_code : String | Nil = nil, q : String | Nil = nil, count : Int32 = 200, cursor : String = "") : Api::TargetingCriteriaNetworkOperators #

[View source]
def targeting_criteria_platform_versions(q : String | Nil = nil) : Api::TargetingCriteriaPlatformVersions #

[View source]
def targeting_criteria_platforms(lang : String | Nil = nil, q : String | Nil = nil, count : Int32 = 200) : Api::TargetingCriteriaPlatforms #

[View source]
def targeting_criteria_tv_markets : Api::TargetingCriteriaTvMarkets #

[View source]
def targeting_criteria_tv_shows(tv_market_locale : String, q : String | Nil = nil, count : Int32 = 200, cursor : String = "") : Api::TargetingCriteriaTvShows #

[View source]
def tweet_previews(account_id : String, tweet_type : String | Api::TweetPreviews::TweetType, tweet_ids : Array(Int64)) : Api::TweetPreviews #

[View source]
def tweets(account_id : String, tweet_type : String | Api::Tweets::TweetType = "PUBLISHED", include_mentions_and_replies : Bool = false, timeline_type : String | Api::Tweets::TimelineType = "NULLCAST", trim_user : Bool = false, tweet_ids : String | Nil = nil, user_id : Int64 | Nil = nil, count : Int32 = 200, cursor : String = "") : Api::Tweets #

[View source]
def tweets_lookup(id : String | Array(String), expansions : String = "", tweet_fields : String = "", media_fields : String = "", place_fields : String = "", poll_fields : String = "", user_fields : String = "") : Api::TweetsLookup #

[View source]
def uri : URI #

HTTP


def uri=(v : URI) : URI #

HTTP


def uri=(v : Nil) #

nil assignments are always ignored


def uri? : URI | Nil #

HTTP


def url=(s : String) #

[View source]
def user_agent : String #

def user_agent=(v : String) : String #

def user_agent=(v : Nil) #

nil assignments are always ignored


def user_agent? : String | Nil #