twitter-ads 10.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41647d8c40a25ad6514610875548e84017bc742bad6dff6c3838a708dce86f1a
4
- data.tar.gz: 798fd38acef31c22a0032fa9e2ff9188c5061ec3cc04834c8503b33c8a4e2ab2
3
+ metadata.gz: 67928f3af10643b8b98513d2411b0f560103f8a6491d816fa25e99ffdd8362d9
4
+ data.tar.gz: '044490baf9cfab6e87b46a6d03a4b6b15bf44b3b5aa2e307bd9cd9137fdb72a9'
5
5
  SHA512:
6
- metadata.gz: 1d4fffa9b3eaa288a6ef9d173fb7f6fcbb1cfd2e5286c0167be9b01f4e751179fb83d4efff294f193837c44f84a2b52a696cfa826b3e7a7ff2635696242e931b
7
- data.tar.gz: 46f6c010335bbf314877e71decef4692fada6a9317436a38fa8bf31ad334a2742ddec724e61074ebefa23420490b2243d522360b7dce76907cd03f3d289a5a8a
6
+ metadata.gz: 395df768253f0f424c7d13c12004711aaae69c3b55f2c8a4f992b778b4fb7656dc41b2a79df9e00c3c31ec38851cc9a7059129c4b88b4717b86a8ba08bc7f5cd
7
+ data.tar.gz: 27d317c21e27631d3b09187c20c52934055f585a45e2e91af073abdfdf0c62c77d7ac9fe9b598a9583aad581dea944dd66eb265fddf7902c11dd701c539cc080
@@ -20,14 +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
26
24
  property :effective_status
27
25
  property :currency
28
26
  property :standard_delivery
29
27
  property :daily_budget_amount_local_micro
30
28
  property :total_budget_amount_local_micro
29
+ property :budget_optimization
31
30
 
32
31
  # sdk only
33
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
@@ -3,7 +3,7 @@
3
3
 
4
4
  module TwitterAds
5
5
 
6
- API_VERSION = '10'
6
+ API_VERSION = '11'
7
7
 
8
8
  # The Ads API Client class which functions as a
9
9
  # container for basic API consumer information.
@@ -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, read_only: true
21
- property :components, read_only: true
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 load(*)
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
- response = Request.new(account.client,
41
- :post,
42
- resource,
43
- headers: headers,
44
- body: params.to_json).perform
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
@@ -14,7 +14,6 @@ module TwitterAds
14
14
 
15
15
  # read-only
16
16
  property :id, read_only: true
17
- property :id_str, read_only: true
18
17
  property :created_at, type: :time, read_only: true
19
18
  property :updated_at, type: :time, read_only: true
20
19
  property :user_id, read_only: true
@@ -234,5 +234,9 @@ module TwitterAds
234
234
  NULLCAST = 'NULLCAST'
235
235
  ORGANIC = 'ORGANIC'
236
236
  end
237
+
238
+ module BudgetOptimization
239
+ CAMPAIGN = 'CAMPAIGN'
240
+ end
237
241
  end
238
242
  end
@@ -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
@@ -2,5 +2,5 @@
2
2
  # Copyright (C) 2019 Twitter, Inc.
3
3
 
4
4
  module TwitterAds
5
- VERSION = '10.1.0'
5
+ VERSION = '11.0.0'
6
6
  end
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'