twitter-ads 5.2.0 → 8.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.
- 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 -24
- data/lib/twitter-ads/audiences/tailored_audience.rb +56 -1
- 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 +1 -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 +2 -3
- 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 +22 -13
- 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/targeting_criteria/event.rb +1 -0
- 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/tailored_audiences_all.json +3 -0
- data/spec/fixtures/targeted_audiences.json +33 -0
- data/spec/fixtures/tweet_previews.json +23 -0
- data/spec/spec_helper.rb +1 -4
- data/spec/twitter-ads/audiences/tailored_audience_spec.rb +25 -2
- data/spec/twitter-ads/campaign/line_item_spec.rb +0 -1
- data/spec/twitter-ads/campaign/targeting_criteria_spec.rb +1 -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/promoted_tweet_spec.rb +18 -0
- 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 +50 -49
- 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: ffe2cf6607163db38e5a09d5cc26e6bd38e700ac5a9a63be8bfaac8837f15725
|
4
|
+
data.tar.gz: 58becc51cdae11dbb55f40f7bc5aaccb024efb250e6f34d3020cc310cfeb3cdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49bec3d898f35d4b0b9e8a95244910230f0c580f6eaf1b111ce71661ea247df2ec5f698600b8a86537889bfe4f4cf2be7a34745f9ffef04be99ad6a9c789f67f
|
7
|
+
data.tar.gz: 34c513a59fd03118f3c9273401867c1d5e1a8d81dfcb0a9a9891549350639d68d86dd1670e6822aaa3aab171d474c70b28f161350680ed767f702f39dcbe63cc
|
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 [](https://travis-ci.org/twitterdev/twitter-ruby-ads-sdk)
|
1
|
+
Getting Started [](https://travis-ci.org/twitterdev/twitter-ruby-ads-sdk)[](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,22 +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(id, opts = {})
|
260
|
-
params = { user_id: id }.merge!(opts)
|
261
|
-
resource = SCOPED_TIMELINE % { id: @id }
|
262
|
-
request = Request.new(client, :get, resource, params: params)
|
263
|
-
response = request.perform
|
264
|
-
response.body[:data]
|
265
|
-
end
|
266
|
-
|
267
249
|
def authenticated_user_access
|
268
250
|
params = {}
|
269
251
|
resource = AUTHENTICATED_USER_ACCESS % { id: @id }
|
@@ -20,6 +20,7 @@ module TwitterAds
|
|
20
20
|
property :audience_size, read_only: true
|
21
21
|
property :audience_type, read_only: true
|
22
22
|
property :metadata, read_only: true
|
23
|
+
property :owner_account_id, read_only: true
|
23
24
|
property :partner_source, read_only: true
|
24
25
|
property :reasons_not_targetable, read_only: true
|
25
26
|
property :targetable, type: :bool, read_only: true
|
@@ -91,7 +92,7 @@ module TwitterAds
|
|
91
92
|
from_response(response.body[:data])
|
92
93
|
end
|
93
94
|
|
94
|
-
# This is a private API and requires
|
95
|
+
# This is a private API and requires allowlisting from Twitter.
|
95
96
|
#
|
96
97
|
# This endpoint will allow partners to add, update and remove users from a given
|
97
98
|
# tailored_audience_id.
|
@@ -137,6 +138,60 @@ module TwitterAds
|
|
137
138
|
[success_count, total_count]
|
138
139
|
end
|
139
140
|
|
141
|
+
# Retrieves the entites targeting the current tailored audience instance.
|
142
|
+
#
|
143
|
+
# @example
|
144
|
+
# audience.targeted(with_active=true)
|
145
|
+
#
|
146
|
+
# @param with_active [bool] Include active/inactive
|
147
|
+
#
|
148
|
+
# @since 8.0.0
|
149
|
+
#
|
150
|
+
# @return [self] Returns a Cursor instance of the targeted entities.
|
151
|
+
def targeted(opts = {})
|
152
|
+
validate_loaded
|
153
|
+
params = {}.merge!(opts)
|
154
|
+
TargetedTailoredAudience.load(account, id, params)
|
155
|
+
end
|
156
|
+
|
157
|
+
def validate_loaded
|
158
|
+
raise ArgumentError.new(
|
159
|
+
"Error! #{self.class} object not yet initialized, " \
|
160
|
+
"call #{self.class}.load first") if id.nil?
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
class TargetedTailoredAudience
|
165
|
+
|
166
|
+
include TwitterAds::DSL
|
167
|
+
include TwitterAds::Resource
|
168
|
+
|
169
|
+
attr_reader :account
|
170
|
+
|
171
|
+
# read-only
|
172
|
+
property :campaign_id, read_only: true
|
173
|
+
property :campaign_name, read_only: true
|
174
|
+
property :line_items, read_only: true
|
175
|
+
|
176
|
+
RESOURCE_TARGETED = "/#{TwitterAds::API_VERSION}/" \
|
177
|
+
'accounts/%{account_id}/tailored_audiences/%{id}/targeted' # @api private
|
178
|
+
|
179
|
+
def initialize(account)
|
180
|
+
@account = account
|
181
|
+
self
|
182
|
+
end
|
183
|
+
|
184
|
+
class << self
|
185
|
+
|
186
|
+
def load(account, tailored_audience_id, params)
|
187
|
+
resource = RESOURCE_TARGETED % { account_id: account.id, id: tailored_audience_id }
|
188
|
+
request = TwitterAds::Request.new(account.client,
|
189
|
+
:get,
|
190
|
+
resource,
|
191
|
+
params: params)
|
192
|
+
Cursor.new(self, request, init_with: [account])
|
193
|
+
end
|
194
|
+
end
|
140
195
|
end
|
141
196
|
|
142
197
|
class TailoredAudiencePermission
|
@@ -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
|
@@ -21,8 +21,8 @@ module TwitterAds
|
|
21
21
|
property :line_item_id
|
22
22
|
property :targeting_type
|
23
23
|
property :targeting_value
|
24
|
+
property :operator_type
|
24
25
|
property :tailored_audience_expansion, type: :bool
|
25
|
-
property :tailored_audience_type
|
26
26
|
property :location_type
|
27
27
|
|
28
28
|
# sdk only
|
@@ -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.
|
data/lib/twitter-ads/client.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
module TwitterAds
|
5
5
|
|
6
|
-
API_VERSION = '
|
6
|
+
API_VERSION = '8'
|
7
7
|
|
8
8
|
# The Ads API Client class which functions as a
|
9
9
|
# container for basic API consumer information.
|
@@ -34,7 +34,7 @@ module TwitterAds
|
|
34
34
|
@consumer_secret = consumer_secret
|
35
35
|
@access_token = access_token
|
36
36
|
@access_token_secret = access_token_secret
|
37
|
-
@options = opts
|
37
|
+
@options = opts.fetch(:options, {})
|
38
38
|
validate
|
39
39
|
self
|
40
40
|
end
|
@@ -12,15 +12,13 @@ module TwitterAds
|
|
12
12
|
|
13
13
|
attr_reader :account
|
14
14
|
|
15
|
-
property :created_at, type: :time, read_only: true
|
16
15
|
property :deleted, type: :bool, read_only: true
|
16
|
+
property :created_at, type: :time, read_only: true
|
17
|
+
property :updated_at, type: :time, read_only: true
|
17
18
|
property :id, read_only: true
|
19
|
+
property :creative_type, read_only: true
|
20
|
+
property :media_key, read_only: true
|
18
21
|
property :media_url, read_only: true
|
19
|
-
property :updated_at, type: :time, read_only: true
|
20
|
-
|
21
|
-
property :creative_type
|
22
|
-
property :media_id
|
23
|
-
property :video_id
|
24
22
|
|
25
23
|
RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/" \
|
26
24
|
'accounts/%{account_id}/account_media' # @api private
|