22# Copyright (C) 2019 Twitter, Inc.
33
44module TwitterAds
5- class TailoredAudience
5+ class CustomAudience
66
77 include TwitterAds ::DSL
88 include TwitterAds ::Resource
@@ -19,19 +19,19 @@ class TailoredAudience
1919
2020 property :audience_size , read_only : true
2121 property :audience_type , read_only : true
22- property :metadata , read_only : true
23- property :owner_account_id , read_only : true
2422 property :partner_source , read_only : true
2523 property :reasons_not_targetable , read_only : true
2624 property :targetable , type : :bool , read_only : true
2725 property :targetable_types , read_only : true
26+ property :permission_level , read_only : true
27+ property :owner_account_id , read_only : true
2828
2929 RESOURCE_COLLECTION = "/#{ TwitterAds ::API_VERSION } /" \
30- 'accounts/%{account_id}/tailored_audiences ' # @api private
30+ 'accounts/%{account_id}/custom_audiences ' # @api private
3131 RESOURCE = "/#{ TwitterAds ::API_VERSION } /" \
32- 'accounts/%{account_id}/tailored_audiences /%{id}' # @api private
32+ 'accounts/%{account_id}/custom_audiences /%{id}' # @api private
3333 RESOURCE_USERS = "/#{ TwitterAds ::API_VERSION } /" \
34- 'accounts/%{account_id}/tailored_audiences /' \
34+ 'accounts/%{account_id}/custom_audiences /' \
3535 '%{id}/users' # @api private
3636
3737 LIST_TYPES = %w(
@@ -55,17 +55,17 @@ def initialize(account)
5555
5656 class << self
5757
58- # Creates a new tailored audience.
58+ # Creates a new custom audience.
5959 #
6060 # @example
61- # audience = TailoredAudience .create(account, 'my list')
61+ # audience = CustomAudience .create(account, 'my list')
6262 #
6363 # @param account [Account] The account object instance.
64- # @param name [String] The tailored audience name.
64+ # @param name [String] The custom audience name.
6565 #
6666 # @since 4.0
6767 #
68- # @return [TailoredAudience ] The newly created tailored audience instance.
68+ # @return [CustomAudience ] The newly created custom audience instance.
6969 def create ( account , name )
7070 audience = new ( account )
7171 params = { name : name }
@@ -76,7 +76,7 @@ def create(account, name)
7676
7777 end
7878
79- # Deletes the current tailored audience instance.
79+ # Deletes the current custom audience instance.
8080 #
8181 # @example
8282 # audience.delete!
@@ -85,7 +85,7 @@ def create(account, name)
8585 #
8686 # @since 0.3.0
8787 #
88- # @return [self] Returns the tailored audience instance refreshed from the API.
88+ # @return [self] Returns the custom audience instance refreshed from the API.
8989 def delete!
9090 resource = RESOURCE % { account_id : account . id , id : id }
9191 response = Request . new ( account . client , :delete , resource ) . perform
@@ -95,11 +95,11 @@ def delete!
9595 # This is a private API and requires allowlisting from Twitter.
9696 #
9797 # This endpoint will allow partners to add, update and remove users from a given
98- # tailored_audience_id .
98+ # custom_audience_id .
9999 # The endpoint will also accept multiple user identifier types per user as well.
100100 #
101101 # @example
102- # tailored_audience .users(
102+ # custom_audience .users(
103103 # account,
104104 # [
105105 # {
@@ -194,7 +194,7 @@ def load(account, tailored_audience_id, params)
194194 end
195195 end
196196
197- class TailoredAudiencePermission
197+ class CustomAudiencePermission
198198
199199 include TwitterAds ::DSL
200200 include TwitterAds ::Resource
@@ -207,16 +207,16 @@ class TailoredAudiencePermission
207207 property :deleted , type : :bool , read_only : true
208208
209209 property :id
210- property :tailored_audience_id
210+ property :custom_audience_id
211211 property :granted_account_id
212212 property :permission_level
213213
214214 RESOURCE_COLLECTION = "/#{ TwitterAds ::API_VERSION } /" \
215- 'accounts/%{account_id}/tailored_audiences /' \
216- '%{tailored_audience_id }/permissions' # @api private
215+ 'accounts/%{account_id}/custom_audiences /' \
216+ '%{custom_audience_id }/permissions' # @api private
217217 RESOURCE = "/#{ TwitterAds ::API_VERSION } /" \
218- 'accounts/%{account_id}/tailored_audiences /' \
219- '%{tailored_audience_id }/permissions/%{id}' # @api private
218+ 'accounts/%{account_id}/custom_audiences /' \
219+ '%{custom_audience_id }/permissions/%{id}' # @api private
220220
221221 def initialize ( account )
222222 @account = account
@@ -226,22 +226,22 @@ def initialize(account)
226226 class << self
227227
228228 # Retrieve details for some or
229- # all permissions associated with the specified tailored audience.
229+ # all permissions associated with the specified custom audience.
230230 #
231231 # @exapmle
232- # permissions = TailoredAudiencePermission .all(account, '36n4f')
232+ # permissions = CustomAudiencePermission .all(account, '36n4f')
233233 #
234234 # @param account [Account] The account object instance.
235- # @param tailored_audience_id [String] The tailored audience id.
235+ # @param custom_audience_id [String] The custom audience id.
236236 #
237237 # @since 5.2.0
238238 #
239- # @return [TailoredAudiencePermission ] The tailored audience permission instance.
240- def all ( account , tailored_audience_id , opts = { } )
239+ # @return [CustomAudiencePermission ] The custom audience permission instance.
240+ def all ( account , custom_audience_id , opts = { } )
241241 params = { } . merge! ( opts )
242242 resource = RESOURCE_COLLECTION % {
243243 account_id : account . id ,
244- tailored_audience_id : tailored_audience_id
244+ custom_audience_id : custom_audience_id
245245 }
246246 request = Request . new ( account . client , :get , resource , params : params )
247247 Cursor . new ( self , request , init_with : [ account ] )
@@ -250,7 +250,7 @@ def all(account, tailored_audience_id, opts = {})
250250 end
251251
252252 # Saves or updates the current object instance
253- # depending on the presence of `object.tailored_audience_id `.
253+ # depending on the presence of `object.custom_audience_id `.
254254 #
255255 # @exapmle
256256 # object.save
@@ -261,14 +261,14 @@ def all(account, tailored_audience_id, opts = {})
261261 def save
262262 resource = RESOURCE_COLLECTION % {
263263 account_id : account . id ,
264- tailored_audience_id : tailored_audience_id
264+ custom_audience_id : custom_audience_id
265265 }
266266 params = to_params
267267 response = Request . new ( account . client , :post , resource , params : params ) . perform
268268 from_response ( response . body [ :data ] )
269269 end
270270
271- # Deletes the current or specified tailored audience permission.
271+ # Deletes the current or specified custom audience permission.
272272 #
273273 # @example
274274 # object.delete!
@@ -281,7 +281,7 @@ def save
281281 def delete!
282282 resource = RESOURCE % {
283283 account_id : account . id ,
284- tailored_audience_id : tailored_audience_id ,
284+ custom_audience_id : custom_audience_id ,
285285 id : @id
286286 }
287287 response = Request . new ( account . client , :delete , resource ) . perform
0 commit comments