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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65246c52bd294821d06f0bb059d9e06645f9085e7dc0864185075311749565ff
4
- data.tar.gz: 630e877969ad75d32f4e95f6a454558aaea1338815f3aae00c813ca6e7e3e1e5
3
+ metadata.gz: 67928f3af10643b8b98513d2411b0f560103f8a6491d816fa25e99ffdd8362d9
4
+ data.tar.gz: '044490baf9cfab6e87b46a6d03a4b6b15bf44b3b5aa2e307bd9cd9137fdb72a9'
5
5
  SHA512:
6
- metadata.gz: f392d87fd861feba16a6555158670f63048489986bfc1e82b4f3c596f94b240803e50892865da4e2a930e134e1ae52d4c3b4b9e9b44a344a63d5d5a82985d661
7
- data.tar.gz: 57ddabd5051fff96bbb3542e3e7616e38476abc1de375ff01fb1c00746247a0f554eff6c2c5af83a0d4635d6d3fe400e0a38a0b7a36742d8e146be21acfe1fec
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) 2019 Twitter, Inc.
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
@@ -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
@@ -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, &Proc.new)
65
+ each(offset, &block)
66
66
  end
67
67
  self
68
68
  end
@@ -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
@@ -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)
@@ -2,5 +2,5 @@
2
2
  # Copyright (C) 2019 Twitter, Inc.
3
3
 
4
4
  module TwitterAds
5
- VERSION = '10.0.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'