twitter-ads 5.0.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +1 -1
- data/README.md +3 -4
- data/Rakefile +1 -2
- data/lib/twitter-ads.rb +10 -11
- data/lib/twitter-ads/account.rb +12 -12
- data/lib/twitter-ads/audiences/audience_intelligence.rb +3 -3
- data/lib/twitter-ads/audiences/tailored_audience.rb +12 -156
- data/lib/twitter-ads/campaign/app_list.rb +5 -5
- data/lib/twitter-ads/campaign/campaign.rb +7 -11
- data/lib/twitter-ads/campaign/funding_instrument.rb +6 -5
- data/lib/twitter-ads/campaign/iab_category.rb +2 -2
- data/lib/twitter-ads/campaign/line_item.rb +18 -21
- data/lib/twitter-ads/campaign/organic_tweet.rb +1 -5
- data/lib/twitter-ads/campaign/promotable_user.rb +5 -5
- data/lib/twitter-ads/campaign/targeting_criteria.rb +7 -7
- data/lib/twitter-ads/campaign/tweet.rb +7 -11
- data/lib/twitter-ads/client.rb +3 -4
- data/lib/twitter-ads/creative/account_media.rb +5 -5
- data/lib/twitter-ads/creative/cards_fetch.rb +8 -6
- data/lib/twitter-ads/creative/image_app_download_card.rb +5 -5
- data/lib/twitter-ads/creative/image_conversation_card.rb +5 -5
- data/lib/twitter-ads/creative/media_creative.rb +6 -5
- data/lib/twitter-ads/creative/media_library.rb +5 -5
- data/lib/twitter-ads/creative/poll_cards.rb +5 -5
- data/lib/twitter-ads/creative/promoted_account.rb +5 -9
- data/lib/twitter-ads/creative/promoted_tweet.rb +5 -9
- data/lib/twitter-ads/creative/scheduled_tweet.rb +7 -7
- data/lib/twitter-ads/creative/tweet_previews.rb +36 -0
- data/lib/twitter-ads/creative/video_app_download_card.rb +5 -5
- data/lib/twitter-ads/creative/video_conversation_card.rb +5 -5
- data/lib/twitter-ads/creative/video_website_card.rb +4 -4
- data/lib/twitter-ads/creative/website_card.rb +3 -3
- data/lib/twitter-ads/cursor.rb +2 -2
- data/lib/twitter-ads/enum.rb +128 -122
- data/lib/twitter-ads/error.rb +2 -2
- data/lib/twitter-ads/http/request.rb +6 -5
- data/lib/twitter-ads/http/response.rb +1 -1
- data/lib/twitter-ads/legacy.rb +1 -1
- data/lib/twitter-ads/measurement/app_event_tag.rb +3 -3
- data/lib/twitter-ads/measurement/web_event_tag.rb +3 -3
- data/lib/twitter-ads/resources/analytics.rb +38 -8
- data/lib/twitter-ads/resources/batch.rb +4 -4
- data/lib/twitter-ads/resources/dsl.rb +1 -1
- data/lib/twitter-ads/resources/persistence.rb +1 -1
- data/lib/twitter-ads/resources/resource.rb +2 -2
- data/lib/twitter-ads/settings/tax.rb +3 -3
- data/lib/twitter-ads/settings/user.rb +3 -3
- data/lib/twitter-ads/targeting/reach_estimate.rb +1 -1
- data/lib/twitter-ads/targeting_criteria/app_store_category.rb +3 -3
- data/lib/twitter-ads/targeting_criteria/behavior.rb +3 -3
- data/lib/twitter-ads/targeting_criteria/behavior_taxonomy.rb +3 -3
- data/lib/twitter-ads/targeting_criteria/device.rb +3 -3
- data/lib/twitter-ads/targeting_criteria/event.rb +3 -3
- data/lib/twitter-ads/targeting_criteria/interest.rb +3 -3
- data/lib/twitter-ads/targeting_criteria/language.rb +3 -3
- data/lib/twitter-ads/targeting_criteria/location.rb +3 -3
- data/lib/twitter-ads/targeting_criteria/network_operator.rb +3 -3
- data/lib/twitter-ads/targeting_criteria/platform.rb +3 -3
- data/lib/twitter-ads/targeting_criteria/platform_version.rb +3 -3
- data/lib/twitter-ads/targeting_criteria/tv_market.rb +3 -3
- data/lib/twitter-ads/targeting_criteria/tv_show.rb +3 -3
- data/lib/twitter-ads/utils.rb +2 -2
- data/lib/twitter-ads/version.rb +2 -2
- data/spec/quality_spec.rb +2 -2
- data/spec/shared/properties.rb +1 -1
- data/spec/spec_helper.rb +9 -8
- data/spec/support/helpers.rb +1 -1
- data/spec/twitter-ads/account_spec.rb +1 -1
- data/spec/twitter-ads/audiences/tailored_audience_spec.rb +1 -1
- data/spec/twitter-ads/campaign/app_list_spec.rb +1 -1
- data/spec/twitter-ads/campaign/line_item_spec.rb +1 -1
- data/spec/twitter-ads/campaign/reach_estimate_spec.rb +1 -1
- data/spec/twitter-ads/campaign/targeting_criteria_spec.rb +1 -1
- data/spec/twitter-ads/campaign/tweet_spec.rb +1 -1
- data/spec/twitter-ads/client_spec.rb +1 -1
- data/spec/twitter-ads/creative/account_media_spec.rb +1 -1
- data/spec/twitter-ads/creative/image_app_download_card_spec.rb +1 -1
- data/spec/twitter-ads/creative/image_conversation_card_spec.rb +1 -1
- data/spec/twitter-ads/creative/media_creative_spec.rb +1 -1
- data/spec/twitter-ads/creative/promoted_account_spec.rb +1 -1
- data/spec/twitter-ads/creative/promoted_tweet_spec.rb +1 -1
- data/spec/twitter-ads/creative/video_app_download_card_spec.rb +1 -1
- data/spec/twitter-ads/creative/video_conversation_card_spec.rb +1 -1
- data/spec/twitter-ads/creative/website_card_spec.rb +1 -1
- data/spec/twitter-ads/cursor_spec.rb +1 -1
- data/spec/twitter-ads/placements_spec.rb +1 -1
- data/spec/twitter-ads/utils_spec.rb +1 -1
- data/twitter-ads.gemspec +10 -6
- metadata +10 -25
- data/lib/twitter-ads/http/ton_upload.rb +0 -156
- data/spec/twitter-ads/http/ton_upload_spec.rb +0 -96
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 66b5f0101e9a3bb56a76274588cc25949cd5427a6993cf545934472013c019c1
|
4
|
+
data.tar.gz: 74f5b1183e980d2793ba90af482b70fdfdd8c6b47dfbd80a99c0208c77f42289
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 627d24d41572df3ecbd8078ab336da7008d3e9ffed57a3af1ac03d41c7c44014eee2d9da920b50505e2b24c866a80049825574cff377532c5146a5515857214b
|
7
|
+
data.tar.gz: 03e79e1ce3c97d62a7bc9aae41b94bfd0709fc7899e4c248f403e652e6d7bd51c060d32466f392162ed5bd62853c61ff2e1ca4c39a2debe19cecef0fc80e218b
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -48,12 +48,11 @@ For more help please see our [Examples and Guides](https://github.com/twitterdev
|
|
48
48
|
|
49
49
|
## Compatibility & Versioning
|
50
50
|
|
51
|
-
This project is designed to work with Ruby 2.
|
51
|
+
This project is designed to work with Ruby 2.4.0 or greater. While it may work on other version of Ruby, below are the platform and runtime versions we officially support and regularly test against.
|
52
52
|
|
53
53
|
Platform | Versions
|
54
54
|
-------- | --------
|
55
|
-
MRI | 2.
|
56
|
-
JRuby | 1.7.x, 9.0.0.0 (JDK7, JDK8, OpenJDK)
|
55
|
+
MRI | 2.4.x, 2.5.x, 2.6.x
|
57
56
|
Rubinius | 2.4.x, 2.5.x
|
58
57
|
|
59
58
|
All releases adhere to strict [semantic versioning](http://semver.org). For Example, major.minor.patch-pre (aka. stick.carrot.oops-peek).
|
@@ -90,7 +89,7 @@ Like the [Response](https://github.com/twitterdev/twitter-ruby-ads-sdk/blob/mast
|
|
90
89
|
|
91
90
|
The MIT License (MIT)
|
92
91
|
|
93
|
-
Copyright (C)
|
92
|
+
Copyright (C) 2019 Twitter, Inc.
|
94
93
|
|
95
94
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
96
95
|
of this software and associated documentation files (the "Software"), to deal
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
# Copyright (C)
|
4
|
+
# Copyright (C) 2019 Twitter, Inc.
|
5
5
|
|
6
6
|
require 'rubygems'
|
7
7
|
|
@@ -46,7 +46,6 @@ require 'rspec/core/rake_task'
|
|
46
46
|
RSpec::Core::RakeTask.new(:spec)
|
47
47
|
|
48
48
|
unless ENV['CI']
|
49
|
-
|
50
49
|
# Release and Deployment
|
51
50
|
desc 'Builds the latest SDK docs locally'
|
52
51
|
task :docs do
|
data/lib/twitter-ads.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# rubocop:disable
|
1
|
+
# rubocop:disable Naming/FileName
|
2
2
|
# frozen_string_literal: true
|
3
|
-
# Copyright (C)
|
4
|
-
# rubocop:enable
|
3
|
+
# Copyright (C) 2019 Twitter, Inc.
|
4
|
+
# rubocop:enable Naming/FileName
|
5
5
|
|
6
6
|
require 'time'
|
7
7
|
require 'oauth'
|
@@ -12,20 +12,20 @@ require 'logger'
|
|
12
12
|
require 'twitter-ads/version'
|
13
13
|
require 'twitter-ads/utils'
|
14
14
|
require 'twitter-ads/error'
|
15
|
-
|
15
|
+
require 'twitter-ads/enum'
|
16
16
|
require 'twitter-ads/resources/dsl'
|
17
|
-
require 'twitter-ads/resources/resource'
|
18
|
-
require 'twitter-ads/resources/persistence'
|
19
|
-
require 'twitter-ads/resources/analytics'
|
20
|
-
require 'twitter-ads/resources/batch'
|
21
17
|
|
22
18
|
require 'twitter-ads/client'
|
23
19
|
require 'twitter-ads/cursor'
|
24
20
|
require 'twitter-ads/account'
|
25
21
|
|
22
|
+
require 'twitter-ads/resources/resource'
|
23
|
+
require 'twitter-ads/resources/persistence'
|
24
|
+
require 'twitter-ads/resources/analytics'
|
25
|
+
require 'twitter-ads/resources/batch'
|
26
|
+
|
26
27
|
require 'twitter-ads/http/request'
|
27
28
|
require 'twitter-ads/http/response'
|
28
|
-
require 'twitter-ads/http/ton_upload'
|
29
29
|
|
30
30
|
require 'twitter-ads/audiences/audience_intelligence'
|
31
31
|
require 'twitter-ads/audiences/tailored_audience'
|
@@ -40,8 +40,6 @@ require 'twitter-ads/campaign/tweet'
|
|
40
40
|
require 'twitter-ads/campaign/organic_tweet'
|
41
41
|
require 'twitter-ads/campaign/iab_category'
|
42
42
|
|
43
|
-
require 'twitter-ads/enum'
|
44
|
-
|
45
43
|
require 'twitter-ads/targeting_criteria/tv_market'
|
46
44
|
require 'twitter-ads/targeting_criteria/tv_show'
|
47
45
|
require 'twitter-ads/targeting_criteria/event'
|
@@ -70,6 +68,7 @@ require 'twitter-ads/creative/video_conversation_card'
|
|
70
68
|
require 'twitter-ads/creative/video_website_card'
|
71
69
|
require 'twitter-ads/creative/website_card'
|
72
70
|
require 'twitter-ads/creative/poll_cards'
|
71
|
+
require 'twitter-ads/creative/tweet_previews'
|
73
72
|
|
74
73
|
require 'twitter-ads/targeting/reach_estimate'
|
75
74
|
|
data/lib/twitter-ads/account.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# Copyright (C)
|
2
|
+
# Copyright (C) 2019 Twitter, Inc.
|
3
3
|
|
4
4
|
module TwitterAds
|
5
5
|
class Account
|
@@ -17,16 +17,16 @@ 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 = "/#{TwitterAds::API_VERSION}/"
|
21
|
-
'accounts'
|
22
|
-
RESOURCE = "/#{TwitterAds::API_VERSION}/"
|
23
|
-
'accounts/%{id}'
|
24
|
-
FEATURES = "/#{TwitterAds::API_VERSION}/"
|
25
|
-
'accounts/%{id}/features'
|
26
|
-
SCOPED_TIMELINE = "/#{TwitterAds::API_VERSION}/"
|
27
|
-
'accounts/%{id}/scoped_timeline'
|
28
|
-
AUTHENTICATED_USER_ACCESS = "/#{TwitterAds::API_VERSION}/"
|
29
|
-
'accounts/%{id}/authenticated_user_access'
|
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
|
26
|
+
SCOPED_TIMELINE = "/#{TwitterAds::API_VERSION}/" \
|
27
|
+
'accounts/%{id}/scoped_timeline' # @api private
|
28
|
+
AUTHENTICATED_USER_ACCESS = "/#{TwitterAds::API_VERSION}/" \
|
29
|
+
'accounts/%{id}/authenticated_user_access' # @api private
|
30
30
|
|
31
31
|
def initialize(client)
|
32
32
|
@client = client
|
@@ -77,7 +77,7 @@ module TwitterAds
|
|
77
77
|
#
|
78
78
|
# @return [String] The object instance detail.
|
79
79
|
def inspect
|
80
|
-
str =
|
80
|
+
str = +"#<#{self.class.name}:0x#{object_id}"
|
81
81
|
str << " id=\"#{@id}\"" if @id
|
82
82
|
str << '>'
|
83
83
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# Copyright (C)
|
2
|
+
# Copyright (C) 2019 Twitter, Inc.
|
3
3
|
|
4
4
|
module TwitterAds
|
5
5
|
class AudienceIntelligence
|
@@ -26,10 +26,10 @@ module TwitterAds
|
|
26
26
|
|
27
27
|
RESOURCE_CONVERSATIONS = "/#{TwitterAds::API_VERSION}/" \
|
28
28
|
'accounts/%{account_id}/audience_intelligence/' \
|
29
|
-
'conversations'
|
29
|
+
'conversations' # @api private
|
30
30
|
RESOURCE_DEMOGRAPHICS = "/#{TwitterAds::API_VERSION}/" \
|
31
31
|
'accounts/%{account_id}/audience_intelligence/' \
|
32
|
-
'demographics'
|
32
|
+
'demographics' # @api private
|
33
33
|
|
34
34
|
def initialize(account)
|
35
35
|
@account = account
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# Copyright (C)
|
2
|
+
# Copyright (C) 2019 Twitter, Inc.
|
3
3
|
|
4
4
|
module TwitterAds
|
5
5
|
class TailoredAudience
|
@@ -25,20 +25,13 @@ module TwitterAds
|
|
25
25
|
property :targetable, type: :bool, read_only: true
|
26
26
|
property :targetable_types, read_only: true
|
27
27
|
|
28
|
-
RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/"
|
29
|
-
'accounts/%{account_id}/tailored_audiences'
|
30
|
-
RESOURCE = "/#{TwitterAds::API_VERSION}/"
|
31
|
-
'accounts/%{account_id}/tailored_audiences/%{id}'
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
'tailored_audience_memberships'.freeze # @api private
|
36
|
-
RESOURCE_USERS = "/#{TwitterAds::API_VERSION}/" +
|
37
|
-
'accounts/%{account_id}/tailored_audiences/' +
|
38
|
-
'%{id}/users'.freeze # @api private
|
39
|
-
# @api private
|
40
|
-
GLOBAL_OPT_OUT = "/#{TwitterAds::API_VERSION}/" +
|
41
|
-
'accounts/%{account_id}/tailored_audiences/global_opt_out'.freeze
|
28
|
+
RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/" \
|
29
|
+
'accounts/%{account_id}/tailored_audiences' # @api private
|
30
|
+
RESOURCE = "/#{TwitterAds::API_VERSION}/" \
|
31
|
+
'accounts/%{account_id}/tailored_audiences/%{id}' # @api private
|
32
|
+
RESOURCE_USERS = "/#{TwitterAds::API_VERSION}/ \
|
33
|
+
accounts/%{account_id}/tailored_audiences/ \
|
34
|
+
%{id}/users" # @api private
|
42
35
|
|
43
36
|
LIST_TYPES = %w(
|
44
37
|
EMAIL
|
@@ -64,35 +57,7 @@ module TwitterAds
|
|
64
57
|
# Creates a new tailored audience.
|
65
58
|
#
|
66
59
|
# @example
|
67
|
-
# audience = TailoredAudience.create(account, '
|
68
|
-
#
|
69
|
-
# @param account [Account] The account object instance.
|
70
|
-
# @param file_path [String] The path to the file to be uploaded.
|
71
|
-
# @param name [String] The tailored audience name.
|
72
|
-
# @param list_type [String] The tailored audience list type.
|
73
|
-
#
|
74
|
-
# @since 0.3.0
|
75
|
-
#
|
76
|
-
# @return [TailoredAudience] The newly created tailored audience instance.
|
77
|
-
def create(account, file_path, name, list_type)
|
78
|
-
upload = TwitterAds::TONUpload.new(account.client, file_path)
|
79
|
-
|
80
|
-
audience = new(account)
|
81
|
-
audience.send(:create_audience, name, list_type)
|
82
|
-
|
83
|
-
begin
|
84
|
-
audience.send(:update_audience, audience, upload.perform, list_type, 'ADD')
|
85
|
-
audience.reload!
|
86
|
-
rescue TwitterAds::ClientError => e
|
87
|
-
audience.delete!
|
88
|
-
raise e
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
# Creates a new tailored audience.
|
93
|
-
#
|
94
|
-
# @example
|
95
|
-
# audience = TailoredAudience.create_instance(account, 'my list')
|
60
|
+
# audience = TailoredAudience.create(account, 'my list')
|
96
61
|
#
|
97
62
|
# @param account [Account] The account object instance.
|
98
63
|
# @param name [String] The tailored audience name.
|
@@ -100,7 +65,7 @@ module TwitterAds
|
|
100
65
|
# @since 4.0
|
101
66
|
#
|
102
67
|
# @return [TailoredAudience] The newly created tailored audience instance.
|
103
|
-
def
|
68
|
+
def create(account, name)
|
104
69
|
audience = new(account)
|
105
70
|
params = { name: name }
|
106
71
|
resource = RESOURCE_COLLECTION % { account_id: account.id }
|
@@ -108,45 +73,6 @@ module TwitterAds
|
|
108
73
|
audience.from_response(response.body[:data])
|
109
74
|
end
|
110
75
|
|
111
|
-
# Updates the global opt-out list for the specified advertiser account.
|
112
|
-
#
|
113
|
-
# @example
|
114
|
-
# TailoredAudience.opt_out(account, '/path/to/file', 'EMAIL')
|
115
|
-
#
|
116
|
-
# @param account [Account] The account object instance.
|
117
|
-
# @param file_path [String] The path to the file to be uploaded.
|
118
|
-
# @param list_type [String] The tailored audience list type.
|
119
|
-
#
|
120
|
-
# @since 0.3.0
|
121
|
-
#
|
122
|
-
# @return [Boolean] The result of the opt-out update.
|
123
|
-
def opt_out(account, file_path, list_type)
|
124
|
-
upload = TwitterAds::TONUpload.new(account.client, file_path)
|
125
|
-
params = { input_file_path: upload.perform, list_type: list_type }
|
126
|
-
resource = GLOBAL_OPT_OUT % { account_id: account.id }
|
127
|
-
Request.new(account.client, :put, resource, params: params).perform
|
128
|
-
true
|
129
|
-
end
|
130
|
-
|
131
|
-
end
|
132
|
-
|
133
|
-
# Updates the current tailored audience instance.
|
134
|
-
#
|
135
|
-
# @example
|
136
|
-
# audience = account.tailored_audiences('xyz')
|
137
|
-
# audience.update('/path/to/file', 'EMAIL', 'REPLACE')
|
138
|
-
#
|
139
|
-
# @param file_path [String] The path to the file to be uploaded.
|
140
|
-
# @param list_type [String] The tailored audience list type.
|
141
|
-
# @param operation [String] The update operation type (Default: 'ADD').
|
142
|
-
#
|
143
|
-
# @since 0.3.0
|
144
|
-
#
|
145
|
-
# @return [TailoredAudience] [description]
|
146
|
-
def update(file_path, list_type, operation = 'ADD')
|
147
|
-
upload = TwitterAds::TONUpload.new(account.client, file_path)
|
148
|
-
update_audience(self, upload.perform, list_type, operation)
|
149
|
-
reload!
|
150
76
|
end
|
151
77
|
|
152
78
|
# Deletes the current tailored audience instance.
|
@@ -165,57 +91,6 @@ module TwitterAds
|
|
165
91
|
from_response(response.body[:data])
|
166
92
|
end
|
167
93
|
|
168
|
-
# Returns the status of all changes for the current tailored audience instance.
|
169
|
-
#
|
170
|
-
# @example
|
171
|
-
# audience.status
|
172
|
-
#
|
173
|
-
# @since 0.3.0
|
174
|
-
#
|
175
|
-
# @return [Hash] Returns a hash object representing the tailored audience status.
|
176
|
-
def status
|
177
|
-
return nil unless id
|
178
|
-
resource = RESOURCE_UPDATE % { account_id: account.id }
|
179
|
-
request = Request.new(account.client, :get, resource, params: to_params)
|
180
|
-
Cursor.new(nil, request).to_a.select { |change| change[:tailored_audience_id] == id }
|
181
|
-
end
|
182
|
-
|
183
|
-
# This is a private API and requires whitelisting from Twitter.
|
184
|
-
#
|
185
|
-
# This real-time API will enable partners to upload batched tailored audience information
|
186
|
-
# to Twitter for processing in real-time
|
187
|
-
#
|
188
|
-
# @example
|
189
|
-
# TailoredAudience.memberships(
|
190
|
-
# account,
|
191
|
-
# [
|
192
|
-
# {
|
193
|
-
# "operation_type" => "Update",
|
194
|
-
# "params" => {
|
195
|
-
# "user_identifier" => "IUGKJHG-UGJHVHJ",
|
196
|
-
# "user_identifier_type" => "TAWEB_PARTNER_USER_ID",
|
197
|
-
# "audience_names" => "Recent Site Visitors, Recent Sign-ups",
|
198
|
-
# "advertiser_account_id" => "43853bhii879"
|
199
|
-
# }
|
200
|
-
# },
|
201
|
-
# ]
|
202
|
-
# )
|
203
|
-
#
|
204
|
-
# @return success_count, total_count
|
205
|
-
def self.memberships(account, params)
|
206
|
-
resource = RESOURCE_MEMBERSHIPS
|
207
|
-
headers = { 'Content-Type' => 'application/json' }
|
208
|
-
response = TwitterAds::Request.new(account.client,
|
209
|
-
:post,
|
210
|
-
resource,
|
211
|
-
headers: headers,
|
212
|
-
body: params.to_json).perform
|
213
|
-
success_count = response.body[:data][0][:success_count]
|
214
|
-
total_count = response.body[:request][0][:total_count]
|
215
|
-
|
216
|
-
[success_count, total_count]
|
217
|
-
end
|
218
|
-
|
219
94
|
# This is a private API and requires whitelisting from Twitter.
|
220
95
|
#
|
221
96
|
# This endpoint will allow partners to add, update and remove users from a given
|
@@ -243,6 +118,8 @@ module TwitterAds
|
|
243
118
|
# ]
|
244
119
|
# )
|
245
120
|
#
|
121
|
+
# @param params [JSON object] A hash containing the list of users to be added/removed/updated
|
122
|
+
#
|
246
123
|
# @since 4.0
|
247
124
|
#
|
248
125
|
# @return success_count, total_count
|
@@ -260,26 +137,5 @@ module TwitterAds
|
|
260
137
|
[success_count, total_count]
|
261
138
|
end
|
262
139
|
|
263
|
-
private
|
264
|
-
|
265
|
-
def create_audience(name, list_type)
|
266
|
-
params = { name: name, list_type: list_type }
|
267
|
-
resource = RESOURCE_COLLECTION % { account_id: account.id }
|
268
|
-
response = Request.new(account.client, :post, resource, params: params).perform
|
269
|
-
from_response(response.body[:data])
|
270
|
-
end
|
271
|
-
|
272
|
-
def update_audience(audience, location, list_type, operation)
|
273
|
-
params = {
|
274
|
-
tailored_audience_id: audience.id,
|
275
|
-
input_file_path: location,
|
276
|
-
list_type: list_type,
|
277
|
-
operation: operation
|
278
|
-
}
|
279
|
-
|
280
|
-
resource = RESOURCE_UPDATE % { account_id: audience.account.id }
|
281
|
-
Request.new(audience.account.client, :post, resource, params: params).perform
|
282
|
-
end
|
283
|
-
|
284
140
|
end
|
285
141
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# Copyright (C)
|
2
|
+
# Copyright (C) 2019 Twitter, Inc.
|
3
3
|
|
4
4
|
module TwitterAds
|
5
5
|
class AppList
|
@@ -13,10 +13,10 @@ module TwitterAds
|
|
13
13
|
property :apps, read_only: true
|
14
14
|
property :name, read_only: true
|
15
15
|
|
16
|
-
RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/"
|
17
|
-
'accounts/%{account_id}/app_lists'
|
18
|
-
RESOURCE = "/#{TwitterAds::API_VERSION}/"
|
19
|
-
'accounts/%{account_id}/app_lists/%{id}'
|
16
|
+
RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/" \
|
17
|
+
'accounts/%{account_id}/app_lists' # @api private
|
18
|
+
RESOURCE = "/#{TwitterAds::API_VERSION}/" \
|
19
|
+
'accounts/%{account_id}/app_lists/%{id}' # @api private
|
20
20
|
|
21
21
|
def initialize(account)
|
22
22
|
@account = account
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# Copyright (C)
|
2
|
+
# Copyright (C) 2019 Twitter, Inc.
|
3
3
|
|
4
4
|
module TwitterAds
|
5
5
|
class Campaign
|
@@ -32,16 +32,12 @@ module TwitterAds
|
|
32
32
|
# sdk only
|
33
33
|
property :to_delete, type: :bool
|
34
34
|
|
35
|
-
RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/"
|
36
|
-
'accounts/%{account_id}/campaigns'
|
37
|
-
|
38
|
-
'
|
39
|
-
|
40
|
-
'
|
41
|
-
RESOURCE_BATCH = "/#{TwitterAds::API_VERSION}/" +
|
42
|
-
'batch/accounts/%{account_id}/campaigns'.freeze # @api private
|
43
|
-
RESOURCE = "/#{TwitterAds::API_VERSION}/" +
|
44
|
-
'accounts/%{account_id}/campaigns/%{id}'.freeze # @api private
|
35
|
+
RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/" \
|
36
|
+
'accounts/%{account_id}/campaigns' # @api private
|
37
|
+
RESOURCE_BATCH = "/#{TwitterAds::API_VERSION}/" \
|
38
|
+
'batch/accounts/%{account_id}/campaigns' # @api private
|
39
|
+
RESOURCE = "/#{TwitterAds::API_VERSION}/" \
|
40
|
+
'accounts/%{account_id}/campaigns/%{id}' # @api private
|
45
41
|
|
46
42
|
def initialize(account)
|
47
43
|
@account = account
|