twitter-ads 5.1.0 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/twitter-ads/account.rb +2 -3
- data/lib/twitter-ads/audiences/tailored_audience.rb +98 -3
- data/lib/twitter-ads/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cd47b38d08667bf292088700123342cf46e6576a3cb9a315ae9011517f85db4
|
4
|
+
data.tar.gz: d8d0de8d946a946c483373d0a01cfbd716a0c43e2c48932e3dc77a091d4bdfeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e9298f7816c6a34f72d57ec64a36ca867bd226601486a41de01716283139ac3142788a7b4506567f097e143ebd39ff54bddd34db64bd84599815dd98a4a3a81
|
7
|
+
data.tar.gz: fb148af4796eaad730508ea7a4b3e63d5bcb36f56270e305707df52c36b96dbb485093bf2998684dcaaa8550e3a3ef8cf80294f1dee740ebc4c931b16d27b31d
|
data/lib/twitter-ads/account.rb
CHANGED
@@ -256,9 +256,8 @@ module TwitterAds
|
|
256
256
|
# @return [Array] An Array of Tweet objects.
|
257
257
|
#
|
258
258
|
# @since 0.2.3
|
259
|
-
def scoped_timeline(
|
260
|
-
|
261
|
-
params = { user_ids: ids }.merge!(opts)
|
259
|
+
def scoped_timeline(id, opts = {})
|
260
|
+
params = { user_id: id }.merge!(opts)
|
262
261
|
resource = SCOPED_TIMELINE % { id: @id }
|
263
262
|
request = Request.new(client, :get, resource, params: params)
|
264
263
|
response = request.perform
|
@@ -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
|
data/lib/twitter-ads/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter-ads
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Babich
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2019-06-
|
15
|
+
date: 2019-06-19 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: multi_json
|