sem4r 0.1.1
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.
- data/LICENSE +22 -0
- data/README.rdoc +74 -0
- data/Rakefile +126 -0
- data/VERSION.yml +5 -0
- data/bin/sem +34 -0
- data/config/sem4r.example.yml +51 -0
- data/examples_blog/2009-11-29-hello-world.rb +12 -0
- data/examples_blog/2009-12-12-create-campaign.rb +29 -0
- data/examples_blog/2010-02-06-constants-scope.rb +8 -0
- data/examples_blog/2010-02-07-ad-parameters.rb +47 -0
- data/examples_sem4r/01_get_account.rb +37 -0
- data/examples_sem4r/02_get_info.rb +32 -0
- data/examples_sem4r/03_list_ad.rb +47 -0
- data/examples_sem4r/04_list_keywords.rb +54 -0
- data/examples_sem4r/05_request_report.rb +51 -0
- data/examples_sem4r/05_request_report_2010.rb +40 -0
- data/examples_sem4r/06_create_campaigns.rb +86 -0
- data/examples_sem4r/07_create_campaigns_block.rb +99 -0
- data/examples_sem4r/07_create_campaigns_simple.rb +65 -0
- data/examples_sem4r/08_ad_params.rb +70 -0
- data/examples_sem4r/09_targeting_idea.rb +59 -0
- data/examples_sem4r/10_get_location.rb +28 -0
- data/examples_sem4r/11_submit_bulk_job.rb +82 -0
- data/examples_sem4r/12_list_bulk_job.rb +29 -0
- data/examples_sem4r/30_prune_empty_adgroup.rb +50 -0
- data/examples_sem4r/31_empty_accounts.rb +40 -0
- data/examples_sem4r/example_helper.rb +115 -0
- data/lib/sem4r/account.rb +349 -0
- data/lib/sem4r/ad_extension_override/ad_extension_override_service.rb +30 -0
- data/lib/sem4r/ad_group/ad_group.rb +340 -0
- data/lib/sem4r/ad_group/ad_group_bids.rb +170 -0
- data/lib/sem4r/ad_group/ad_group_service.rb +75 -0
- data/lib/sem4r/ad_group/mobile_ad_image.rb +33 -0
- data/lib/sem4r/ad_group_ad/ad_group_ad.rb +98 -0
- data/lib/sem4r/ad_group_ad/ad_group_ad_operations.rb +38 -0
- data/lib/sem4r/ad_group_ad/ad_group_ad_service.rb +56 -0
- data/lib/sem4r/ad_group_ad/ad_group_mobile_ad.rb +137 -0
- data/lib/sem4r/ad_group_ad/ad_group_text_ad.rb +98 -0
- data/lib/sem4r/ad_group_criterion/ad_group_criterion.rb +144 -0
- data/lib/sem4r/ad_group_criterion/ad_group_criterion_bids.rb +115 -0
- data/lib/sem4r/ad_group_criterion/ad_group_criterion_operations.rb +35 -0
- data/lib/sem4r/ad_group_criterion/ad_group_criterion_service.rb +58 -0
- data/lib/sem4r/ad_group_criterion/criterion.rb +67 -0
- data/lib/sem4r/ad_group_criterion/criterion_keyword.rb +80 -0
- data/lib/sem4r/ad_group_criterion/criterion_placement.rb +66 -0
- data/lib/sem4r/ad_param/ad_param.rb +96 -0
- data/lib/sem4r/ad_param/ad_param_operation.rb +34 -0
- data/lib/sem4r/ad_param/ad_param_service.rb +59 -0
- data/lib/sem4r/adwords.rb +242 -0
- data/lib/sem4r/api_counters.rb +7 -0
- data/lib/sem4r/base.rb +43 -0
- data/lib/sem4r/bulk_mutate_job/bulk_mutate_job.rb +108 -0
- data/lib/sem4r/bulk_mutate_job/bulk_mutate_job_selector.rb +56 -0
- data/lib/sem4r/bulk_mutate_job/bulk_mutate_job_service.rb +57 -0
- data/lib/sem4r/bulk_mutate_job/job_operations.rb +35 -0
- data/lib/sem4r/campaign/campaign.rb +193 -0
- data/lib/sem4r/campaign/campaign_service.rb +91 -0
- data/lib/sem4r/campaign_criterion/campaign_criterion_service.rb +30 -0
- data/lib/sem4r/campaign_target/campaign_target_service.rb +30 -0
- data/lib/sem4r/cli/cli_command.rb +101 -0
- data/lib/sem4r/cli/cli_commands.rb +60 -0
- data/lib/sem4r/cli/cli_common_args.rb +293 -0
- data/lib/sem4r/cli/cli_download_report.rb +81 -0
- data/lib/sem4r/cli/cli_helpers.rb +57 -0
- data/lib/sem4r/cli/cli_ideas.rb +100 -0
- data/lib/sem4r/cli/cli_list_ads.rb +74 -0
- data/lib/sem4r/cli/cli_list_keywords.rb +76 -0
- data/lib/sem4r/cli/cli_request_report.rb +104 -0
- data/lib/sem4r/cli/cli_sem.rb +64 -0
- data/lib/sem4r/common/operation.rb +78 -0
- data/lib/sem4r/credentials.rb +86 -0
- data/lib/sem4r/extensions.rb +62 -0
- data/lib/sem4r/geo_location/geo_location_service.rb +59 -0
- data/lib/sem4r/info/info_service.rb +115 -0
- data/lib/sem4r/report_definition/report_definition.rb +104 -0
- data/lib/sem4r/report_definition/report_definition_operation.rb +34 -0
- data/lib/sem4r/report_definition/report_definition_selector.rb +31 -0
- data/lib/sem4r/report_definition/report_definition_service.rb +55 -0
- data/lib/sem4r/sem4r_error.rb +28 -0
- data/lib/sem4r/services/service.rb +74 -0
- data/lib/sem4r/services/soap_call.rb +100 -0
- data/lib/sem4r/services/soap_connector.rb +284 -0
- data/lib/sem4r/services/soap_error.rb +38 -0
- data/lib/sem4r/services/soap_message_v13.rb +129 -0
- data/lib/sem4r/services/soap_message_v2009.rb +170 -0
- data/lib/sem4r/soap_attributes.rb +141 -0
- data/lib/sem4r/targeting_idea/targeting_idea.rb +158 -0
- data/lib/sem4r/targeting_idea/targeting_idea_selector.rb +200 -0
- data/lib/sem4r/targeting_idea/targeting_idea_service.rb +51 -0
- data/lib/sem4r/v13_account/account_service.rb +54 -0
- data/lib/sem4r/v13_account/billing_address.rb +67 -0
- data/lib/sem4r/v13_report/report.rb +185 -0
- data/lib/sem4r/v13_report/report_job.rb +51 -0
- data/lib/sem4r/v13_report/report_service.rb +89 -0
- data/lib/sem4r/v13_traffic_estimator/traffic_estimator_service.rb +30 -0
- data/lib/sem4r.rb +142 -0
- data/lib/sem4r_cli.rb +40 -0
- data/sem4r.gemspec +247 -0
- data/spec/aggregates_spec_helper.rb +59 -0
- data/spec/fixtures/sem4r.example.yml +26 -0
- data/spec/fixtures/services/ad_group/get-first-req.xml +28 -0
- data/spec/fixtures/services/ad_group/get-first-res.xml +91 -0
- data/spec/fixtures/services/ad_group/get-manual-cpm-bids-req.xml +106 -0
- data/spec/fixtures/services/ad_group/get-manual-cpm-bids-res.xml +75 -0
- data/spec/fixtures/services/ad_group/mutate_add-req.xml +52 -0
- data/spec/fixtures/services/ad_group/mutate_add-res.xml +33 -0
- data/spec/fixtures/services/ad_group_ad/get_mobile_ad-req.xml +28 -0
- data/spec/fixtures/services/ad_group_ad/get_mobile_ad-res.xml +194 -0
- data/spec/fixtures/services/ad_group_ad/get_text_ad-req.xml +29 -0
- data/spec/fixtures/services/ad_group_ad/get_text_ad-res.xml +55 -0
- data/spec/fixtures/services/ad_group_ad/mutate_add_mobile_ad-req.xml +50 -0
- data/spec/fixtures/services/ad_group_ad/mutate_add_mobile_ad-res.xml +42 -0
- data/spec/fixtures/services/ad_group_ad/mutate_add_text_ad-req.xml +37 -0
- data/spec/fixtures/services/ad_group_ad/mutate_add_text_ad-res.xml +32 -0
- data/spec/fixtures/services/ad_group_ad/mutate_add_two_criterions-req.xml +83 -0
- data/spec/fixtures/services/ad_group_ad/mutate_add_two_criterions-res.xml +95 -0
- data/spec/fixtures/services/ad_group_criterion/get-req.xml +28 -0
- data/spec/fixtures/services/ad_group_criterion/get-res.xml +242 -0
- data/spec/fixtures/services/ad_group_criterion/mutate_add_criterion_keyword-req.xml +48 -0
- data/spec/fixtures/services/ad_group_criterion/mutate_add_criterion_keyword-res.xml +47 -0
- data/spec/fixtures/services/ad_group_criterion/mutate_add_criterion_placement-req.xml +35 -0
- data/spec/fixtures/services/ad_group_criterion/mutate_add_criterion_placement-res.xml +32 -0
- data/spec/fixtures/services/ad_group_criterion/mutate_add_negative_keyword-req.xml +37 -0
- data/spec/fixtures/services/ad_group_criterion/mutate_add_negative_keyword-res.xml +51 -0
- data/spec/fixtures/services/ad_param/mutate_set-req.xml +43 -0
- data/spec/fixtures/services/ad_param/mutate_set-res.xml +29 -0
- data/spec/fixtures/services/bulk_mutate_job/get-req.xml +36 -0
- data/spec/fixtures/services/bulk_mutate_job/get-res.xml +54 -0
- data/spec/fixtures/services/bulk_mutate_job/mutate-req.xml +69 -0
- data/spec/fixtures/services/bulk_mutate_job/mutate-res.xml +48 -0
- data/spec/fixtures/services/campaign/get-req.xml +37 -0
- data/spec/fixtures/services/campaign/get-res.xml +1986 -0
- data/spec/fixtures/services/campaign/mutate_add-req.xml +37 -0
- data/spec/fixtures/services/campaign/mutate_add-res.xml +42 -0
- data/spec/fixtures/services/error.xml +28 -0
- data/spec/fixtures/services/info/get_unit_count-req.xml +30 -0
- data/spec/fixtures/services/info/get_unit_count-res.xml +29 -0
- data/spec/fixtures/services/report_definition/mutate_add-req.xml +24 -0
- data/spec/fixtures/services/report_definition/mutate_add-req_orig.xml +45 -0
- data/spec/fixtures/services/targeting_idea/get-req-all-options.xml +57 -0
- data/spec/fixtures/services/targeting_idea/get-req.xml +60 -0
- data/spec/fixtures/services/targeting_idea/get-res.xml +3601 -0
- data/spec/fixtures/services/v13_account/get_account_info-req.xml +23 -0
- data/spec/fixtures/services/v13_account/get_account_info-res.xml +54 -0
- data/spec/fixtures/services/v13_account/get_client_accounts-req.xml +22 -0
- data/spec/fixtures/services/v13_account/get_client_accounts-res.xml +37 -0
- data/spec/fixtures/services/v13_report/get_all_jobs-req.xml +21 -0
- data/spec/fixtures/services/v13_report/get_all_jobs-res.xml +109 -0
- data/spec/fixtures/services/v13_report/schedule_report_job-req.xml +56 -0
- data/spec/fixtures/services/v13_report/schedule_report_job-res.xml +24 -0
- data/spec/sem4r/account_spec.rb +86 -0
- data/spec/sem4r/ad_group/ad_group_bids_spec.rb +67 -0
- data/spec/sem4r/ad_group/ad_group_service_spec.rb +66 -0
- data/spec/sem4r/ad_group/ad_group_spec.rb +212 -0
- data/spec/sem4r/ad_group_ad/ad_group_ad_operation_spec.rb +88 -0
- data/spec/sem4r/ad_group_ad/ad_group_ad_service_spec.rb +55 -0
- data/spec/sem4r/ad_group_ad/ad_group_ad_spec.rb +173 -0
- data/spec/sem4r/ad_group_criterion/ad_group_criterion_bids_spec.rb +60 -0
- data/spec/sem4r/ad_group_criterion/ad_group_criterion_service_spec.rb +55 -0
- data/spec/sem4r/ad_group_criterion/ad_group_criterion_spec.rb +103 -0
- data/spec/sem4r/ad_group_criterion/criterion_spec.rb +85 -0
- data/spec/sem4r/ad_param/ad_param_service_spec.rb +55 -0
- data/spec/sem4r/ad_param/ad_param_spec.rb +59 -0
- data/spec/sem4r/adwords_spec.rb +110 -0
- data/spec/sem4r/bulk_mutate_job/bulk_mutate_job_service_spec.rb +63 -0
- data/spec/sem4r/bulk_mutate_job/bulk_mutate_job_spec.rb +69 -0
- data/spec/sem4r/bulk_mutate_job/job_operation_spec.rb +48 -0
- data/spec/sem4r/campaign/campaign_service_spec.rb +66 -0
- data/spec/sem4r/campaign/campaign_spec.rb +105 -0
- data/spec/sem4r/cli/cli_spec.rb +71 -0
- data/spec/sem4r/credentials_spec.rb +65 -0
- data/spec/sem4r/report_definition/report_definition_service_spec.rb +44 -0
- data/spec/sem4r/report_definition/report_definition_spec.rb +105 -0
- data/spec/sem4r/rexml_parsing_spec.rb +103 -0
- data/spec/sem4r/services/service_spec.rb +36 -0
- data/spec/sem4r/services/soap_call_spec.rb +115 -0
- data/spec/sem4r/services/soap_message_v13_spec.rb +54 -0
- data/spec/sem4r/soap_attributes_spec.rb +116 -0
- data/spec/sem4r/targeting_idea/targeting_idea_selector_spec.rb +120 -0
- data/spec/sem4r/targeting_idea/targeting_idea_service_spec.rb +44 -0
- data/spec/sem4r/targeting_idea/targeting_idea_spec.rb +53 -0
- data/spec/sem4r/v13_account/account_service_spec.rb +60 -0
- data/spec/sem4r/v13_report/report_service_spec.rb +104 -0
- data/spec/sem4r/v13_report/report_spec.rb +79 -0
- data/spec/sem4r_spec_helper.rb +353 -0
- data/spec/spec_helper.rb +12 -0
- metadata +375 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# -------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
# a copy of this software and associated documentation files (the
|
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
# the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
# -------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
require File.dirname(__FILE__) + "/example_helper"
|
|
25
|
+
|
|
26
|
+
run_example(__FILE__) do |adwords|
|
|
27
|
+
|
|
28
|
+
puts "Create example campaigns"
|
|
29
|
+
client_account = adwords.account.client_accounts.first
|
|
30
|
+
|
|
31
|
+
campaign = Campaign.create(client_account) do
|
|
32
|
+
name "campaign #{Time.now.strftime('%m%d-%H%M%S')}"
|
|
33
|
+
end
|
|
34
|
+
puts "created campaign '#{campaign.name}' with id '#{campaign.id}'"
|
|
35
|
+
|
|
36
|
+
adgroup = AdGroup.create(campaign) do
|
|
37
|
+
name "adgroup #{Time.now.strftime('%m%d-%H%M%S')}"
|
|
38
|
+
end
|
|
39
|
+
puts "created adgroup '#{adgroup.name}' with id '#{adgroup.id}'"
|
|
40
|
+
|
|
41
|
+
adgroup_ad = AdGroupTextAd.new(adgroup) do
|
|
42
|
+
url "http://www.sem4r.com"
|
|
43
|
+
display_url "www.Sem4R.com"
|
|
44
|
+
headline "adwords api library"
|
|
45
|
+
description1 "adwords made simple"
|
|
46
|
+
description2 "set up you campaings in a snap"
|
|
47
|
+
end
|
|
48
|
+
puts "created ad with id '#{adgroup_ad.id}'"
|
|
49
|
+
|
|
50
|
+
CriterionKeyword.new(adgroup) do
|
|
51
|
+
text "sem4r"
|
|
52
|
+
match "BROAD"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
CriterionKeyword.new(adgroup) do
|
|
56
|
+
text "adwords"
|
|
57
|
+
match "BROAD"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
CriterionKeyword.new(adgroup) do
|
|
61
|
+
text "library"
|
|
62
|
+
match "BROAD"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
CriterionPlacement.new(adgroup) do
|
|
66
|
+
url "http://www.sem4r.com"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
#
|
|
70
|
+
# dsl
|
|
71
|
+
#
|
|
72
|
+
|
|
73
|
+
adgroup_dsl = campaign.ad_group do
|
|
74
|
+
name "adgroup dsl #{Time.now.strftime('%m%d-%H%M%S')}"
|
|
75
|
+
|
|
76
|
+
keyword do
|
|
77
|
+
text "adwords client library"
|
|
78
|
+
match "BROAD"
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
campaign.p_ad_groups(true)
|
|
83
|
+
adgroup.p_criterions(true)
|
|
84
|
+
adgroup_dsl.p_criterions(true)
|
|
85
|
+
|
|
86
|
+
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# -------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
# a copy of this software and associated documentation files (the
|
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
# the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
# -------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
require File.dirname(__FILE__) + "/example_helper"
|
|
25
|
+
|
|
26
|
+
run_example(__FILE__) do |adwords|
|
|
27
|
+
|
|
28
|
+
puts "Create example campaigns"
|
|
29
|
+
client_account = adwords.account.client_accounts.first
|
|
30
|
+
|
|
31
|
+
#
|
|
32
|
+
# 1. campaign
|
|
33
|
+
#
|
|
34
|
+
campaign = client_account.campaign "sem4r web campaign #{Time.now.strftime('%m%d-%H%M%S')}" do
|
|
35
|
+
|
|
36
|
+
bidding_strategy "ManualCPM"
|
|
37
|
+
|
|
38
|
+
ad_group "sem4r search page #{Time.now.strftime('%m%d-%H%M%S')}" do
|
|
39
|
+
|
|
40
|
+
manual_cpm_bids do
|
|
41
|
+
max_cpm 20000000
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
text_ad do
|
|
45
|
+
url "http://www.sem4r.com"
|
|
46
|
+
display_url "www.Sem4R.com"
|
|
47
|
+
headline "adwords api library"
|
|
48
|
+
description1 "adwords made simple"
|
|
49
|
+
description2 "set up you campaings in a snap!"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
keyword "adwords api", "BROAD"
|
|
53
|
+
keyword "ruby adwords", "BROAD"
|
|
54
|
+
placement "http://www.sem4r.com"
|
|
55
|
+
|
|
56
|
+
negative_keyword "java api library"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
campaign.p_ad_groups(true)
|
|
60
|
+
|
|
61
|
+
#
|
|
62
|
+
# 2 campaign
|
|
63
|
+
#
|
|
64
|
+
|
|
65
|
+
campaign = client_account.campaign "sem4r mobile campaign #{Time.now.strftime('%m%d-%H%M%S')}" do
|
|
66
|
+
|
|
67
|
+
bidding_strategy "ManualCPC"
|
|
68
|
+
|
|
69
|
+
ad_group "sem4r on mobile #{Time.now.strftime('%m%d-%H%M%S')}" do
|
|
70
|
+
manual_cpc_bids do
|
|
71
|
+
keyword_max_cpc 21000000
|
|
72
|
+
site_max_cpc 22000000
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
mobile_ad do
|
|
76
|
+
headline "sem4r"
|
|
77
|
+
description "simply adwords"
|
|
78
|
+
# markup "XHTML"
|
|
79
|
+
# carrier "Vodafone@IT"
|
|
80
|
+
carrier 'ALLCARRIERS'
|
|
81
|
+
business_name "sem4r"
|
|
82
|
+
country_code "IT"
|
|
83
|
+
phone_number "0612345"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
keyword "adwords api", "BROAD" do
|
|
87
|
+
# status "PAUSED"
|
|
88
|
+
# url "pippo"
|
|
89
|
+
# max_cpc 32423423
|
|
90
|
+
# max_cpm 232321
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
keyword "ruby adwords", "BROAD"
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
campaign.p_ad_groups(true)
|
|
98
|
+
|
|
99
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# -------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
# a copy of this software and associated documentation files (the
|
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
# the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
# -------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
require File.dirname(__FILE__) + "/example_helper"
|
|
25
|
+
|
|
26
|
+
run_example(__FILE__) do |adwords|
|
|
27
|
+
|
|
28
|
+
puts "Create example campaigns"
|
|
29
|
+
client_account = adwords.account.client_accounts.first
|
|
30
|
+
|
|
31
|
+
#
|
|
32
|
+
# 1. campaign
|
|
33
|
+
#
|
|
34
|
+
campaign = client_account.campaign "sem4r web campaign #{Time.now.strftime('%m%d-%H%M%S')}" do
|
|
35
|
+
|
|
36
|
+
ad_group "sem4r search page #{Time.now.strftime('%m%d-%H%M%S')}" do
|
|
37
|
+
|
|
38
|
+
text_ad do
|
|
39
|
+
url "http://www.sem4r.com"
|
|
40
|
+
display_url "www.Sem4R.com"
|
|
41
|
+
headline "adwords api library"
|
|
42
|
+
description1 "adwords made simple"
|
|
43
|
+
description2 "set up you campaings in a snap!"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
text_ad do
|
|
47
|
+
url "http://www.sem4r.com"
|
|
48
|
+
display_url "www.Sem4R.com"
|
|
49
|
+
headline "adwords library"
|
|
50
|
+
description1 "no more headache"
|
|
51
|
+
description2 "set up you campaings in a snap!"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
puts "first keyword"
|
|
55
|
+
keyword "adwords api", "BROAD"
|
|
56
|
+
puts "second keyword"
|
|
57
|
+
keyword "ruby adwords", "BROAD"
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
puts "created campaign '#{campaign.name}'"
|
|
62
|
+
adgroup = campaign.ad_groups.first
|
|
63
|
+
adgroup.p_ads
|
|
64
|
+
adgroup.p_criterions
|
|
65
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# -------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
# a copy of this software and associated documentation files (the
|
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
# the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
# -------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
require File.dirname(__FILE__) + "/example_helper"
|
|
25
|
+
|
|
26
|
+
run_example(__FILE__) do |adwords|
|
|
27
|
+
puts "Create an adgroup with adparam"
|
|
28
|
+
|
|
29
|
+
client_account = adwords.account.client_accounts[1]
|
|
30
|
+
|
|
31
|
+
if client_account.campaigns.length != 0
|
|
32
|
+
campaign = client_account.campaigns[0]
|
|
33
|
+
else
|
|
34
|
+
campaign = client_account.campaign do
|
|
35
|
+
name "campaign #{Time.now.strftime('%m%d-%H%M%S')}"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
campaign.ad_group do
|
|
40
|
+
name "ad_group #{Time.now.strftime('%m%d-%H%M%S')}"
|
|
41
|
+
|
|
42
|
+
text_ad do
|
|
43
|
+
url "http://www.pluto.com"
|
|
44
|
+
display_url "www.Pluto.com"
|
|
45
|
+
headline "Vieni da noi"
|
|
46
|
+
description1 "vieni da noi"
|
|
47
|
+
description2 "arivieni da noi"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
keyword do
|
|
51
|
+
text "pippo"
|
|
52
|
+
match "BROAD"
|
|
53
|
+
|
|
54
|
+
ad_param do
|
|
55
|
+
index 1
|
|
56
|
+
text "$99.99"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
ad_param do
|
|
60
|
+
index 2
|
|
61
|
+
text "10"
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
campaign.ad_groups(true).each do |ad_group|
|
|
67
|
+
ad_group.p_ad_params
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
# a copy of this software and associated documentation files (the
|
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
# the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
#
|
|
23
|
+
# -------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
require File.dirname(__FILE__) + "/example_helper"
|
|
26
|
+
|
|
27
|
+
run_example(__FILE__) do |adwords|
|
|
28
|
+
account = adwords.account
|
|
29
|
+
|
|
30
|
+
ideas = account.targeting_idea do
|
|
31
|
+
idea_type "KEYWORD"
|
|
32
|
+
request_type "IDEAS"
|
|
33
|
+
|
|
34
|
+
excluded_keyword_search_parameter do
|
|
35
|
+
text 'media player'
|
|
36
|
+
match_type 'EXACT'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
keyword_match_type_search_parameter do
|
|
40
|
+
match_type 'BROAD'
|
|
41
|
+
match_type 'EXACT'
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
related_to_keyword_search_parameter do
|
|
45
|
+
text 'dvd player'
|
|
46
|
+
match_type 'EXACT'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
country_target_search_parameter do
|
|
50
|
+
country_code 'US'
|
|
51
|
+
# country_code 'UK'
|
|
52
|
+
# country_code 'IT'
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
ideas.each{ |idea| puts idea }
|
|
58
|
+
|
|
59
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# -------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
# a copy of this software and associated documentation files (the
|
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
# the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
# -------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
require File.dirname(__FILE__) + "/example_helper"
|
|
25
|
+
|
|
26
|
+
run_example(__FILE__) do |adwords|
|
|
27
|
+
adwords.account.geo_location
|
|
28
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# -------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
# a copy of this software and associated documentation files (the
|
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
# the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
# -------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
require File.dirname(__FILE__) + "/example_helper"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def create_bulk_mutate_job(campaign, adgroup)
|
|
28
|
+
text_ad1 = AdGroupTextAd.new(adgroup)
|
|
29
|
+
text_ad1.headline = "Cruise to Mars Sector 1"
|
|
30
|
+
text_ad1.description1 = "Visit the Red Planet in style."
|
|
31
|
+
text_ad1.description2 = "Low-gravity fun for everyone!"
|
|
32
|
+
text_ad1.url = "http://www.example.com"
|
|
33
|
+
text_ad1.display_url = "www.example.com"
|
|
34
|
+
|
|
35
|
+
text_ad2 = AdGroupTextAd.new(adgroup)
|
|
36
|
+
text_ad2.headline = "Cruise to Mars Sector 2"
|
|
37
|
+
text_ad2.description1 = "Visit the Red Planet in style."
|
|
38
|
+
text_ad2.description2 = "Low-gravity fun for everyone!"
|
|
39
|
+
text_ad2.url = "http://www.example.com"
|
|
40
|
+
text_ad2.display_url = "www.example.com"
|
|
41
|
+
|
|
42
|
+
bulk_mutate_job = BulkMutateJob.new
|
|
43
|
+
bulk_mutate_job.campaign_id = campaign.id
|
|
44
|
+
|
|
45
|
+
ad_operation1 = AdGroupAdOperation.new
|
|
46
|
+
ad_operation1.add text_ad1
|
|
47
|
+
|
|
48
|
+
ad_operation2 = AdGroupAdOperation.new
|
|
49
|
+
ad_operation2.add text_ad2
|
|
50
|
+
|
|
51
|
+
job = BulkMutateJob.new
|
|
52
|
+
job.campaign_id = 100
|
|
53
|
+
job.add_operation ad_operation1
|
|
54
|
+
job.add_operation ad_operation2
|
|
55
|
+
job
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
run_example(__FILE__) do |adwords|
|
|
59
|
+
|
|
60
|
+
account = adwords.account
|
|
61
|
+
client_account = adwords.account.client_accounts.first
|
|
62
|
+
|
|
63
|
+
campaign = Campaign.create(client_account) do
|
|
64
|
+
name "campaign #{Time.now.strftime('%m%d-%H%M%S')}"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
ad_group = campaign.ad_group do
|
|
68
|
+
name "adgroup #{Time.now.strftime('%m%d-%H%M%S')}"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
puts "created campaign '#{campaign.name}' with id '#{campaign.id}'"
|
|
72
|
+
puts "created adgroup '#{ad_group.name}' with id '#{ad_group.id}'"
|
|
73
|
+
|
|
74
|
+
job = create_bulk_mutate_job(campaign, ad_group)
|
|
75
|
+
|
|
76
|
+
job_operation = JobOperation.new
|
|
77
|
+
job_operation.add(job)
|
|
78
|
+
|
|
79
|
+
result_job = account.job_mutate(job_operation)
|
|
80
|
+
|
|
81
|
+
puts result_job.to_s
|
|
82
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# -------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
# a copy of this software and associated documentation files (the
|
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
# the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
# -------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
require File.dirname(__FILE__) + "/example_helper"
|
|
25
|
+
|
|
26
|
+
run_example(__FILE__) do |adwords|
|
|
27
|
+
account = adwords.account
|
|
28
|
+
account.p_jobs
|
|
29
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# -------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
# a copy of this software and associated documentation files (the
|
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
# the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
# -------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
require File.dirname(__FILE__) + "/example_helper"
|
|
25
|
+
|
|
26
|
+
run_example(__FILE__) do |adwords|
|
|
27
|
+
|
|
28
|
+
puts "Prune empty campaigns and adgroups"
|
|
29
|
+
|
|
30
|
+
account = adwords.account
|
|
31
|
+
account.client_accounts.each do |client_account|
|
|
32
|
+
puts "examinate account '#{client_account.credentials.client_email}'"
|
|
33
|
+
client_account.campaigns.each do |campaign|
|
|
34
|
+
|
|
35
|
+
puts "examinate campaign '#{campaign.name}'"
|
|
36
|
+
campaign.ad_groups.each do |ad_group|
|
|
37
|
+
if ad_group.empty?
|
|
38
|
+
puts "delete adgroup '#{ad_group.name}'"
|
|
39
|
+
ad_group.delete
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
if campaign.empty?
|
|
44
|
+
puts "delete campaign '#{campaign.name}'"
|
|
45
|
+
campaign.delete
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# -------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
# a copy of this software and associated documentation files (the
|
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
# the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
# -------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
require File.dirname(__FILE__) + "/example_helper"
|
|
26
|
+
|
|
27
|
+
run_example(__FILE__) do |adwords|
|
|
28
|
+
|
|
29
|
+
puts "Prune empty campaigns and adgroups"
|
|
30
|
+
|
|
31
|
+
account = adwords.account
|
|
32
|
+
account.client_accounts.each do |client_account|
|
|
33
|
+
puts "examinate account '#{client_account.credentials.client_email}'"
|
|
34
|
+
client_account.campaigns.each do |campaign|
|
|
35
|
+
puts "delete campaign '#{campaign.name}'"
|
|
36
|
+
campaign.delete
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|