class TwitterAds::Creative::MediaLibrary
Constants
- RESOURCE
- RESOURCE_COLLECTION
Attributes
account[R]
Public Class Methods
new(account)
click to toggle source
# File lib/twitter-ads/creative/media_library.rb, line 68 def initialize(account) @account = account self end
Public Instance Methods
add()
click to toggle source
# File lib/twitter-ads/creative/media_library.rb, line 48 def add params = to_params resource = self.class::RESOURCE_COLLECTION % { account_id: account.id } response = Request.new(account.client, :post, resource, params: params).perform from_response(response.body[:data]) end
delete!()
click to toggle source
# File lib/twitter-ads/creative/media_library.rb, line 62 def delete! resource = RESOURCE % { account_id: account.id, id: media_key } response = Request.new(account.client, :delete, resource).perform from_response(response.body[:data]) end
reload(account, opts = {})
click to toggle source
# File lib/twitter-ads/creative/media_library.rb, line 40 def reload(account, opts = {}) if @media_key resource = self.class::RESOURCE % { account_id: account.id, id: media_key } response = Request.new(account.client, :get, resource, params: opts).perform response.body[:data] end end
update()
click to toggle source
# File lib/twitter-ads/creative/media_library.rb, line 55 def update params = to_params resource = self.class::RESOURCE % { account_id: account.id, id: media_key } response = Request.new(account.client, :put, resource, params: params).perform from_response(response.body[:data]) end