diff --git a/twitter_ads/__init__.py b/twitter_ads/__init__.py index 8306428..8904392 100644 --- a/twitter_ads/__init__.py +++ b/twitter_ads/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) 2015 Twitter, Inc. VERSION = (1, 2, 3) -API_VERSION = '1' +API_VERSION = '2' from twitter_ads.utils import get_version diff --git a/twitter_ads/account.py b/twitter_ads/account.py index cb9886d..7f0e1f4 100644 --- a/twitter_ads/account.py +++ b/twitter_ads/account.py @@ -9,7 +9,7 @@ from twitter_ads import API_VERSION from twitter_ads.resource import resource_property, Resource -from twitter_ads.creative import AccountMedia, MediaCreative, Video +from twitter_ads.creative import AccountMedia, MediaCreative, Video, VideoWebsiteCard from twitter_ads.audience import TailoredAudience from twitter_ads.campaign import (FundingInstrument, Campaign, LineItem, AppList, PromotableUser) @@ -136,6 +136,12 @@ def media_creatives(self, id=None, **kwargs): """ return self._load_resource(MediaCreative, id, **kwargs) + def video_website_cards(self, id=None, **kwargs): + """ + Returns a collection of video website cards available to the current account. + """ + return self._load_resource(VideoWebsiteCard, id, **kwargs) + def scoped_timeline(self, *id, **kwargs): """ Returns the most recent promotable Tweets created by the specified Twitter user. diff --git a/twitter_ads/creative.py b/twitter_ads/creative.py index e696bc7..86a380c 100644 --- a/twitter_ads/creative.py +++ b/twitter_ads/creative.py @@ -157,6 +157,41 @@ class WebsiteCard(Resource, Persistence): resource_property(WebsiteCard, 'image_media_id') +class VideoWebsiteCard(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/' + API_VERSION + '/accounts/{account_id}/cards/video_website' + RESOURCE = '/' + API_VERSION + '/accounts/{account_id}/cards/video_website/{id}' + +# video website card properties +# read-only +resource_property(VideoWebsiteCard, 'account_id', readonly=True) +resource_property(VideoWebsiteCard, 'card_type', readonly=True) +resource_property(VideoWebsiteCard, 'card_uri', readonly=True) +resource_property(VideoWebsiteCard, 'created_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(VideoWebsiteCard, 'deleted', readonly=True, transform=TRANSFORM.BOOL) +resource_property(VideoWebsiteCard, 'id', readonly=True) +resource_property(VideoWebsiteCard, 'preview_url', readonly=True) +resource_property(VideoWebsiteCard, 'updated_at', readonly=True, transform=TRANSFORM.TIME) +resource_property(VideoWebsiteCard, 'video_content_id', readonly=True) +resource_property(VideoWebsiteCard, 'video_height', readonly=True) +resource_property(VideoWebsiteCard, 'video_hls_url', readonly=True) +resource_property(VideoWebsiteCard, 'video_owner_id', readonly=True) +resource_property(VideoWebsiteCard, 'video_poster_height', readonly=True) +resource_property(VideoWebsiteCard, 'video_poster_url', readonly=True) +resource_property(VideoWebsiteCard, 'video_poster_width', readonly=True) +resource_property(VideoWebsiteCard, 'video_url', readonly=True) +resource_property(VideoWebsiteCard, 'video_width', readonly=True) +resource_property(VideoWebsiteCard, 'website_dest_url', readonly=True) +resource_property(VideoWebsiteCard, 'website_display_url', readonly=True) +# writable +resource_property(VideoWebsiteCard, 'name') +resource_property(VideoWebsiteCard, 'title') +resource_property(VideoWebsiteCard, 'video_id') +resource_property(VideoWebsiteCard, 'website_url') + + class LeadGenCard(Resource, Persistence): PROPERTIES = {}