twitter-ads 4.0.1 → 5.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
  SHA1:
3
- metadata.gz: 960147733ff2dcaddd726fd01064152695055f88
4
- data.tar.gz: 33c89c5efa732eaa1e98b7a3fde336b6672c0255
3
+ metadata.gz: 4483287f7e16d023a370c9352880877081d823a0
4
+ data.tar.gz: 3a37f0d133d886db3e41766b52f3364123e210d4
5
5
  SHA512:
6
- metadata.gz: 2b33c9868bee1b43a954079be44eb43c9e581e815ea8d56612a94b1001498675dae0919518d612b6e39ef6571f411ebc87f55069d11e300298eab8b33ee132e4
7
- data.tar.gz: 41221b6220ee792e99c56704480ccd4e3b2d16571d19c9fe0d378492ea2134798f934a724c40e10035dda50266e29967da3ea9f411e6661e0e4ec121750436ce
6
+ metadata.gz: 898ecdf5405dbb342ddf5b40d77904d854cdf9f0e284144142bcdcb594dbd4c01d7a0ed324c9f71bfcc3d6a6b55b73121076a2815314037d3f0a9c0464da57d0
7
+ data.tar.gz: 4a22e9b421c345b52e476a6d528454a3b790b46b462fa0017a389efbe36e45ec81cc30004cb8336af34158216d6d5f1a76b73fc76e10455ffef3773aad9c72fd
@@ -33,9 +33,9 @@ module TwitterAds
33
33
  'accounts/%{account_id}/tailored_audience_changes'.freeze # @api private
34
34
  RESOURCE_MEMBERSHIPS = "/#{TwitterAds::API_VERSION}/" +
35
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
36
+ RESOURCE_USERS = "/#{TwitterAds::API_VERSION}/" +
37
+ 'accounts/%{account_id}/tailored_audiences/' +
38
+ '%{id}/users'.freeze # @api private
39
39
  # @api private
40
40
  GLOBAL_OPT_OUT = "/#{TwitterAds::API_VERSION}/" +
41
41
  'accounts/%{account_id}/tailored_audiences/global_opt_out'.freeze
@@ -45,7 +45,7 @@ module TwitterAds
45
45
  # Returns a Cursor instance for a given resource.
46
46
  #
47
47
  # @param account [Account] The Account object instance.
48
- # @param line_item_id [String] The line item ID string.
48
+ # @param line_item_ids [String] A String or String array of Line Item IDs.
49
49
  # @param opts [Hash] An optional Hash of extended options.
50
50
  # @option opts [Boolean] :with_deleted Indicates if deleted items should be included.
51
51
  # @option opts [String] :sort_by The object param to sort the API response by.
@@ -55,8 +55,8 @@ module TwitterAds
55
55
  # @since 0.3.1
56
56
  # @see Cursor
57
57
  # @see https://dev.twitter.com/ads/basics/sorting Sorting
58
- def all(account, line_item_id, opts = {})
59
- params = { line_item_id: line_item_id }.merge!(opts)
58
+ def all(account, line_item_ids, opts = {})
59
+ params = { line_item_ids: Array(line_item_ids).join(',') }.merge!(opts)
60
60
  resource = RESOURCE_COLLECTION % { account_id: account.id }
61
61
  request = Request.new(account.client, :get, resource, params: params)
62
62
  Cursor.new(self, request, init_with: [account])
@@ -3,7 +3,7 @@
3
3
 
4
4
  module TwitterAds
5
5
 
6
- API_VERSION = '4'.freeze
6
+ API_VERSION = '5'.freeze
7
7
 
8
8
  # The Ads API Client class which functions as a
9
9
  # container for basic API consumer information.
@@ -40,7 +40,6 @@ module TwitterAds
40
40
  property :iphone_app_id, read_only: true
41
41
  property :iphone_deep_link, read_only: true
42
42
  property :name, read_only: true
43
- property :preview_url, read_only: true
44
43
  property :recipient_user_id, read_only: true
45
44
  property :second_choice, read_only: true
46
45
  property :second_cta, read_only: true
@@ -73,7 +72,7 @@ module TwitterAds
73
72
  property :id, read_only: true
74
73
 
75
74
  FETCH_URI = "/#{TwitterAds::API_VERSION}/" +
76
- 'accounts/%{account_id}/cards'.freeze # @api private
75
+ 'accounts/%{account_id}/cards/all'.freeze # @api private
77
76
  FETCH_ID = "/#{TwitterAds::API_VERSION}/" +
78
77
  'accounts/%{account_id}/cards/all/%{id}'.freeze # @api private
79
78
 
@@ -82,26 +81,27 @@ module TwitterAds
82
81
  "'CardsFetch' object has no attribute 'all'")
83
82
  end
84
83
 
85
- def load(account, card_uri = nil, card_id = nil, with_deleted = nil, opts = {})
86
- if (card_uri && card_id) || (card_uri.nil? && card_id.nil?)
87
- raise ArgumentError.new('card_uri and card_id are exclusive parameters. ' \
84
+ def load(account, card_uris = nil, card_id = nil, with_deleted = nil, opts = {})
85
+ if (card_uris && card_id) || (card_uris.nil? && card_id.nil?)
86
+ raise ArgumentError.new('card_uris and card_id are exclusive parameters. ' \
88
87
  'Please supply one or the other, but not both.')
89
88
  end
90
89
 
91
- if card_uri
92
- params = { card_uri: card_uri }.merge!(opts)
93
- resource = FETCH_URI % { account_id: account.id }
94
- else
95
- params = { card_id: card_id }.merge!(opts)
96
- resource = FETCH_ID % { account_id: account.id, id: card_id }
97
- end
98
-
99
90
  if with_deleted && TwitterAds::Utils.to_bool(with_deleted)
100
91
  params = { with_deleted: true }.merge!(opts)
101
92
  end
102
93
 
103
- response = Request.new(account.client, :get, resource, params: params).perform
104
- from_response(response.body[:data])
94
+ if card_uris
95
+ params = { card_uris: Array(card_uris).join(',') }.merge!(opts).merge!(params)
96
+ resource = FETCH_URI % { account_id: account.id }
97
+ request = Request.new(account.client, :get, resource, params: params)
98
+ return Cursor.new(self.class, request, init_with: [account])
99
+ else
100
+ params = { card_id: card_id }.merge!(opts).merge!(params)
101
+ resource = FETCH_ID % { account_id: account.id, id: card_id }
102
+ response = Request.new(account.client, :get, resource, params: params).perform
103
+ return from_response(response.body[:data])
104
+ end
105
105
  end
106
106
 
107
107
  def reload!
@@ -19,7 +19,6 @@ module TwitterAds
19
19
  property :id, read_only: true
20
20
  property :image_display_height, read_only: true
21
21
  property :image_display_width, read_only: true
22
- property :preview_url, read_only: true
23
22
  property :updated_at, type: :time, read_only: true
24
23
  property :wide_app_image, read_only: true
25
24
 
@@ -18,7 +18,6 @@ module TwitterAds
18
18
  property :deleted, type: :bool, read_only: true
19
19
  property :id, read_only: true
20
20
  property :image, read_only: true
21
- property :preview_url, read_only: true
22
21
  property :updated_at, type: :time, read_only: true
23
22
 
24
23
  property :cover_image_id
@@ -22,7 +22,6 @@ module TwitterAds
22
22
  property :image, read_only: true
23
23
  property :image_display_height, read_only: true
24
24
  property :image_display_width, read_only: true
25
- property :preview_url, read_only: true
26
25
  property :start_time, type: :time, read_only: true
27
26
  property :updated_at, type: :time, read_only: true
28
27
  property :video_height, read_only: true
@@ -17,7 +17,6 @@ module TwitterAds
17
17
  property :created_at, type: :time, read_only: true
18
18
  property :deleted, type: :bool, read_only: true
19
19
  property :id, read_only: true
20
- property :preview_url, read_only: true
21
20
  property :updated_at, type: :time, read_only: true
22
21
  property :video_content_id, read_only: true
23
22
  property :video_hls_url, read_only: true
@@ -17,7 +17,6 @@ module TwitterAds
17
17
  property :created_at, type: :time, read_only: true
18
18
  property :deleted, type: :bool, read_only: true
19
19
  property :id, read_only: true
20
- property :preview_url, read_only: true
21
20
  property :updated_at, type: :time, read_only: true
22
21
  property :video_url, read_only: true
23
22
  property :video_poster_url, read_only: true
@@ -18,7 +18,6 @@ module TwitterAds
18
18
  property :created_at, type: :time, read_only: true
19
19
  property :deleted, type: :bool, read_only: true
20
20
  property :id, read_only: true
21
- property :preview_url, read_only: true
22
21
  property :updated_at, type: :time, read_only: true
23
22
  property :video_content_id, read_only: true
24
23
  property :video_height, read_only: true
@@ -20,7 +20,6 @@ module TwitterAds
20
20
  property :image, read_only: true
21
21
  property :image_display_height, read_only: true
22
22
  property :image_display_width, read_only: true
23
- property :preview_url, read_only: true
24
23
  property :updated_at, type: :time, read_only: true
25
24
  property :website_dest_url, read_only: true
26
25
  property :website_display_url, read_only: true
@@ -108,6 +108,7 @@ module TwitterAds
108
108
  LINE_ITEM = 'LINE_ITEM'.freeze
109
109
  PROMOTED_TWEET = 'PROMOTED_TWEET'.freeze
110
110
  ORGANIC_TWEET = 'ORGANIC_TWEET'.freeze
111
+ MEDIA_CREATIVE = 'MEDIA_CREATIVE'.freeze
111
112
  end
112
113
 
113
114
  module EntityStatus
@@ -2,5 +2,5 @@
2
2
  # Copyright (C) 2015 Twitter, Inc.
3
3
 
4
4
  module TwitterAds
5
- VERSION = '4.0.1'.freeze
5
+ VERSION = '5.0.0'.freeze
6
6
  end
@@ -23,7 +23,7 @@ describe TwitterAds::Creative::ImageAppDownloadCard do
23
23
 
24
24
  # check model properties
25
25
  subject { described_class.new(account) }
26
- read = %w(id preview_url created_at updated_at deleted)
26
+ read = %w(id created_at updated_at deleted)
27
27
 
28
28
  write = %w(
29
29
  name
@@ -23,7 +23,7 @@ describe TwitterAds::Creative::ImageConversationCard do
23
23
 
24
24
  # check model properties
25
25
  subject { described_class.new(account) }
26
- read = %w(id preview_url image deleted created_at updated_at)
26
+ read = %w(id image deleted created_at updated_at)
27
27
  write = %w(
28
28
  name
29
29
  title
@@ -23,7 +23,7 @@ describe TwitterAds::Creative::VideoAppDownloadCard do
23
23
 
24
24
  # check model properties
25
25
  subject { described_class.new(account) }
26
- read = %w(id preview_url video_url video_poster_url deleted created_at updated_at)
26
+ read = %w(id video_url video_poster_url deleted created_at updated_at)
27
27
  write = %w(
28
28
  name
29
29
  country_code
@@ -26,7 +26,6 @@ describe TwitterAds::Creative::VideoConversationCard do
26
26
 
27
27
  read = %w(
28
28
  id
29
- preview_url
30
29
  video_url
31
30
  video_poster_url
32
31
  deleted
@@ -32,7 +32,6 @@ describe TwitterAds::Creative::WebsiteCard do
32
32
  image
33
33
  image_display_height
34
34
  image_display_width
35
- preview_url
36
35
  website_dest_url
37
36
  website_display_url
38
37
  updated_at
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: 4.0.1
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Black
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-02-26 00:00:00.000000000 Z
13
+ date: 2019-03-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json