twitter-ads 5.1.0 → 7.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -2
- data/README.md +1 -1
- data/lib/twitter-ads.rb +8 -4
- data/lib/twitter-ads/account.rb +6 -25
- data/lib/twitter-ads/audiences/tailored_audience.rb +98 -3
- data/lib/twitter-ads/{targeting_criteria/behavior_taxonomy.rb → campaign/advertiser_business_categories.rb} +6 -6
- data/lib/twitter-ads/campaign/campaign.rb +1 -2
- data/lib/twitter-ads/campaign/content_categories.rb +23 -0
- data/lib/twitter-ads/campaign/funding_instrument.rb +1 -2
- data/lib/twitter-ads/campaign/line_item.rb +4 -4
- data/lib/twitter-ads/campaign/organic_tweet.rb +1 -3
- data/lib/twitter-ads/campaign/targeting_criteria.rb +0 -1
- data/lib/twitter-ads/campaign/tweet.rb +4 -49
- data/lib/twitter-ads/client.rb +2 -2
- data/lib/twitter-ads/creative/account_media.rb +4 -6
- data/lib/twitter-ads/creative/draft_tweet.rb +40 -0
- data/lib/twitter-ads/creative/image_app_download_card.rb +2 -2
- data/lib/twitter-ads/creative/image_conversation_card.rb +3 -2
- data/lib/twitter-ads/creative/media_creative.rb +2 -3
- data/lib/twitter-ads/creative/media_library.rb +12 -13
- data/lib/twitter-ads/creative/promoted_account.rb +1 -2
- data/lib/twitter-ads/creative/promoted_tweet.rb +1 -2
- data/lib/twitter-ads/creative/scheduled_tweet.rb +1 -12
- data/lib/twitter-ads/creative/tweets.rb +52 -0
- data/lib/twitter-ads/creative/video_app_download_card.rb +4 -6
- data/lib/twitter-ads/creative/video_conversation_card.rb +6 -6
- data/lib/twitter-ads/creative/video_website_card.rb +3 -5
- data/lib/twitter-ads/creative/website_card.rb +2 -2
- data/lib/twitter-ads/cursor.rb +6 -0
- data/lib/twitter-ads/enum.rb +19 -9
- data/lib/twitter-ads/error.rb +5 -15
- data/lib/twitter-ads/http/request.rb +37 -2
- data/lib/twitter-ads/http/response.rb +1 -13
- data/lib/twitter-ads/resources/analytics.rb +99 -47
- data/lib/twitter-ads/resources/dsl.rb +8 -1
- data/lib/twitter-ads/restapi.rb +29 -0
- data/lib/twitter-ads/settings/tax.rb +13 -1
- data/lib/twitter-ads/targeting/audience_summary.rb +47 -0
- data/lib/twitter-ads/targeting_criteria/{behavior.rb → conversation.rb} +3 -7
- data/lib/twitter-ads/utils.rb +23 -0
- data/lib/twitter-ads/version.rb +1 -1
- data/spec/fixtures/audience_summary.json +14 -0
- data/spec/fixtures/line_items_all.json +2 -10
- data/spec/fixtures/line_items_load.json +0 -1
- data/spec/fixtures/tweet_previews.json +23 -0
- data/spec/spec_helper.rb +1 -4
- data/spec/twitter-ads/campaign/line_item_spec.rb +0 -1
- data/spec/twitter-ads/campaign/targeting_criteria_spec.rb +0 -1
- data/spec/twitter-ads/campaign/tweet_spec.rb +0 -59
- data/spec/twitter-ads/client_spec.rb +17 -1
- data/spec/twitter-ads/creative/media_creative_spec.rb +1 -1
- data/spec/twitter-ads/creative/tweet_previews_spec.rb +41 -0
- data/spec/twitter-ads/rate_limit_spec.rb +247 -0
- data/spec/twitter-ads/retry_count_spec.rb +61 -0
- data/spec/twitter-ads/{creative/image_app_download_card_spec.rb → targeting/audience_summary_spec.rb} +16 -18
- metadata +46 -47
- data/lib/twitter-ads/audiences/audience_intelligence.rb +0 -68
- data/lib/twitter-ads/targeting/reach_estimate.rb +0 -78
- data/spec/fixtures/tweet_preview.json +0 -24
- data/spec/twitter-ads/campaign/reach_estimate_spec.rb +0 -103
- data/spec/twitter-ads/creative/account_media_spec.rb +0 -32
- data/spec/twitter-ads/creative/image_conversation_card_spec.rb +0 -40
- data/spec/twitter-ads/creative/video_app_download_card_spec.rb +0 -42
- data/spec/twitter-ads/creative/video_conversation_card_spec.rb +0 -51
- data/spec/twitter-ads/creative/website_card_spec.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b42045b5ca461ee6f6a13ed129264351506089d23622ad2429a1a154e0b2b03f
|
4
|
+
data.tar.gz: 431d8797b1d1aa606c10672780708112053710b0e745e46e13bd602097c48ca9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb703d3ef21d673d313c7223474e5dabbdb0d64233b88550a1135773118273a71272a38b791c927139773de1b62e639f06075fd9a25a94668e9a7cefd9bd0f82
|
7
|
+
data.tar.gz: bcef25e9c1a7a4d3ac331bbf901dbaefbe00121a7f0ca6e66c484f0b93585d5d8e85d7d8e46d3bfe771cc5daa584735626300a3b56743e529e4de5031aff3a36
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (C)
|
3
|
+
Copyright (C) 2020 Twitter, Inc.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
21
|
SOFTWARE.
|
22
|
-
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Getting Started [![Build Status](https://travis-ci.org/twitterdev/twitter-ruby-ads-sdk.svg?branch=master)](https://travis-ci.org/twitterdev/twitter-ruby-ads-sdk)
|
1
|
+
Getting Started [![Build Status](https://travis-ci.org/twitterdev/twitter-ruby-ads-sdk.svg?branch=master)](https://travis-ci.org/twitterdev/twitter-ruby-ads-sdk)[![Gem Version](https://badge.fury.io/rb/twitter-ads.svg)](http://badge.fury.io/rb/twitter-ads)
|
2
2
|
------
|
3
3
|
|
4
4
|
##### Installation
|
data/lib/twitter-ads.rb
CHANGED
@@ -27,7 +27,8 @@ require 'twitter-ads/resources/batch'
|
|
27
27
|
require 'twitter-ads/http/request'
|
28
28
|
require 'twitter-ads/http/response'
|
29
29
|
|
30
|
-
require 'twitter-ads/
|
30
|
+
require 'twitter-ads/restapi.rb'
|
31
|
+
|
31
32
|
require 'twitter-ads/audiences/tailored_audience'
|
32
33
|
|
33
34
|
require 'twitter-ads/campaign/app_list'
|
@@ -39,19 +40,20 @@ require 'twitter-ads/campaign/targeting_criteria'
|
|
39
40
|
require 'twitter-ads/campaign/tweet'
|
40
41
|
require 'twitter-ads/campaign/organic_tweet'
|
41
42
|
require 'twitter-ads/campaign/iab_category'
|
43
|
+
require 'twitter-ads/campaign/advertiser_business_categories'
|
44
|
+
require 'twitter-ads/campaign/content_categories'
|
42
45
|
|
43
46
|
require 'twitter-ads/targeting_criteria/tv_market'
|
44
47
|
require 'twitter-ads/targeting_criteria/tv_show'
|
45
48
|
require 'twitter-ads/targeting_criteria/event'
|
46
49
|
require 'twitter-ads/targeting_criteria/device'
|
50
|
+
require 'twitter-ads/targeting_criteria/conversation'
|
47
51
|
require 'twitter-ads/targeting_criteria/platform'
|
48
52
|
require 'twitter-ads/targeting_criteria/platform_version'
|
49
53
|
require 'twitter-ads/targeting_criteria/network_operator'
|
50
54
|
require 'twitter-ads/targeting_criteria/location'
|
51
55
|
require 'twitter-ads/targeting_criteria/interest'
|
52
56
|
require 'twitter-ads/targeting_criteria/language'
|
53
|
-
require 'twitter-ads/targeting_criteria/behavior'
|
54
|
-
require 'twitter-ads/targeting_criteria/behavior_taxonomy'
|
55
57
|
require 'twitter-ads/targeting_criteria/app_store_category'
|
56
58
|
|
57
59
|
require 'twitter-ads/creative/account_media'
|
@@ -63,14 +65,16 @@ require 'twitter-ads/creative/media_library'
|
|
63
65
|
require 'twitter-ads/creative/promoted_account'
|
64
66
|
require 'twitter-ads/creative/promoted_tweet'
|
65
67
|
require 'twitter-ads/creative/scheduled_tweet'
|
68
|
+
require 'twitter-ads/creative/draft_tweet'
|
66
69
|
require 'twitter-ads/creative/video_app_download_card'
|
67
70
|
require 'twitter-ads/creative/video_conversation_card'
|
68
71
|
require 'twitter-ads/creative/video_website_card'
|
69
72
|
require 'twitter-ads/creative/website_card'
|
70
73
|
require 'twitter-ads/creative/poll_cards'
|
71
74
|
require 'twitter-ads/creative/tweet_previews'
|
75
|
+
require 'twitter-ads/creative/tweets'
|
72
76
|
|
73
|
-
require 'twitter-ads/targeting/
|
77
|
+
require 'twitter-ads/targeting/audience_summary'
|
74
78
|
|
75
79
|
require 'twitter-ads/measurement/web_event_tag'
|
76
80
|
require 'twitter-ads/measurement/app_event_tag'
|
data/lib/twitter-ads/account.rb
CHANGED
@@ -17,14 +17,12 @@ module TwitterAds
|
|
17
17
|
property :updated_at, type: :time, read_only: true
|
18
18
|
property :deleted, type: :bool, read_only: true
|
19
19
|
|
20
|
-
RESOURCE_COLLECTION
|
21
|
-
|
22
|
-
RESOURCE
|
23
|
-
|
24
|
-
FEATURES
|
25
|
-
|
26
|
-
SCOPED_TIMELINE = "/#{TwitterAds::API_VERSION}/" \
|
27
|
-
'accounts/%{id}/scoped_timeline' # @api private
|
20
|
+
RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/" \
|
21
|
+
'accounts' # @api private
|
22
|
+
RESOURCE = "/#{TwitterAds::API_VERSION}/" \
|
23
|
+
'accounts/%{id}' # @api private
|
24
|
+
FEATURES = "/#{TwitterAds::API_VERSION}/" \
|
25
|
+
'accounts/%{id}/features' # @api private
|
28
26
|
AUTHENTICATED_USER_ACCESS = "/#{TwitterAds::API_VERSION}/" \
|
29
27
|
'accounts/%{id}/authenticated_user_access' # @api private
|
30
28
|
|
@@ -248,23 +246,6 @@ module TwitterAds
|
|
248
246
|
load_resource(TailoredAudience, id, opts)
|
249
247
|
end
|
250
248
|
|
251
|
-
# Returns the most recent promotable Tweets created by one or more specified Twitter users.
|
252
|
-
#
|
253
|
-
# @param ids [Array] An Array of Twitter user IDs.
|
254
|
-
# @param opts [Hash] A Hash of extended options.
|
255
|
-
#
|
256
|
-
# @return [Array] An Array of Tweet objects.
|
257
|
-
#
|
258
|
-
# @since 0.2.3
|
259
|
-
def scoped_timeline(ids, opts = {})
|
260
|
-
ids = ids.join(',') if ids.is_a?(Array)
|
261
|
-
params = { user_ids: ids }.merge!(opts)
|
262
|
-
resource = SCOPED_TIMELINE % { id: @id }
|
263
|
-
request = Request.new(client, :get, resource, params: params)
|
264
|
-
response = request.perform
|
265
|
-
response.body[:data]
|
266
|
-
end
|
267
|
-
|
268
249
|
def authenticated_user_access
|
269
250
|
params = {}
|
270
251
|
resource = AUTHENTICATED_USER_ACCESS % { id: @id }
|
@@ -29,9 +29,9 @@ module TwitterAds
|
|
29
29
|
'accounts/%{account_id}/tailored_audiences' # @api private
|
30
30
|
RESOURCE = "/#{TwitterAds::API_VERSION}/" \
|
31
31
|
'accounts/%{account_id}/tailored_audiences/%{id}' # @api private
|
32
|
-
RESOURCE_USERS = "/#{TwitterAds::API_VERSION}/ \
|
33
|
-
accounts/%{account_id}/tailored_audiences/ \
|
34
|
-
%{id}/users
|
32
|
+
RESOURCE_USERS = "/#{TwitterAds::API_VERSION}/" \
|
33
|
+
'accounts/%{account_id}/tailored_audiences/' \
|
34
|
+
'%{id}/users' # @api private
|
35
35
|
|
36
36
|
LIST_TYPES = %w(
|
37
37
|
EMAIL
|
@@ -138,4 +138,99 @@ module TwitterAds
|
|
138
138
|
end
|
139
139
|
|
140
140
|
end
|
141
|
+
|
142
|
+
class TailoredAudiencePermission
|
143
|
+
|
144
|
+
include TwitterAds::DSL
|
145
|
+
include TwitterAds::Resource
|
146
|
+
|
147
|
+
attr_reader :account
|
148
|
+
|
149
|
+
# read-only
|
150
|
+
property :created_at, type: :time, read_only: true
|
151
|
+
property :updated_at, type: :time, read_only: true
|
152
|
+
property :deleted, type: :bool, read_only: true
|
153
|
+
|
154
|
+
property :id
|
155
|
+
property :tailored_audience_id
|
156
|
+
property :granted_account_id
|
157
|
+
property :permission_level
|
158
|
+
|
159
|
+
RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/" \
|
160
|
+
'accounts/%{account_id}/tailored_audiences/' \
|
161
|
+
'%{tailored_audience_id}/permissions' # @api private
|
162
|
+
RESOURCE = "/#{TwitterAds::API_VERSION}/" \
|
163
|
+
'accounts/%{account_id}/tailored_audiences/' \
|
164
|
+
'%{tailored_audience_id}/permissions/%{id}' # @api private
|
165
|
+
|
166
|
+
def initialize(account)
|
167
|
+
@account = account
|
168
|
+
self
|
169
|
+
end
|
170
|
+
|
171
|
+
class << self
|
172
|
+
|
173
|
+
# Retrieve details for some or
|
174
|
+
# all permissions associated with the specified tailored audience.
|
175
|
+
#
|
176
|
+
# @exapmle
|
177
|
+
# permissions = TailoredAudiencePermission.all(account, '36n4f')
|
178
|
+
#
|
179
|
+
# @param account [Account] The account object instance.
|
180
|
+
# @param tailored_audience_id [String] The tailored audience id.
|
181
|
+
#
|
182
|
+
# @since 5.2.0
|
183
|
+
#
|
184
|
+
# @return [TailoredAudiencePermission] The tailored audience permission instance.
|
185
|
+
def all(account, tailored_audience_id, opts = {})
|
186
|
+
params = {}.merge!(opts)
|
187
|
+
resource = RESOURCE_COLLECTION % {
|
188
|
+
account_id: account.id,
|
189
|
+
tailored_audience_id: tailored_audience_id
|
190
|
+
}
|
191
|
+
request = Request.new(account.client, :get, resource, params: params)
|
192
|
+
Cursor.new(self, request, init_with: [account])
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|
196
|
+
|
197
|
+
# Saves or updates the current object instance
|
198
|
+
# depending on the presence of `object.tailored_audience_id`.
|
199
|
+
#
|
200
|
+
# @exapmle
|
201
|
+
# object.save
|
202
|
+
#
|
203
|
+
# @since 5.2.0
|
204
|
+
#
|
205
|
+
# @return [self] Returns the instance refreshed from the API.
|
206
|
+
def save
|
207
|
+
resource = RESOURCE_COLLECTION % {
|
208
|
+
account_id: account.id,
|
209
|
+
tailored_audience_id: tailored_audience_id
|
210
|
+
}
|
211
|
+
params = to_params
|
212
|
+
response = Request.new(account.client, :post, resource, params: params).perform
|
213
|
+
from_response(response.body[:data])
|
214
|
+
end
|
215
|
+
|
216
|
+
# Deletes the current or specified tailored audience permission.
|
217
|
+
#
|
218
|
+
# @example
|
219
|
+
# object.delete!
|
220
|
+
#
|
221
|
+
# Note: calls to this method are destructive and irreverisble.
|
222
|
+
#
|
223
|
+
# @since 5.2.0
|
224
|
+
#
|
225
|
+
# @return [self] Returns the instance refreshed from the API.
|
226
|
+
def delete!
|
227
|
+
resource = RESOURCE % {
|
228
|
+
account_id: account.id,
|
229
|
+
tailored_audience_id: tailored_audience_id,
|
230
|
+
id: @id
|
231
|
+
}
|
232
|
+
response = Request.new(account.client, :delete, resource).perform
|
233
|
+
from_response(response.body[:data])
|
234
|
+
end
|
235
|
+
end
|
141
236
|
end
|
@@ -2,19 +2,19 @@
|
|
2
2
|
# Copyright (C) 2019 Twitter, Inc.
|
3
3
|
|
4
4
|
module TwitterAds
|
5
|
-
class
|
5
|
+
class AdvertiserBusinessCategories
|
6
6
|
|
7
7
|
include TwitterAds::DSL
|
8
8
|
include TwitterAds::Resource
|
9
9
|
|
10
|
+
attr_reader :account
|
11
|
+
|
10
12
|
property :id, read_only: true
|
11
13
|
property :name, read_only: true
|
12
|
-
property :
|
13
|
-
property :created_at, read_only: true
|
14
|
-
property :updated_at, read_only: true
|
14
|
+
property :iab_categories, read_only: true
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
# @api private
|
17
|
+
RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/advertiser_business_categories"
|
18
18
|
|
19
19
|
def initialize(account)
|
20
20
|
@account = account
|
@@ -2,12 +2,11 @@
|
|
2
2
|
# Copyright (C) 2019 Twitter, Inc.
|
3
3
|
|
4
4
|
module TwitterAds
|
5
|
-
class Campaign
|
5
|
+
class Campaign < Analytics
|
6
6
|
|
7
7
|
include TwitterAds::DSL
|
8
8
|
include TwitterAds::Resource
|
9
9
|
include TwitterAds::Persistence
|
10
|
-
include TwitterAds::Analytics
|
11
10
|
include TwitterAds::Batch
|
12
11
|
|
13
12
|
attr_reader :account
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Copyright (C) 2019 Twitter, Inc.
|
3
|
+
|
4
|
+
module TwitterAds
|
5
|
+
class ContentCategories
|
6
|
+
|
7
|
+
include TwitterAds::DSL
|
8
|
+
include TwitterAds::Resource
|
9
|
+
|
10
|
+
attr_reader :account
|
11
|
+
|
12
|
+
property :id, read_only: true
|
13
|
+
property :name, read_only: true
|
14
|
+
property :iab_categories, read_only: true
|
15
|
+
|
16
|
+
RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/content_categories" # @api private
|
17
|
+
|
18
|
+
def initialize(account)
|
19
|
+
@account = account
|
20
|
+
self
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -2,12 +2,11 @@
|
|
2
2
|
# Copyright (C) 2019 Twitter, Inc.
|
3
3
|
|
4
4
|
module TwitterAds
|
5
|
-
class LineItem
|
5
|
+
class LineItem < Analytics
|
6
6
|
|
7
7
|
include TwitterAds::DSL
|
8
8
|
include TwitterAds::Resource
|
9
9
|
include TwitterAds::Persistence
|
10
|
-
include TwitterAds::Analytics
|
11
10
|
include TwitterAds::Batch
|
12
11
|
|
13
12
|
attr_reader :account
|
@@ -18,6 +17,7 @@ module TwitterAds
|
|
18
17
|
property :updated_at, type: :time, read_only: true
|
19
18
|
|
20
19
|
property :advertiser_domain
|
20
|
+
property :android_app_store_identifier
|
21
21
|
property :automatically_select_bid
|
22
22
|
property :bid_amount_local_micro
|
23
23
|
property :bid_unit
|
@@ -26,7 +26,7 @@ module TwitterAds
|
|
26
26
|
property :charge_by
|
27
27
|
property :end_time, type: :time
|
28
28
|
property :entity_status
|
29
|
-
property :
|
29
|
+
property :ios_app_store_identifier
|
30
30
|
property :name
|
31
31
|
property :objective
|
32
32
|
property :optimization
|
@@ -40,7 +40,7 @@ module TwitterAds
|
|
40
40
|
property :advertiser_user_id
|
41
41
|
property :bid_type
|
42
42
|
property :tracking_tags
|
43
|
-
property :
|
43
|
+
property :audience_expansion
|
44
44
|
|
45
45
|
# sdk only
|
46
46
|
property :to_delete, type: :bool
|
@@ -2,66 +2,21 @@
|
|
2
2
|
# Copyright (C) 2019 Twitter, Inc.
|
3
3
|
|
4
4
|
module TwitterAds
|
5
|
-
|
5
|
+
class Tweet < Analytics
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/" \
|
11
|
-
'accounts/%{account_id}/tweet/preview' # @api private
|
12
|
-
RESOURCE = "/#{TwitterAds::API_VERSION}/" \
|
13
|
-
'accounts/%{account_id}/tweet/preview/%{id}' # @api private
|
14
|
-
RESOURCE_CREATE = "/#{TwitterAds::API_VERSION}/" \
|
15
|
-
'accounts/%{account_id}/tweet' # @api private
|
7
|
+
RESOURCE_CREATE = "/#{TwitterAds::API_VERSION}/" \
|
8
|
+
'accounts/%{account_id}/tweet' # @api private
|
16
9
|
|
17
10
|
class << self
|
18
11
|
|
19
|
-
# Returns an HTML preview of a tweet, either new or existing
|
20
|
-
#
|
21
|
-
# @example
|
22
|
-
# Tweet.preview(account, text: 'potatoes can be deadly...')
|
23
|
-
# Tweet.preview(account, id: 634798319504617472)
|
24
|
-
#
|
25
|
-
# @param client [Client] The Client object instance.
|
26
|
-
# @param account [Account] The Account object instance.
|
27
|
-
# @param opts [Hash] A hash of options.
|
28
|
-
#
|
29
|
-
# @option opts [Integer] :id The ID of an existing Tweet you want to preview.
|
30
|
-
# @option opts [String] :text The text of your status update.
|
31
|
-
# @option opts [Array] :media_ids A list of up to four media IDs to associate with the Tweet.
|
32
|
-
# @option opts [String] :card_id The base-36 ID of a revenue card to be embedded in the Tweet.
|
33
|
-
# @option opts [String] :preview_target The target to render the Tweet preview
|
34
|
-
# for (eg. TWITTER_TIMELINES).
|
35
|
-
#
|
36
|
-
# @return [Array] An array containing platforms & their respective tweet previews
|
37
|
-
#
|
38
|
-
# @since 0.2.0
|
39
|
-
# @see https://dev.twitter.com/ads/reference/get/accounts/%3Aaccount_id/tweet/preview
|
40
|
-
def preview(account, opts = {})
|
41
|
-
resource = opts.key?(:id) ? RESOURCE : RESOURCE_COLLECTION
|
42
|
-
resource = resource % { account_id: account.id, id: opts.delete(:id) }
|
43
|
-
|
44
|
-
# url encodes status message if present
|
45
|
-
opts[:text] = URI.escape(opts[:text]) if opts.key?(:text)
|
46
|
-
|
47
|
-
# handles array to string conversion for media IDs
|
48
|
-
if opts.key?(:media_ids) && opts[:media_ids].respond_to?(:join)
|
49
|
-
opts[:media_ids] = opts[:media_ids].join(',')
|
50
|
-
end
|
51
|
-
|
52
|
-
response = TwitterAds::Request.new(account.client, :get, resource, params: opts).perform
|
53
|
-
response.body[:data]
|
54
|
-
end
|
55
|
-
|
56
12
|
# Creates a "Promoted-Only" Tweet using the specialized Ads API end point.
|
57
13
|
#
|
58
14
|
# @param opts [Hash] A hash of options.
|
59
15
|
#
|
60
16
|
# @option opts [String] :text The main Tweet body.
|
61
|
-
# @option opts [Array] :
|
17
|
+
# @option opts [Array] :media_keys A list of media keys (up to 4) to associate with the Tweet.
|
62
18
|
# @option opts [Integer] :as_user_id The user ID whom you are posting the Tweet on behalf of.
|
63
19
|
# @option opts [Boolean] :trim_user Excludes the user object from the hydrated Tweet response.
|
64
|
-
# @option opts [String] :video_id The Video UUID to be associated with thie Tweet.
|
65
20
|
# @option opts [String] :video_title An optional title to be included.
|
66
21
|
# @option opts [String] :video_description An optional description to be included.
|
67
22
|
# @option opts [String] :video_cta An optional CTA value for the associated video.
|