forked from nov/fb_graph
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request nov#196 from blinqmedia/support_redownload
Support redownload
- Loading branch information
Showing
13 changed files
with
339 additions
and
7 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
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,36 @@ | ||
require 'spec_helper' | ||
describe FbGraph::Connections::AdCampaigns, '#ad_campaign!' do | ||
context 'when included by FbGraph::AdAccount' do | ||
it 'should return generated ad_account' do | ||
mock_graph :post, 'act_22334455/adcampaigns', 'ad_accounts/ad_campaigns/post_with_valid_access_token' do | ||
ad_campaign = FbGraph::AdAccount.new('act_22334455', :access_token => 'valid').ad_campaign!( | ||
:name => "Campaign 1", | ||
:daily_budget => 500 | ||
) | ||
|
||
ad_campaign.identifier.should == "6004167532222" | ||
end | ||
end | ||
|
||
it 'should handle the redownload parameter' do | ||
mock_graph :post, 'act_22334455/adcampaigns', 'ad_accounts/ad_campaigns/post_with_redownload' do | ||
ad_campaign = FbGraph::AdAccount.new('act_22334455', :access_token => 'valid').ad_campaign!( | ||
:name => "Campaign 1", | ||
:daily_budget => 500, | ||
:redownload => true | ||
) | ||
|
||
ad_campaign.identifier.should == "6004167532222" | ||
ad_campaign.account_id.should == 22334455 | ||
ad_campaign.name.should == "Campaign 1" | ||
ad_campaign.daily_budget.should == 500 | ||
ad_campaign.campaign_status.should == 2 | ||
ad_campaign.daily_imps.should == 0 | ||
ad_campaign.start_time.should == Time.at(1330282800) | ||
ad_campaign.end_time.should == Time.at(1330588800) | ||
ad_campaign.updated_time.should == Time.at(1329850926) | ||
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
19 changes: 19 additions & 0 deletions
19
spec/mock_json/ad_accounts/ad_campaigns/post_with_redownload.json
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,19 @@ | ||
{ | ||
"id": "6004167532222", | ||
"data": { | ||
"campaigns": { | ||
"6004167532222": { | ||
"account_id": 22334455, | ||
"campaign_id": 6004167532222, | ||
"name": "Campaign 1", | ||
"daily_budget": 500, | ||
"campaign_status": 2, | ||
"daily_imps": 0, | ||
"id": "6004167532222", | ||
"start_time": 1330282800, | ||
"end_time": 1330588800, | ||
"updated_time": 1329850926 | ||
} | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
spec/mock_json/ad_accounts/ad_campaigns/post_with_valid_access_token.json
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,3 @@ | ||
{ | ||
"id": "6004167532222" | ||
} |
51 changes: 51 additions & 0 deletions
51
spec/mock_json/ad_accounts/ad_groups/post_with_redownload.json
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,51 @@ | ||
{ | ||
"data": { | ||
"adgroups": { | ||
"22334455": { | ||
"name": "Test Ad 2", | ||
"adgroup_id": 22334455, | ||
"ad_id": 22334455, | ||
"creative_ids": [ | ||
22334455 | ||
], | ||
"end_time": 1329955200, | ||
"campaign_id": 11223344, | ||
"account_id": 99887766, | ||
"ad_status": 4, | ||
"id": "22334455", | ||
"max_bid": "100", | ||
"bid_info": { | ||
"1": "100" | ||
}, | ||
"bid_type": 1, | ||
"updated_time": 1329766354, | ||
"adgroup_status": 4, | ||
"targeting": { | ||
"countries": [ | ||
"US" | ||
] | ||
}, | ||
"start_time": 1329696000 | ||
} | ||
}, | ||
"creatives": { | ||
"22334455": { | ||
"alt_view_tags": [], | ||
"name": "asdfasdf", | ||
"creative_id": "22334455", | ||
"title": "asdfasdf", | ||
"body": "fsadfasf", | ||
"image_url": "https://fbcdn-photos-a.akamaihd.net/photos-ak-snc1/v41818/flyers/20/8/13297657711344684017_1_bd2a5cd2.jpg", | ||
"view_tag": "", | ||
"count_current_adgroups": 2, | ||
"id": "22334455", | ||
"type": 1, | ||
"preview_url": "http://www.facebook.com/ads/api/creative_preview.php?cid=22334455", | ||
"run_status": 1, | ||
"image_hash": "6dda3e0bd951ff99cd474acf58a91cf4", | ||
"link_url": "http://example.org" | ||
} | ||
} | ||
}, | ||
"id": "22334455" | ||
} |
19 changes: 19 additions & 0 deletions
19
spec/mock_json/ad_campaigns/test_ad_campaign_update_with_redownload.json
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,19 @@ | ||
{ | ||
"result": true, | ||
"data": { | ||
"campaigns": { | ||
"6004167532222": { | ||
"account_id": 32128888, | ||
"campaign_id": 6004167532222, | ||
"name": "New Name", | ||
"daily_budget": 500, | ||
"campaign_status": 2, | ||
"daily_imps": 0, | ||
"id": "6004167532222", | ||
"start_time": 1330282800, | ||
"end_time": 1330588800, | ||
"updated_time": 1329853694 | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.