class TwitterAds::CustomAudiencePermission
Constants
- RESOURCE
- RESOURCE_COLLECTION
Attributes
account[R]
Public Class Methods
all(account, custom_audience_id, opts = {})
click to toggle source
Retrieve details for some or all permissions associated with the specified custom audience.
@exapmle
permissions = CustomAudiencePermission.all(account, '36n4f')
@param account [Account] The account object instance. @param custom_audience_id [String] The custom audience id.
@since 5.2.0
@return [CustomAudiencePermission] The custom audience permission instance.
# File lib/twitter-ads/audiences/custom_audience.rb, line 240 def all(account, custom_audience_id, opts = {}) params = {}.merge!(opts) resource = RESOURCE_COLLECTION % { account_id: account.id, custom_audience_id: custom_audience_id } request = Request.new(account.client, :get, resource, params: params) Cursor.new(self, request, init_with: [account]) end
new(account)
click to toggle source
# File lib/twitter-ads/audiences/custom_audience.rb, line 221 def initialize(account) @account = account self end
Public Instance Methods
delete!()
click to toggle source
Deletes the current or specified custom audience permission.
@example
object.delete!
Note: calls to this method are destructive and irreverisble.
@since 5.2.0
@return [self] Returns the instance refreshed from the API.
# File lib/twitter-ads/audiences/custom_audience.rb, line 281 def delete! resource = RESOURCE % { account_id: account.id, custom_audience_id: custom_audience_id, id: @id } response = Request.new(account.client, :delete, resource).perform from_response(response.body[:data]) end
save()
click to toggle source
Saves or updates the current object instance depending on the presence of `object.custom_audience_id`.
@exapmle
object.save
@since 5.2.0
@return [self] Returns the instance refreshed from the API.
# File lib/twitter-ads/audiences/custom_audience.rb, line 261 def save resource = RESOURCE_COLLECTION % { account_id: account.id, custom_audience_id: custom_audience_id } params = to_params response = Request.new(account.client, :post, resource, params: params).perform from_response(response.body[:data]) end