twitter-ads 10.0.0 → 11.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/README.md +2 -2
- data/lib/twitter-ads/campaign/campaign.rb +2 -2
- data/lib/twitter-ads/campaign/line_item.rb +1 -2
- data/lib/twitter-ads/client.rb +1 -1
- data/lib/twitter-ads/creative/cards.rb +31 -22
- data/lib/twitter-ads/creative/draft_tweet.rb +0 -1
- data/lib/twitter-ads/cursor.rb +2 -2
- data/lib/twitter-ads/enum.rb +4 -0
- data/lib/twitter-ads/resources/analytics.rb +1 -2
- data/lib/twitter-ads/version.rb +1 -1
- data/lib/twitter-ads.rb +0 -4
- data/spec/fixtures/cards_all.json +836 -0
- data/spec/fixtures/cards_load.json +42 -0
- data/spec/twitter-ads/campaign/line_item_spec.rb +1 -0
- data/spec/twitter-ads/creative/cards_spec.rb +52 -0
- metadata +41 -39
- data/lib/twitter-ads/creative/image_app_download_card.rb +0 -47
- data/lib/twitter-ads/creative/video_app_download_card.rb +0 -48
- data/lib/twitter-ads/creative/video_website_card.rb +0 -50
- data/lib/twitter-ads/creative/website_card.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67928f3af10643b8b98513d2411b0f560103f8a6491d816fa25e99ffdd8362d9
|
4
|
+
data.tar.gz: '044490baf9cfab6e87b46a6d03a4b6b15bf44b3b5aa2e307bd9cd9137fdb72a9'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 395df768253f0f424c7d13c12004711aaae69c3b55f2c8a4f992b778b4fb7656dc41b2a79df9e00c3c31ec38851cc9a7059129c4b88b4717b86a8ba08bc7f5cd
|
7
|
+
data.tar.gz: 27d317c21e27631d3b09187c20c52934055f585a45e2e91af073abdfdf0c62c77d7ac9fe9b598a9583aad581dea944dd66eb265fddf7902c11dd701c539cc080
|
data/README.md
CHANGED
@@ -52,7 +52,7 @@ This project is designed to work with Ruby 2.4.0 or greater. While it may work o
|
|
52
52
|
|
53
53
|
Platform | Versions
|
54
54
|
-------- | --------
|
55
|
-
MRI | 2.4.x, 2.5.x, 2.6.x
|
55
|
+
MRI | 2.4.x, 2.5.x, 2.6.x, 2.7, 3.0
|
56
56
|
Rubinius | 2.4.x, 2.5.x
|
57
57
|
|
58
58
|
All releases adhere to strict [semantic versioning](http://semver.org). For Example, major.minor.patch-pre (aka. stick.carrot.oops-peek).
|
@@ -89,7 +89,7 @@ Like the [Response](https://github.com/twitterdev/twitter-ruby-ads-sdk/blob/mast
|
|
89
89
|
|
90
90
|
The MIT License (MIT)
|
91
91
|
|
92
|
-
Copyright (C)
|
92
|
+
Copyright (C) 2021 Twitter, Inc.
|
93
93
|
|
94
94
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
95
95
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -20,13 +20,13 @@ module TwitterAds
|
|
20
20
|
|
21
21
|
property :name
|
22
22
|
property :funding_instrument_id
|
23
|
-
property :end_time, type: :time
|
24
|
-
property :start_time, type: :time
|
25
23
|
property :entity_status
|
24
|
+
property :effective_status
|
26
25
|
property :currency
|
27
26
|
property :standard_delivery
|
28
27
|
property :daily_budget_amount_local_micro
|
29
28
|
property :total_budget_amount_local_micro
|
29
|
+
property :budget_optimization
|
30
30
|
|
31
31
|
# sdk only
|
32
32
|
property :to_delete, type: :bool
|
@@ -34,9 +34,8 @@ module TwitterAds
|
|
34
34
|
property :primary_web_event_tag
|
35
35
|
property :product_type
|
36
36
|
property :start_time, type: :time
|
37
|
+
property :standard_delivery, type: :bool
|
37
38
|
property :total_budget_amount_local_micro
|
38
|
-
|
39
|
-
# beta (not yet generally available)
|
40
39
|
property :advertiser_user_id
|
41
40
|
|
42
41
|
# sdk only
|
data/lib/twitter-ads/client.rb
CHANGED
@@ -12,36 +12,46 @@ module TwitterAds
|
|
12
12
|
|
13
13
|
attr_reader :account
|
14
14
|
|
15
|
+
property :id, read_only: true
|
16
|
+
property :card_type, read_only: true
|
15
17
|
property :card_uri, read_only: true
|
16
18
|
property :created_at, type: :time, read_only: true
|
17
19
|
property :deleted, type: :bool, read_only: true
|
18
20
|
property :updated_at, type: :time, read_only: true
|
19
21
|
# these are writable, but not in the sense that they can be set on an object and then saved
|
20
|
-
property :name
|
21
|
-
property :components
|
22
|
+
property :name
|
23
|
+
property :components
|
22
24
|
|
23
25
|
RESOURCE = "/#{TwitterAds::API_VERSION}/" +
|
24
|
-
'accounts/%{account_id}/cards' # @api private
|
26
|
+
'accounts/%{account_id}/cards/%{id}' # @api private
|
27
|
+
RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/" +
|
28
|
+
'accounts/%{account_id}/cards' # @api private
|
25
29
|
|
26
|
-
def
|
27
|
-
raise ArgumentError.new(
|
28
|
-
"'Cards' object has no attribute 'load'")
|
29
|
-
end
|
30
|
-
|
31
|
-
def reload(*)
|
32
|
-
raise ArgumentError.new(
|
33
|
-
"'Cards' object has no attribute 'reload'")
|
34
|
-
end
|
35
|
-
|
36
|
-
def create(account, name, components)
|
37
|
-
resource = RESOURCE % { account_id: account.id }
|
38
|
-
params = { 'name': name, 'components': components }
|
30
|
+
def save
|
39
31
|
headers = { 'Content-Type' => 'application/json' }
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
32
|
+
params = { 'name': name, 'components': components }
|
33
|
+
if @id
|
34
|
+
resource = RESOURCE % {
|
35
|
+
account_id: account.id,
|
36
|
+
id: id
|
37
|
+
}
|
38
|
+
request = Request.new(account.client,
|
39
|
+
:put,
|
40
|
+
resource,
|
41
|
+
headers: headers,
|
42
|
+
body: params.to_json)
|
43
|
+
else
|
44
|
+
resource = RESOURCE_COLLECTION % {
|
45
|
+
account_id: account.id
|
46
|
+
}
|
47
|
+
request = Request.new(account.client,
|
48
|
+
:post,
|
49
|
+
resource,
|
50
|
+
headers: headers,
|
51
|
+
body: params.to_json)
|
52
|
+
end
|
53
|
+
|
54
|
+
response = request.perform
|
45
55
|
from_response(response.body[:data])
|
46
56
|
end
|
47
57
|
|
@@ -49,7 +59,6 @@ module TwitterAds
|
|
49
59
|
@account = account
|
50
60
|
self
|
51
61
|
end
|
52
|
-
|
53
62
|
end
|
54
63
|
|
55
64
|
end
|
data/lib/twitter-ads/cursor.rb
CHANGED
@@ -56,13 +56,13 @@ module TwitterAds
|
|
56
56
|
# @return [Cursor] The current Cursor instance.
|
57
57
|
#
|
58
58
|
# @since 0.1.0
|
59
|
-
def each(offset = 0)
|
59
|
+
def each(offset = 0, &block)
|
60
60
|
return to_enum(:each, offset) unless block_given?
|
61
61
|
@collection[offset..-1].each { |element| yield(element) }
|
62
62
|
unless exhausted?
|
63
63
|
offset = [@collection.size, offset].max
|
64
64
|
fetch_next
|
65
|
-
each(offset, &
|
65
|
+
each(offset, &block)
|
66
66
|
end
|
67
67
|
self
|
68
68
|
end
|
data/lib/twitter-ads/enum.rb
CHANGED
@@ -14,7 +14,6 @@ module TwitterAds
|
|
14
14
|
attr_reader :account
|
15
15
|
|
16
16
|
property :id, read_only: true
|
17
|
-
property :id_str, read_only: true
|
18
17
|
property :status, read_only: true
|
19
18
|
property :url, read_only: true
|
20
19
|
property :created_at, type: :time, read_only: true
|
@@ -211,7 +210,7 @@ module TwitterAds
|
|
211
210
|
tries = 0
|
212
211
|
begin
|
213
212
|
tries += 1
|
214
|
-
raw_file = open(data_url)
|
213
|
+
raw_file = URI.open(data_url)
|
215
214
|
unzipped_file = Zlib::GzipReader.new(raw_file)
|
216
215
|
response_data = unzipped_file.read
|
217
216
|
response = JSON.parse(response_data)
|
data/lib/twitter-ads/version.rb
CHANGED
data/lib/twitter-ads.rb
CHANGED
@@ -60,7 +60,6 @@ require 'twitter-ads/targeting_criteria/app_store_category'
|
|
60
60
|
require 'twitter-ads/creative/account_media'
|
61
61
|
require 'twitter-ads/creative/cards_fetch'
|
62
62
|
require 'twitter-ads/creative/cards'
|
63
|
-
require 'twitter-ads/creative/image_app_download_card'
|
64
63
|
require 'twitter-ads/creative/image_conversation_card'
|
65
64
|
require 'twitter-ads/creative/media_creative'
|
66
65
|
require 'twitter-ads/creative/media_library'
|
@@ -68,10 +67,7 @@ require 'twitter-ads/creative/promoted_account'
|
|
68
67
|
require 'twitter-ads/creative/promoted_tweet'
|
69
68
|
require 'twitter-ads/creative/scheduled_tweet'
|
70
69
|
require 'twitter-ads/creative/draft_tweet'
|
71
|
-
require 'twitter-ads/creative/video_app_download_card'
|
72
70
|
require 'twitter-ads/creative/video_conversation_card'
|
73
|
-
require 'twitter-ads/creative/video_website_card'
|
74
|
-
require 'twitter-ads/creative/website_card'
|
75
71
|
require 'twitter-ads/creative/poll_cards'
|
76
72
|
require 'twitter-ads/creative/tweet_previews'
|
77
73
|
require 'twitter-ads/creative/tweets'
|