-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updates to switch to ios for Cards (#252) * Removing deprecated field salt * Removing deprecated field salt in tests * Add enum for Pay By Impression * renamed/removed line item props * moved props out of beta * updated enums * added support for cards endpoint * removed old tailored audiences endpoint * added new cards endpoint with examples * updated tailored audiences to custom audiences * update audience_summary to audience_estimate * removed automatically_select_bid from line items * Remove deprecated tracking_tags field from line items * Add Tracking Tags support Co-authored-by: Tushar Bhushan <[email protected]>
- Loading branch information
Showing
21 changed files
with
210 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# frozen_string_literal: true | ||
# Copyright (C) 2019 Twitter, Inc. | ||
|
||
module TwitterAds | ||
class TrackingTag | ||
|
||
include TwitterAds::DSL | ||
include TwitterAds::Resource | ||
include TwitterAds::Persistence | ||
|
||
attr_reader :account | ||
|
||
property :id, read_only: true | ||
property :deleted, type: :bool, read_only: true | ||
property :created_at, type: :time, read_only: true | ||
property :updated_at, type: :time, read_only: true | ||
|
||
property :line_item_id | ||
property :tracking_tag_type | ||
property :tracking_tag_url | ||
|
||
# sdk only | ||
property :to_delete, type: :bool | ||
|
||
RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/" \ | ||
'accounts/%{account_id}/tracking_tags' # @api private | ||
RESOURCE = "/#{TwitterAds::API_VERSION}/" \ | ||
'accounts/%{account_id}/tracking_tags/%{id}' # @api private | ||
|
||
def initialize(account) | ||
@account = account | ||
self | ||
end | ||
|
||
# Creates a new Tracking Tag | ||
# | ||
# @param line_item_id [String] The line item id to create tags for. | ||
# @param tracking_tag_url [String] tracking tag URL. | ||
# | ||
# @return [self] Returns the instance refreshed from the API | ||
def create(line_item_id, tracking_tag_url) | ||
resource = self.class::RESOURCE_COLLECTION % { account_id: account.id } | ||
params = to_params.merge!( | ||
line_item_id: line_item_id, | ||
tracking_tag_url: tracking_tag_url, | ||
tracking_tag_type: 'IMPRESSION_TAG' | ||
) | ||
response = Request.new(account.client, :post, resource, params: params).perform | ||
from_response(response.body[:data]) | ||
end | ||
|
||
class << self | ||
|
||
# Returns a Cursor instance for a given resource. | ||
# | ||
# @param account [Account] The Account object instance. | ||
# @param line_item_ids [String] A String or String array of Line Item IDs. | ||
# @param opts [Hash] An optional Hash of extended options. | ||
# @option opts [Boolean] :with_deleted Indicates if deleted items should be included. | ||
# @option opts [String] :sort_by The object param to sort the API response by. | ||
# | ||
# @return [Cursor] A Cusor object ready to iterate through the API response. | ||
# | ||
# @since 0.3.1 | ||
# @see Cursor | ||
# @see https://dev.twitter.com/ads/basics/sorting Sorting | ||
def all(account, line_item_ids, opts = {}) | ||
if !line_item_ids.empty? | ||
params = { line_item_ids: Array(line_item_ids).join(',') }.merge!(opts) | ||
end | ||
resource = RESOURCE_COLLECTION % { account_id: account.id } | ||
request = Request.new(account.client, :get, resource, params: params) | ||
Cursor.new(self, request, init_with: [account]) | ||
end | ||
|
||
# Returns an object instance for a given resource. | ||
# | ||
# @param account [Account] The Account object instance. | ||
# @param id [String] The ID of the specific object to be loaded. | ||
# @param opts [Hash] An optional Hash of extended options. | ||
# @option opts [Boolean] :with_deleted Indicates if deleted items should be included. | ||
# @option opts [String] :sort_by The object param to sort the API response by. | ||
# | ||
# @return [self] The object instance for the specified resource. | ||
# | ||
# @since 0.3.1 | ||
def load(account, id, opts = {}) | ||
params = { with_deleted: true }.merge!(opts) | ||
resource = RESOURCE % { account_id: account.id, id: id } | ||
response = Request.new(account.client, :get, resource, params: params).perform | ||
new(account).from_response(response.body[:data]) | ||
end | ||
|
||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
# Copyright (C) 2019 Twitter, Inc. | ||
|
||
module TwitterAds | ||
VERSION = '9.0.0' | ||
VERSION = '10.0.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.