twitter-ads 7.0.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -2
  3. data/lib/twitter-ads/account.rb +21 -5
  4. data/lib/twitter-ads/audiences/{tailored_audience.rb → custom_audience.rb} +85 -30
  5. data/lib/twitter-ads/campaign/line_item.rb +9 -7
  6. data/lib/twitter-ads/campaign/targeting_criteria.rb +1 -0
  7. data/lib/twitter-ads/campaign/tracking_tags.rb +97 -0
  8. data/lib/twitter-ads/client.rb +1 -1
  9. data/lib/twitter-ads/creative/cards.rb +56 -0
  10. data/lib/twitter-ads/creative/cards_fetch.rb +2 -4
  11. data/lib/twitter-ads/creative/image_app_download_card.rb +2 -4
  12. data/lib/twitter-ads/creative/promoted_tweet.rb +1 -1
  13. data/lib/twitter-ads/creative/video_app_download_card.rb +2 -4
  14. data/lib/twitter-ads/enum.rb +21 -30
  15. data/lib/twitter-ads/http/request.rb +7 -1
  16. data/lib/twitter-ads/resources/analytics.rb +1 -0
  17. data/lib/twitter-ads/targeting/{audience_summary.rb → audience_estimate.rb} +3 -3
  18. data/lib/twitter-ads/targeting_criteria/event.rb +1 -0
  19. data/lib/twitter-ads/version.rb +1 -1
  20. data/lib/twitter-ads.rb +4 -2
  21. data/spec/fixtures/accounts_all.json +0 -5
  22. data/spec/fixtures/accounts_load.json +0 -1
  23. data/spec/fixtures/{audience_summary.json → audience_estimate.json} +0 -0
  24. data/spec/fixtures/custom_audiences_all.json +67 -0
  25. data/spec/fixtures/{tailored_audiences_load.json → custom_audiences_load.json} +0 -0
  26. data/spec/fixtures/line_items_all.json +0 -10
  27. data/spec/fixtures/line_items_load.json +0 -1
  28. data/spec/fixtures/tailored_audiences_all.json +3 -0
  29. data/spec/fixtures/targeted_audiences.json +33 -0
  30. data/spec/fixtures/tracking_tags_load.json +17 -0
  31. data/spec/twitter-ads/account_spec.rb +11 -11
  32. data/spec/twitter-ads/audiences/{tailored_audience_spec.rb → custom_audience_spec.rb} +3 -2
  33. data/spec/twitter-ads/campaign/line_item_spec.rb +6 -3
  34. data/spec/twitter-ads/campaign/targeting_criteria_spec.rb +1 -0
  35. data/spec/twitter-ads/campaign/tracking_tag_spec.rb +58 -0
  36. data/spec/twitter-ads/creative/promoted_tweet_spec.rb +18 -0
  37. data/spec/twitter-ads/targeting/{audience_summary_spec.rb → audience_estimate_spec.rb} +2 -2
  38. metadata +56 -46
@@ -107,11 +107,17 @@ module TwitterAds
107
107
  Response.new(response.code, response.each {}, response.body)
108
108
  end
109
109
 
110
+ def escape_params(input)
111
+ input.map do |key, value|
112
+ "#{CGI.escape key.to_s}=#{CGI.escape value.to_s}"
113
+ end.join('&')
114
+ end
115
+
110
116
  def http_request
111
117
  request_url = @resource
112
118
 
113
119
  if @options[:params] && !@options[:params].empty?
114
- request_url += "?#{URI.encode_www_form(@options[:params])}"
120
+ request_url += "?#{escape_params(@options[:params])}"
115
121
  end
116
122
 
117
123
  request = HTTP_METHOD[@method].new(request_url)
@@ -30,6 +30,7 @@ module TwitterAds
30
30
  property :metric_groups, read_only: true
31
31
 
32
32
  ANALYTICS_MAP = {
33
+ 'TwitterAds::Account' => Entity::ACCOUNT,
33
34
  'TwitterAds::Campaign' => Entity::CAMPAIGN,
34
35
  'TwitterAds::LineItem' => Entity::LINE_ITEM,
35
36
  'TwitterAds::OrganicTweet' => Entity::ORGANIC_TWEET,
@@ -2,13 +2,13 @@
2
2
  # Copyright (C) 2019 Twitter, Inc.
3
3
 
4
4
  module TwitterAds
5
- module AudienceSummary
5
+ module AudienceEstimate
6
6
 
7
7
  include TwitterAds::DSL
8
8
  include TwitterAds::Resource
9
9
 
10
10
  RESOURCE = "/#{TwitterAds::API_VERSION}/" \
11
- 'accounts/%{account_id}/audience_summary'
11
+ 'accounts/%{account_id}/audience_estimate'
12
12
 
13
13
  property :audience_size, read_only: true
14
14
 
@@ -17,7 +17,7 @@ module TwitterAds
17
17
  # Get an audience summary for the specified targeting criteria.
18
18
  #
19
19
  # @example
20
- # TwitterAds::AudienceSummary.fetch(
20
+ # TwitterAds::AudienceEstimate.fetch(
21
21
  # account,
22
22
  # params: {targeting_criteria:[{targeting_type:'LOCATION',
23
23
  # targeting_value:'96683cc9126741d1'}]}
@@ -21,6 +21,7 @@ module TwitterAds
21
21
  property :gender_breakdown_percentage, read_only: true
22
22
  property :device_breakdown_percentage, read_only: true
23
23
  property :country_breakdown_percentage, read_only: true
24
+ property :targeting_value, read_only: true
24
25
 
25
26
  RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/" \
26
27
  'targeting_criteria/events' # @api private
@@ -2,5 +2,5 @@
2
2
  # Copyright (C) 2019 Twitter, Inc.
3
3
 
4
4
  module TwitterAds
5
- VERSION = '7.0.0'
5
+ VERSION = '10.0.0'
6
6
  end
data/lib/twitter-ads.rb CHANGED
@@ -29,7 +29,7 @@ require 'twitter-ads/http/response'
29
29
 
30
30
  require 'twitter-ads/restapi.rb'
31
31
 
32
- require 'twitter-ads/audiences/tailored_audience'
32
+ require 'twitter-ads/audiences/custom_audience'
33
33
 
34
34
  require 'twitter-ads/campaign/app_list'
35
35
  require 'twitter-ads/campaign/campaign'
@@ -37,6 +37,7 @@ require 'twitter-ads/campaign/funding_instrument'
37
37
  require 'twitter-ads/campaign/line_item'
38
38
  require 'twitter-ads/campaign/promotable_user'
39
39
  require 'twitter-ads/campaign/targeting_criteria'
40
+ require 'twitter-ads/campaign/tracking_tags'
40
41
  require 'twitter-ads/campaign/tweet'
41
42
  require 'twitter-ads/campaign/organic_tweet'
42
43
  require 'twitter-ads/campaign/iab_category'
@@ -58,6 +59,7 @@ require 'twitter-ads/targeting_criteria/app_store_category'
58
59
 
59
60
  require 'twitter-ads/creative/account_media'
60
61
  require 'twitter-ads/creative/cards_fetch'
62
+ require 'twitter-ads/creative/cards'
61
63
  require 'twitter-ads/creative/image_app_download_card'
62
64
  require 'twitter-ads/creative/image_conversation_card'
63
65
  require 'twitter-ads/creative/media_creative'
@@ -74,7 +76,7 @@ require 'twitter-ads/creative/poll_cards'
74
76
  require 'twitter-ads/creative/tweet_previews'
75
77
  require 'twitter-ads/creative/tweets'
76
78
 
77
- require 'twitter-ads/targeting/audience_summary'
79
+ require 'twitter-ads/targeting/audience_estimate'
78
80
 
79
81
  require 'twitter-ads/measurement/web_event_tag'
80
82
  require 'twitter-ads/measurement/app_event_tag'
@@ -9,7 +9,6 @@
9
9
  "timezone_switch_at": "2014-11-17T08:00:00Z",
10
10
  "id": "2iqph",
11
11
  "created_at": "2015-03-04T10:50:42Z",
12
- "salt": "5ab2pizq7qxjjqrx3z67f4wbko61o7xs",
13
12
  "updated_at": "2015-04-11T05:20:08Z",
14
13
  "approval_status": "ACCEPTED",
15
14
  "deleted": false
@@ -20,7 +19,6 @@
20
19
  "timezone_switch_at": "2014-11-17T08:00:00Z",
21
20
  "id": "pz6ec",
22
21
  "created_at": "2015-05-29T00:52:16Z",
23
- "salt": "39ku32xvhdt0jax8thps2c70e2fv3yok",
24
22
  "updated_at": "2015-05-29T00:52:16Z",
25
23
  "approval_status": "ACCEPTED",
26
24
  "deleted": false
@@ -31,7 +29,6 @@
31
29
  "timezone_switch_at": "2014-11-17T08:00:00Z",
32
30
  "id": "j9ozo",
33
31
  "created_at": "2015-05-01T12:08:10Z",
34
- "salt": "winwfne3y6oyikl4tm84bj9r50waxj37",
35
32
  "updated_at": "2015-05-01T12:08:10Z",
36
33
  "approval_status": "ACCEPTED",
37
34
  "deleted": false
@@ -42,7 +39,6 @@
42
39
  "timezone_switch_at": "2014-11-17T08:00:00Z",
43
40
  "id": "9ttgd",
44
41
  "created_at": "2015-06-24T18:51:20Z",
45
- "salt": "tj9hmt5xylm5zztrq05w7hwh4mkpkg5r",
46
42
  "updated_at": "2015-06-26T06:13:24Z",
47
43
  "approval_status": "ACCEPTED",
48
44
  "deleted": false
@@ -53,7 +49,6 @@
53
49
  "timezone_switch_at": "2013-05-22T07:00:00Z",
54
50
  "id": "47d0v",
55
51
  "created_at": "2015-05-28T05:42:03Z",
56
- "salt": "1ms1mq1nww7zl7169865gwqt89s9127m",
57
52
  "updated_at": "2015-05-28T05:42:03Z",
58
53
  "approval_status": "ACCEPTED",
59
54
  "deleted": false
@@ -6,7 +6,6 @@
6
6
  "timezone_switch_at": "2014-11-17T08:00:00Z",
7
7
  "id": "2iqph",
8
8
  "created_at": "2015-03-04T10:50:42Z",
9
- "salt": "5ab2pizq7qxjjqrx3z67f4wbko61o7xs",
10
9
  "updated_at": "2015-04-11T05:20:08Z",
11
10
  "approval_status": "ACCEPTED",
12
11
  "deleted": false
@@ -0,0 +1,67 @@
1
+ {
2
+ "request": {
3
+ "params": {
4
+ "account_id": "2iqph"
5
+ }
6
+ },
7
+ "data": [
8
+ {
9
+ "targetable": false,
10
+ "name": "TA #2",
11
+ "targetable_types": [
12
+ "WEB",
13
+ "EXCLUDED_WEB"
14
+ ],
15
+ "audience_type": "WEB",
16
+ "id": "abc2",
17
+ "reasons_not_targetable": [
18
+ "TOO_SMALL"
19
+ ],
20
+ "list_type": null,
21
+ "created_at": "2014-03-09T20:35:41Z",
22
+ "updated_at": "2014-06-11T09:38:06Z",
23
+ "partner_source": "OTHER",
24
+ "deleted": false,
25
+ "audience_size": null
26
+ },
27
+ {
28
+ "targetable": true,
29
+ "name": "TA #1",
30
+ "targetable_types": [
31
+ "CRM",
32
+ "EXCLUDED_CRM"
33
+ ],
34
+ "audience_type": "CRM",
35
+ "id": "abc1",
36
+ "reasons_not_targetable": [],
37
+ "list_type": "DEVICE_ID",
38
+ "created_at": "2014-05-22T17:37:12Z",
39
+ "updated_at": "2014-05-22T21:05:33Z",
40
+ "partner_source": "OTHER",
41
+ "deleted": false,
42
+ "audience_size": null
43
+ },
44
+ {
45
+ "targetable": false,
46
+ "name": "TA #3",
47
+ "targetable_types": [
48
+ "CRM",
49
+ "EXCLUDED_CRM"
50
+ ],
51
+ "audience_type": "CRM",
52
+ "id": "abc3",
53
+ "reasons_not_targetable": [
54
+ "TOO_SMALL"
55
+ ],
56
+ "list_type": "EMAIL",
57
+ "created_at": "2014-05-22T21:43:45Z",
58
+ "updated_at": "2014-05-23T02:27:31Z",
59
+ "partner_source": "OTHER",
60
+ "deleted": false,
61
+ "audience_size": null
62
+ }
63
+ ],
64
+ "data_type": "tailored_audiences",
65
+ "total_count": 3,
66
+ "next_cursor": null
67
+ }
@@ -13,7 +13,6 @@
13
13
  "ALL_ON_TWITTER"
14
14
  ],
15
15
  "bid_amount_local_micro": 2000000,
16
- "automatically_select_bid": false,
17
16
  "advertiser_domain": null,
18
17
  "primary_web_event_tag": null,
19
18
  "charge_by": "ENGAGEMENT",
@@ -40,7 +39,6 @@
40
39
  "ALL_ON_TWITTER"
41
40
  ],
42
41
  "bid_amount_local_micro": 2000000,
43
- "automatically_select_bid": false,
44
42
  "advertiser_domain": null,
45
43
  "primary_web_event_tag": null,
46
44
  "charge_by": "ENGAGEMENT",
@@ -67,7 +65,6 @@
67
65
  "TWITTER_SEARCH"
68
66
  ],
69
67
  "bid_amount_local_micro": 100000,
70
- "automatically_select_bid": false,
71
68
  "advertiser_domain": null,
72
69
  "primary_web_event_tag": null,
73
70
  "charge_by": "ENGAGEMENT",
@@ -94,7 +91,6 @@
94
91
  "TWITTER_SEARCH"
95
92
  ],
96
93
  "bid_amount_local_micro": 500000,
97
- "automatically_select_bid": false,
98
94
  "advertiser_domain": null,
99
95
  "primary_web_event_tag": null,
100
96
  "charge_by": "ENGAGEMENT",
@@ -121,7 +117,6 @@
121
117
  "TWITTER_TIMELINE"
122
118
  ],
123
119
  "bid_amount_local_micro": 50000000,
124
- "automatically_select_bid": false,
125
120
  "advertiser_domain": null,
126
121
  "primary_web_event_tag": null,
127
122
  "charge_by": "ENGAGEMENT",
@@ -149,7 +144,6 @@
149
144
  "TWITTER_TIMELINE"
150
145
  ],
151
146
  "bid_amount_local_micro": 50000000,
152
- "automatically_select_bid": false,
153
147
  "advertiser_domain": null,
154
148
  "primary_web_event_tag": null,
155
149
  "charge_by": "ENGAGEMENT",
@@ -177,7 +171,6 @@
177
171
  "TWITTER_SEARCH"
178
172
  ],
179
173
  "bid_amount_local_micro": 50000000,
180
- "automatically_select_bid": false,
181
174
  "advertiser_domain": null,
182
175
  "primary_web_event_tag": null,
183
176
  "charge_by": "ENGAGEMENT",
@@ -204,7 +197,6 @@
204
197
  "TWITTER_TIMELINE"
205
198
  ],
206
199
  "bid_amount_local_micro": 500000,
207
- "automatically_select_bid": false,
208
200
  "advertiser_domain": null,
209
201
  "primary_web_event_tag": null,
210
202
  "charge_by": "ENGAGEMENT",
@@ -231,7 +223,6 @@
231
223
  "TWITTER_SEARCH"
232
224
  ],
233
225
  "bid_amount_local_micro": 50000000,
234
- "automatically_select_bid": false,
235
226
  "advertiser_domain": null,
236
227
  "primary_web_event_tag": null,
237
228
  "charge_by": "ENGAGEMENT",
@@ -258,7 +249,6 @@
258
249
  "TWITTER_TIMELINE"
259
250
  ],
260
251
  "bid_amount_local_micro": 2009999,
261
- "automatically_select_bid": false,
262
252
  "advertiser_domain": null,
263
253
  "primary_web_event_tag": null,
264
254
  "charge_by": "ENGAGEMENT",
@@ -8,7 +8,6 @@
8
8
  "ALL_ON_TWITTER"
9
9
  ],
10
10
  "bid_amount_local_micro": 2000000,
11
- "automatically_select_bid": false,
12
11
  "advertiser_domain": null,
13
12
  "primary_web_event_tag": null,
14
13
  "charge_by": "ENGAGEMENT",
@@ -14,6 +14,7 @@
14
14
  ],
15
15
  "audience_type": "WEB",
16
16
  "id": "abc2",
17
+ "owner_account_id": "18ce54uhdu0",
17
18
  "reasons_not_targetable": [
18
19
  "TOO_SMALL"
19
20
  ],
@@ -33,6 +34,7 @@
33
34
  ],
34
35
  "audience_type": "CRM",
35
36
  "id": "abc1",
37
+ "owner_account_id": "18ce54uhdu0",
36
38
  "reasons_not_targetable": [],
37
39
  "list_type": "DEVICE_ID",
38
40
  "created_at": "2014-05-22T17:37:12Z",
@@ -50,6 +52,7 @@
50
52
  ],
51
53
  "audience_type": "CRM",
52
54
  "id": "abc3",
55
+ "owner_account_id": "18ce54uhdu0",
53
56
  "reasons_not_targetable": [
54
57
  "TOO_SMALL"
55
58
  ],
@@ -0,0 +1,33 @@
1
+ {
2
+ "request": {
3
+ "params": {
4
+ "account_id": "2iqph",
5
+ "tailored_audience_id": "abc2"
6
+ }
7
+ },
8
+ "next_cursor": null,
9
+ "data": [
10
+ {
11
+ "campaign_id": "59hod",
12
+ "campaign_name": "test-campaign",
13
+ "line_items": [
14
+ {
15
+ "id": "5gzog",
16
+ "name": "test-line-item",
17
+ "servable": true
18
+ }
19
+ ]
20
+ },
21
+ {
22
+ "campaign_id": "arja7",
23
+ "campaign_name": "Untitled campaign",
24
+ "line_items": [
25
+ {
26
+ "id": "bjw1q",
27
+ "name": null,
28
+ "servable": true
29
+ }
30
+ ]
31
+ }
32
+ ]
33
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "request": {
3
+ "params": {
4
+ "tracking_tag_id": "7035",
5
+ "account_id": "18ce54uhdu0"
6
+ }
7
+ },
8
+ "data": {
9
+ "line_item_id": "dmbc0",
10
+ "tracking_tag_url": "https://ad.doubleclick.net/ddm/trackimp/N1234.2061500TWITTER-OFFICIAL/B9156151.125630439;dc_trk_aid=1355;dc_trk_cid=8675309",
11
+ "tracking_tag_type": "IMPRESSION_TAG",
12
+ "id": "7035",
13
+ "created_at": "2021-11-16T00:12:26Z",
14
+ "updated_at": "2021-11-16T00:12:26Z",
15
+ "deleted": false
16
+ }
17
+ }
@@ -240,22 +240,22 @@ describe TwitterAds::Account do
240
240
 
241
241
  end
242
242
 
243
- describe '#tailored_audiences' do
243
+ describe '#custom_audiences' do
244
244
 
245
245
  before(:each) do
246
- resource_collection = "#{ADS_API}/accounts/#{account.id}/tailored_audiences"
247
- stub_fixture(:get, :tailored_audiences_all, resource_collection)
246
+ resource_collection = "#{ADS_API}/accounts/#{account.id}/custom_audiences"
247
+ stub_fixture(:get, :custom_audiences_all, resource_collection)
248
248
 
249
- resource = "#{ADS_API}/accounts/#{account.id}/tailored_audiences/abc2"
250
- stub_fixture(:get, :tailored_audiences_load, /#{resource}\?.*/)
249
+ resource = "#{ADS_API}/accounts/#{account.id}/custom_audiences/abc2"
250
+ stub_fixture(:get, :custom_audiences_load, /#{resource}\?.*/)
251
251
  end
252
252
 
253
253
  context 'with an id specified' do
254
254
 
255
- it 'successfully loads the specified tailored audience' do
256
- result = account.tailored_audiences('abc2')
255
+ it 'successfully loads the specified custom audience' do
256
+ result = account.custom_audiences('abc2')
257
257
  expect(result).not_to be_nil
258
- expect(result.class).to eq(TwitterAds::TailoredAudience)
258
+ expect(result.class).to eq(TwitterAds::CustomAudience)
259
259
  expect(result.id).to eq('abc2')
260
260
  end
261
261
 
@@ -263,11 +263,11 @@ describe TwitterAds::Account do
263
263
 
264
264
  context 'without an id specified' do
265
265
 
266
- it 'succesfully returns a cursor with all tailored audiences' do
267
- result = account.tailored_audiences
266
+ it 'succesfully returns a cursor with all custom audiences' do
267
+ result = account.custom_audiences
268
268
  expect(result.to_a.size).to eq(3)
269
269
  expect(result.class).to eq(TwitterAds::Cursor)
270
- expect(result.first.class).to eq(TwitterAds::TailoredAudience)
270
+ expect(result.first.class).to eq(TwitterAds::CustomAudience)
271
271
  expect(result.first.id).to eq('abc2')
272
272
  end
273
273
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  require 'spec_helper'
5
5
 
6
- describe TwitterAds::TailoredAudience do
6
+ describe TwitterAds::CustomAudience do
7
7
 
8
8
  before(:each) do
9
9
  stub_fixture(:get, :accounts_all, "#{ADS_API}/accounts")
@@ -31,11 +31,12 @@ describe TwitterAds::TailoredAudience do
31
31
  deleted
32
32
  audience_size
33
33
  audience_type
34
- metadata
35
34
  partner_source
36
35
  reasons_not_targetable
37
36
  targetable
38
37
  targetable_types
38
+ permission_level
39
+ owner_account_id
39
40
  )
40
41
 
41
42
  write = %w(name list_type)
@@ -30,17 +30,20 @@ describe TwitterAds::LineItem do
30
30
  name
31
31
  campaign_id
32
32
  advertiser_domain
33
+ android_app_store_identifier
34
+ audience_expansion
33
35
  categories
34
- charge_by
36
+ pay_by
35
37
  objective
36
38
  entity_status
37
39
  primary_web_event_tag
38
40
  product_type
39
41
  placements
40
- bid_unit
41
- automatically_select_bid
42
+ bid_strategy
42
43
  bid_amount_local_micro
43
44
  total_budget_amount_local_micro
45
+ goal
46
+ ios_app_store_identifier
44
47
  )
45
48
  include_examples 'object property check', read, write
46
49
 
@@ -30,6 +30,7 @@ describe TwitterAds::TargetingCriteria do
30
30
  line_item_id
31
31
  targeting_type
32
32
  targeting_value
33
+ operator_type
33
34
  tailored_audience_expansion
34
35
  )
35
36
 
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+ # Copyright (C) 2019 Twitter, Inc.
3
+
4
+ require 'spec_helper'
5
+
6
+ describe TwitterAds::TrackingTag do
7
+
8
+ before(:each) do
9
+ stub_fixture(:get, :accounts_all, "#{ADS_API}/accounts")
10
+ stub_fixture(:get, :accounts_load, "#{ADS_API}/accounts/2iqph")
11
+ end
12
+
13
+ let(:client) do
14
+ Client.new(
15
+ Faker::Lorem.characters(15),
16
+ Faker::Lorem.characters(40),
17
+ "123456-#{Faker::Lorem.characters(40)}",
18
+ Faker::Lorem.characters(40)
19
+ )
20
+ end
21
+
22
+ let(:account) { client.accounts.first }
23
+
24
+ # check model properties
25
+ subject { described_class.new(account) }
26
+ read = %w(id)
27
+ write = %w(line_item_id tracking_tag_type tracking_tag_url)
28
+ include_examples 'object property check', read, write
29
+
30
+ describe '#create' do
31
+
32
+ let(:tracking_tag) { TwitterAds::TrackingTag.new(account) }
33
+ let!(:resource) { "#{ADS_API}/accounts/#{account.id}/tracking_tags" }
34
+ let!(:rel_path) { "/#{TwitterAds::API_VERSION}/accounts/#{account.id}/tracking_tags" }
35
+
36
+ before(:each) do
37
+ stub_fixture(:post, :tracking_tags_load, /#{resource}\?.*/)
38
+ end
39
+
40
+ it 'creates post request with line item ID and url' do
41
+ line_item_id = 'axe123'
42
+ tracking_tag_url = 'https://ad.doubleclick.net/ddm/trackimp/N1234.2061500TWITTER-OFFICIAL/B9156151.125630439;dc_trk_aid=1355;dc_trk_cid=8675309'
43
+ tracking_tag_type = 'IMPRESSION_TAG'
44
+
45
+ params = {
46
+ line_item_id: line_item_id,
47
+ tracking_tag_url: tracking_tag_url,
48
+ tracking_tag_type: tracking_tag_type
49
+ }
50
+ args = [account.client, :post, rel_path, params: params]
51
+
52
+ expect(Request).to receive(:new).with(*args).and_call_original
53
+ tracking_tag.create(line_item_id, tracking_tag_url)
54
+ end
55
+
56
+ end
57
+
58
+ end
@@ -41,6 +41,24 @@ describe TwitterAds::Creative::PromotedTweet do
41
41
  expect { subject.save }.to raise_error(TwitterAds::ClientError)
42
42
  end
43
43
 
44
+ it 'sets params[:tweet_ids] from params[:tweet_id]' do
45
+ request = double('request')
46
+ response = double('response')
47
+ allow(response).to receive(:body).and_return({ data: [{}] })
48
+ allow(request).to receive(:perform).and_return(response)
49
+ expected_params = { params: { line_item_id: '12345', tweet_ids: 99999999999999999999 } }
50
+
51
+ expect(Request).to receive(:new).with(
52
+ client,
53
+ :post,
54
+ "/#{TwitterAds::API_VERSION}/accounts/#{account.id}/promoted_tweets",
55
+ expected_params
56
+ ).and_return(request)
57
+
58
+ subject.line_item_id = '12345'
59
+ subject.tweet_id = 99999999999999999999
60
+ subject.save
61
+ end
44
62
  end
45
63
 
46
64
  end
@@ -3,12 +3,12 @@
3
3
 
4
4
  require 'spec_helper'
5
5
 
6
- describe TwitterAds::AudienceSummary do
6
+ describe TwitterAds::AudienceEstimate do
7
7
 
8
8
  before(:each) do
9
9
  stub_fixture(:get, :accounts_all, "#{ADS_API}/accounts")
10
10
  stub_fixture(:get, :accounts_load, "#{ADS_API}/accounts/2iqph")
11
- stub_fixture(:post, :audience_summary, "#{ADS_API}/accounts/2iqph/audience_summary")
11
+ stub_fixture(:post, :audience_estimate, "#{ADS_API}/accounts/2iqph/audience_estimate")
12
12
  end
13
13
 
14
14
  let(:client) do