Skip to content

Commit ebb8202

Browse files
authored
Line item field name changes (#277)
* Line item field name changes * Update enums for updated line item field names
1 parent 462d3ca commit ebb8202

File tree

4 files changed

+61
-74
lines changed

4 files changed

+61
-74
lines changed

tests/fixtures/line_items_all.json

Lines changed: 30 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"data": [
88
{
99
"placement_type": "PROMOTED_ACCOUNT",
10-
"bid_type": "MAX",
10+
"bid_strategy": "MAX",
1111
"name": "Untitled",
1212
"placements": [
1313
"ALL_ON_TWITTER"
@@ -16,15 +16,14 @@
1616
"automatically_select_bid": false,
1717
"advertiser_domain": null,
1818
"primary_web_event_tag": null,
19-
"charge_by": "ENGAGEMENT",
19+
"pay_by": "ENGAGEMENT",
2020
"product_type": "PROMOTED_ACCOUNT",
21-
"bid_unit": "ENGAGEMENT",
2221
"total_budget_amount_local_micro": null,
2322
"objective": "CUSTOM",
2423
"id": "bw2",
2524
"entity_status": "ACTIVE",
2625
"account_id": "2iqph",
27-
"optimization": "DEFAULT",
26+
"goal": null,
2827
"categories": [],
2928
"currency": "USD",
3029
"created_at": "2011-07-11T20:36:11Z",
@@ -34,7 +33,7 @@
3433
},
3534
{
3635
"placement_type": "PROMOTED_ACCOUNT",
37-
"bid_type": "MAX",
36+
"bid_strategy": "MAX",
3837
"name": "Untitled",
3938
"placements": [
4039
"ALL_ON_TWITTER"
@@ -43,15 +42,14 @@
4342
"automatically_select_bid": false,
4443
"advertiser_domain": null,
4544
"primary_web_event_tag": null,
46-
"charge_by": "ENGAGEMENT",
45+
"pay_by": "ENGAGEMENT",
4746
"product_type": "PROMOTED_ACCOUNT",
48-
"bid_unit": "ENGAGEMENT",
4947
"total_budget_amount_local_micro": null,
5048
"objective": "CUSTOM",
5149
"id": "c4m",
5250
"entity_status": "ACTIVE",
5351
"account_id": "2iqph",
54-
"optimization": "DEFAULT",
52+
"goal": null,
5553
"categories": [],
5654
"currency": "USD",
5755
"created_at": "2011-07-13T20:56:39Z",
@@ -61,7 +59,7 @@
6159
},
6260
{
6361
"placement_type": "PROMOTED_TWEETS_FOR_SEARCH",
64-
"bid_type": "MAX",
62+
"bid_strategy": "MAX",
6563
"name": "Untitled",
6664
"placements": [
6765
"TWITTER_SEARCH"
@@ -70,15 +68,14 @@
7068
"automatically_select_bid": false,
7169
"advertiser_domain": null,
7270
"primary_web_event_tag": null,
73-
"charge_by": "ENGAGEMENT",
71+
"pay_by": "ENGAGEMENT",
7472
"product_type": "PROMOTED_TWEETS",
75-
"bid_unit": "ENGAGEMENT",
7673
"total_budget_amount_local_micro": null,
7774
"objective": "CUSTOM",
7875
"id": "c5c",
7976
"entity_status": "ACTIVE",
8077
"account_id": "2iqph",
81-
"optimization": "DEFAULT",
78+
"goal": null,
8279
"categories": [],
8380
"currency": "USD",
8481
"created_at": "2011-07-14T00:04:47Z",
@@ -88,7 +85,7 @@
8885
},
8986
{
9087
"placement_type": "PROMOTED_TWEETS_FOR_SEARCH",
91-
"bid_type": "MAX",
88+
"bid_strategy": "MAX",
9289
"name": "Untitled",
9390
"placements": [
9491
"TWITTER_SEARCH"
@@ -97,15 +94,14 @@
9794
"automatically_select_bid": false,
9895
"advertiser_domain": null,
9996
"primary_web_event_tag": null,
100-
"charge_by": "ENGAGEMENT",
97+
"pay_by": "ENGAGEMENT",
10198
"product_type": "PROMOTED_TWEETS",
102-
"bid_unit": "ENGAGEMENT",
10399
"total_budget_amount_local_micro": null,
104100
"objective": "CUSTOM",
105101
"id": "fhu",
106102
"entity_status": "ACTIVE",
107103
"account_id": "2iqph",
108-
"optimization": "DEFAULT",
104+
"goal": null,
109105
"categories": [],
110106
"currency": "USD",
111107
"created_at": "2011-08-22T22:42:18Z",
@@ -115,7 +111,7 @@
115111
},
116112
{
117113
"placement_type": "PROMOTED_TWEETS_FOR_TIMELINES",
118-
"bid_type": "MAX",
114+
"bid_strategy": "MAX",
119115
"name": "Untitled",
120116
"placements": [
121117
"TWITTER_TIMELINE"
@@ -124,15 +120,14 @@
124120
"automatically_select_bid": false,
125121
"advertiser_domain": null,
126122
"primary_web_event_tag": null,
127-
"charge_by": "ENGAGEMENT",
123+
"pay_by": "ENGAGEMENT",
128124
"product_type": "PROMOTED_TWEETS",
129-
"bid_unit": "ENGAGEMENT",
130125
"total_budget_amount_local_micro": null,
131126
"objective": "CUSTOM",
132127
"id": "fxd",
133128
"entity_status": "ACTIVE",
134129
"account_id": "2iqph",
135-
"optimization": "DEFAULT",
130+
"goal": null,
136131
"categories": [],
137132
"currency": "JPY",
138133
"created_at": "2011-08-26T20:51:14Z",
@@ -142,7 +137,7 @@
142137
},
143138
{
144139
"placement_type": "PROMOTED_TWEETS_FOR_TIMELINES",
145-
"bid_type": "MAX",
140+
"bid_strategy": "MAX",
146141
"name": "Untitled",
147142
"placements": [
148143
"TWITTER_TIMELINE"
@@ -151,15 +146,14 @@
151146
"automatically_select_bid": false,
152147
"advertiser_domain": null,
153148
"primary_web_event_tag": null,
154-
"charge_by": "ENGAGEMENT",
149+
"pay_by": "ENGAGEMENT",
155150
"product_type": "PROMOTED_TWEETS",
156-
"bid_unit": "ENGAGEMENT",
157151
"total_budget_amount_local_micro": null,
158152
"objective": "CUSTOM",
159153
"id": "fxt",
160154
"entity_status": "ACTIVE",
161155
"account_id": "2iqph",
162-
"optimization": "DEFAULT",
156+
"goal": null,
163157
"categories": [],
164158
"currency": "USD",
165159
"created_at": "2011-08-26T21:38:51Z",
@@ -169,7 +163,7 @@
169163
},
170164
{
171165
"placement_type": "PROMOTED_TWEETS_FOR_SEARCH",
172-
"bid_type": "MAX",
166+
"bid_strategy": "MAX",
173167
"name": "Untitled",
174168
"placements": [
175169
"TWITTER_SEARCH"
@@ -178,15 +172,14 @@
178172
"automatically_select_bid": false,
179173
"advertiser_domain": null,
180174
"primary_web_event_tag": null,
181-
"charge_by": "ENGAGEMENT",
175+
"pay_by": "ENGAGEMENT",
182176
"product_type": "PROMOTED_TWEETS",
183-
"bid_unit": "ENGAGEMENT",
184177
"total_budget_amount_local_micro": null,
185178
"objective": "CUSTOM",
186179
"id": "fya",
187180
"entity_status": "ACTIVE",
188181
"account_id": "2iqph",
189-
"optimization": "DEFAULT",
182+
"goal": null,
190183
"categories": [],
191184
"currency": "JPY",
192185
"created_at": "2011-08-26T22:28:55Z",
@@ -196,7 +189,7 @@
196189
},
197190
{
198191
"placement_type": "PROMOTED_TWEETS_FOR_TIMELINES",
199-
"bid_type": "MAX",
192+
"bid_strategy": "MAX",
200193
"name": "Untitled",
201194
"placements": [
202195
"TWITTER_TIMELINE"
@@ -205,15 +198,14 @@
205198
"automatically_select_bid": false,
206199
"advertiser_domain": null,
207200
"primary_web_event_tag": null,
208-
"charge_by": "ENGAGEMENT",
201+
"pay_by": "ENGAGEMENT",
209202
"product_type": "PROMOTED_TWEETS",
210-
"bid_unit": "ENGAGEMENT",
211203
"total_budget_amount_local_micro": null,
212204
"objective": "CUSTOM",
213205
"id": "ghj",
214206
"entity_status": "ACTIVE",
215207
"account_id": "2iqph",
216-
"optimization": "DEFAULT",
208+
"goal": null,
217209
"categories": [],
218210
"currency": "USD",
219211
"created_at": "2011-09-01T17:25:04Z",
@@ -223,7 +215,7 @@
223215
},
224216
{
225217
"placement_type": "PROMOTED_TWEETS_FOR_SEARCH",
226-
"bid_type": "MAX",
218+
"bid_strategy": "MAX",
227219
"name": "Untitled",
228220
"placements": [
229221
"TWITTER_SEARCH"
@@ -232,15 +224,14 @@
232224
"automatically_select_bid": false,
233225
"advertiser_domain": null,
234226
"primary_web_event_tag": null,
235-
"charge_by": "ENGAGEMENT",
227+
"pay_by": "ENGAGEMENT",
236228
"product_type": "PROMOTED_TWEETS",
237-
"bid_unit": "ENGAGEMENT",
238229
"total_budget_amount_local_micro": null,
239230
"objective": "CUSTOM",
240231
"id": "gra",
241232
"entity_status": "ACTIVE",
242233
"account_id": "2iqph",
243-
"optimization": "DEFAULT",
234+
"goal": null,
244235
"categories": [],
245236
"currency": "JPY",
246237
"created_at": "2011-09-06T17:42:52Z",
@@ -250,7 +241,7 @@
250241
},
251242
{
252243
"placement_type": "PROMOTED_TWEETS_FOR_TIMELINES",
253-
"bid_type": "MAX",
244+
"bid_strategy": "MAX",
254245
"name": "Untitled",
255246
"placements": [
256247
"TWITTER_TIMELINE"
@@ -259,15 +250,14 @@
259250
"automatically_select_bid": false,
260251
"advertiser_domain": null,
261252
"primary_web_event_tag": null,
262-
"charge_by": "ENGAGEMENT",
253+
"pay_by": "ENGAGEMENT",
263254
"product_type": "PROMOTED_TWEETS",
264-
"bid_unit": "ENGAGEMENT",
265255
"total_budget_amount_local_micro": null,
266256
"objective": "CUSTOM",
267257
"id": "gsw",
268258
"entity_status": "ACTIVE",
269259
"account_id": "2iqph",
270-
"optimization": "DEFAULT",
260+
"goal": null,
271261
"categories": [],
272262
"currency": "USD",
273263
"created_at": "2011-09-06T22:44:13Z",

tests/fixtures/line_items_load.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"data_type": "line_item",
33
"data": {
44
"placement_type": "PROMOTED_ACCOUNT",
5-
"bid_type": "MAX",
5+
"bid_strategy": "MAX",
66
"name": "Untitled",
77
"placements": [
88
"ALL_ON_TWITTER"
@@ -11,15 +11,14 @@
1111
"automatically_select_bid": false,
1212
"advertiser_domain": null,
1313
"primary_web_event_tag": null,
14-
"charge_by": "ENGAGEMENT",
14+
"pay_by": "ENGAGEMENT",
1515
"product_type": "PROMOTED_ACCOUNT",
16-
"bid_unit": "ENGAGEMENT",
1716
"total_budget_amount_local_micro": null,
1817
"objective": "CUSTOM",
1918
"id": "bw2",
2019
"entity_status": "ACTIVE",
2120
"account_id": "2iqph",
22-
"optimization": "DEFAULT",
21+
"goal": null,
2322
"categories": [],
2423
"currency": "USD",
2524
"created_at": "2011-07-11T20:36:11Z",

twitter_ads/campaign.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,19 +291,18 @@ def save(self):
291291
resource_property(LineItem, 'advertiser_user_id')
292292
resource_property(LineItem, 'automatically_select_bid', transform=TRANSFORM.BOOL)
293293
resource_property(LineItem, 'bid_amount_local_micro')
294-
resource_property(LineItem, 'bid_type')
295-
resource_property(LineItem, 'bid_unit')
294+
resource_property(LineItem, 'bid_strategy')
296295
resource_property(LineItem, 'campaign_id')
297296
resource_property(LineItem, 'categories', transform=TRANSFORM.LIST)
298-
resource_property(LineItem, 'charge_by')
299297
resource_property(LineItem, 'end_time', transform=TRANSFORM.TIME)
300298
resource_property(LineItem, 'entity_status')
299+
resource_property(LineItem, 'goal')
301300
resource_property(LineItem, 'ios_app_store_identifier')
302301
resource_property(LineItem, 'android_app_store_identifier')
303302
resource_property(LineItem, 'audience_expansion')
304303
resource_property(LineItem, 'name')
305304
resource_property(LineItem, 'objective')
306-
resource_property(LineItem, 'optimization')
305+
resource_property(LineItem, 'pay_by')
307306
resource_property(LineItem, 'placements', transform=TRANSFORM.LIST)
308307
resource_property(LineItem, 'primary_web_event_tag')
309308
resource_property(LineItem, 'product_type')

twitter_ads/enum.py

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,6 @@ def enum(**enums):
3838
AGE_OVER_50='AGE_OVER_50'
3939
)
4040

41-
BID_UNIT = enum(
42-
APP_CLICK='APP_CLICK',
43-
APP_INSTALL='APP_INSTALL',
44-
ENGAGEMENT='ENGAGEMENT',
45-
FOLLOW='FOLLOW',
46-
LEAD='LEAD',
47-
LINK_CLICK='LINK_CLICK',
48-
VIEW='VIEW'
49-
)
50-
51-
CHARGE_BY = enum(
52-
APP_CLICK='APP_CLICK',
53-
APP_INSTALL='APP_INSTALL',
54-
ENGAGEMENT='ENGAGEMENT',
55-
FOLLOW='FOLLOW',
56-
LEAD='LEAD',
57-
LINK_CLICK='LINK_CLICK',
58-
VIEW='VIEW'
59-
)
60-
6141
CREATIVE_TYPE = enum(
6242
BANNER='BANNER',
6343
INTERSTITIAL='INTERSTITIAL',
@@ -96,6 +76,23 @@ def enum(**enums):
9676
OTHER='OTHER'
9777
)
9878

79+
GOAL = enum(
80+
APP_CLICKS='APP_CLICKS',
81+
APP_INSTALLS='APP_INSTALLS',
82+
ENGAGEMENT='ENGAGEMENT',
83+
FOLLOWERS='FOLLOWERS',
84+
LINK_CLICKS='LINK_CLICKS',
85+
MAX_REACH='MAX_REACH',
86+
PREROLL='PREROLL',
87+
PREROLL_STARTS='PREROLL_STARTS',
88+
REACH_WITH_ENGAGEMENT='REACH_WITH_ENGAGEMENT',
89+
VIDEO_VIEW='VIDEO_VIEW',
90+
VIEW_3S_100PCT='VIEW_3S_100PCT',
91+
VIEW_6S='VIEW_6S',
92+
VIEW_15S='VIEW_15S',
93+
WEBSITE_CONVERSIONS='WEBSITE_CONVERSIONS'
94+
)
95+
9996
GRANULARITY = enum(
10097
HOUR='HOUR',
10198
DAY='DAY',
@@ -138,12 +135,14 @@ def enum(**enums):
138135
WEBSITE_CONVERSIONS='WEBSITE_CONVERSIONS'
139136
)
140137

141-
OPTIMIZATIONS = enum(
142-
APP_CLICKS='APP_CLICKS',
143-
APP_INSTALLS='APP_INSTALLS',
144-
DEFAULT='DEFAULT',
145-
ENGAGEMENTS='ENGAGEMENTS',
146-
WEBSITE_CONVERSIONS='WEBSITE_CONVERSIONS'
138+
PAY_BY = enum(
139+
APP_CLICK='APP_CLICK',
140+
APP_INSTALL='APP_INSTALL',
141+
ENGAGEMENT='ENGAGEMENT',
142+
FOLLOW='FOLLOW',
143+
LEAD='LEAD',
144+
LINK_CLICK='LINK_CLICK',
145+
VIEW='VIEW'
147146
)
148147

149148
PERMISSION_LEVEL = enum(

0 commit comments

Comments
 (0)