Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

some updates to make gem methods work with newest Ads API 2.6 #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ o = { bid_type: 1,

# Create it in the context of my_campaign
group = my_campaign.create_ad_group(o)
=> #<Zuck::AdGroup adgroup_id: 6005851390151, ad_id: 6005851390151, campaign_id: 6005851032951, name: "My first ad group", adgroup_status: 4, bid_type: 1, max_bid: "1", bid_info: {"1":"1"}, ad_status: 4, account_id: "10150585630710217", id: "6005851390151", creative_ids: [6005851371551], targeting: {"geo_locations": {"countries":["US"]},"friends_of_connections":[{"id":"6005851366351","name":null}]}, conversion_specs: [{"action.type":"like","post":"10150420410887685"}], start_time: null, end_time: null, updated_time: 1343916568, created_time: 1343916568>
=> #<Zuck::AdGroup ad_id: 6005851390151, ad_id: 6005851390151, adset_id: 6005851032951, name: "My first ad group", adgroup_status: 4, bid_type: 1, max_bid: "1", bid_info: {"1":"1"}, ad_status: 4, account_id: "10150585630710217", id: "6005851390151", creative_ids: [6005851371551], targeting: {"geo_locations": {"countries":["US"]},"friends_of_connections":[{"id":"6005851366351","name":null}]}, conversion_specs: [{"action.type":"like","post":"10150420410887685"}], start_time: null, end_time: null, updated_time: 1343916568, created_time: 1343916568>

# Shoot, that was the wrong name
group.name = "My serious ad group"
Expand Down
34 changes: 34 additions & 0 deletions READMEUPDATE_TO_V26.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Due to v2.6 on Facebook API, most of the calles (like ad_campaigns, ad_groups, etc) became invalid.
This small fix helps to solve only some issues. Here is the list of the changed request phrases so far

v2.4 field--v2.5 field
adcampaign_groups--campaigns
adcampaigngroupsbylabels--campaignsbylabels
adcampaigns--adsets
adcampaignsbylabels--adsetsbylabels

adgroups--ads
adgroupsbylabels--adsbylabels
adgroup_review_feedback--ad_review_feedback
adgroup_status--status
adgroup_id--ad_id
adgroup_name--ad_name
campaign_group_status--status
asyncadgrouprequestsets--asyncadrequestsets

campaign_group_id--campaign_id
campaign_schedule--adset_schedule

campaign_id--adset_id
campaign_group_id--campaign_id


The whole complete list is located here:
https://developers.facebook.com/docs/marketing-api/reference/v2.5_rename/v2.6
Again, in thos commit not all the phrases were changed.

Also, after calling
Zuck.graph = (token, secret)
it is NECESSARY to specify which api version is called by koala as fallowing:
Koala.config.api_version = "v2.6"
Otherwise, the error is raised.
6 changes: 3 additions & 3 deletions lib/zuck/facebook/ad_campaign.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ class AdCampaign < RawFbObject
:account_id,
:objective,
:name,
:adgroups,
:campaign_group_status,
:ads,
:status,
:buying_type

parent_object :ad_account, as: :account_id
list_path :adcampaign_groups
list_path :campaigns
connections :ad_groups, :ad_campaigns

end
Expand Down
10 changes: 5 additions & 5 deletions lib/zuck/facebook/ad_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ class AdGroup < RawFbObject
# [fb docs](https://developers.facebook.com/docs/reference/ads-api/adgroup/v2.2)
known_keys :id,
:account_id,
:adgroup_review_feedback,
:adgroup_status,
:ad_review_feedback,
:status,
:bid_amount,
:campaign_id,
:campaign_group_id,
:adset_id,
:created_time,
:creative,
:failed_delivery_checks,
Expand All @@ -21,12 +21,12 @@ class AdGroup < RawFbObject
:updated_time

parent_object :ad_campaign
list_path :adgroups
list_path :ads
connections :ad_creatives

def self.create(graph, data, ad_set)
path = ad_set.ad_account.path
data['campaign_id'] = ad_set.id
data['adset_id'] = ad_set.id
super(graph, data, ad_set, path)
end

Expand Down
4 changes: 2 additions & 2 deletions lib/zuck/facebook/ad_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AdSet < RawFbObject
:account_id,
:bid_amount,
:bid_info,
:campaign_group_id,
:campaign_id,
:campaign_status,
:start_time,
:end_time,
Expand All @@ -23,7 +23,7 @@ class AdSet < RawFbObject
:promoted_object

parent_object :ad_account, as: :account_id
list_path :adcampaigns # Yes, this is correct, "for legacy reasons"
list_path :adsets # Yes, this is correct, "for legacy reasons"
connections :ad_groups, :ad_creatives

end
Expand Down
4 changes: 2 additions & 2 deletions lib/zuck/fb_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module FbObject
# class AdCampaign < FbObject
#
# known_keys :title, :budget
# list_path :adcampaigns
# list_path :adsets
# connections :ad_groups
# parent_object :ad_account, as: :account_id
#
Expand All @@ -30,7 +30,7 @@ module FbObject
# `my_campaign[:secret_key]` to get to the juicy bits
# 2. You can call `AdCampaign.all(graph, my_ad_account)`, because your
# `AdCampaign` instance knows how to construct the path
# `act_12345/adcampaigns`. It knows this, because it knows its
# `act_12345/adsets`. It knows this, because it knows its
# parent object and its own list path.
# 3. You can call `#ad_groups` on any `AdCampaign` instance to fetch
# the ad groups in that campaign. To add an ad_group to a campaign,
Expand Down
4 changes: 2 additions & 2 deletions spec/fixtures/a_single_campaign.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/fixtures/a_single_group.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions spec/fixtures/create_ad_campaign.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions spec/fixtures/create_ad_group.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions spec/fixtures/create_ad_set.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading