google-adwords-api 0.6.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/examples/v201109/misc/get_all_images_and_videos.rb +3 -4
- data/examples/v201109/misc/upload_image.rb +6 -7
- data/examples/v201109/optimization/get_keyword_ideas.rb +1 -2
- data/examples/v201109/optimization/get_placement_ideas.rb +1 -3
- data/examples/v201109_1/misc/get_all_images_and_videos.rb +3 -4
- data/examples/v201109_1/misc/upload_image.rb +6 -7
- data/examples/v201109_1/optimization/get_keyword_ideas.rb +1 -2
- data/examples/v201109_1/optimization/get_placement_ideas.rb +1 -3
- data/examples/v201206/misc/get_all_images_and_videos.rb +3 -4
- data/examples/v201206/misc/upload_image.rb +6 -7
- data/examples/v201206/optimization/get_keyword_ideas.rb +1 -2
- data/examples/v201206/optimization/get_placement_ideas.rb +1 -3
- data/examples/v201206/reporting/parallel_report_download.rb +12 -12
- data/lib/adwords_api.rb +9 -13
- data/lib/adwords_api/api_config.rb +2 -3
- data/lib/adwords_api/client_login_header_handler.rb +0 -47
- data/lib/adwords_api/credential_handler.rb +5 -17
- data/lib/adwords_api/errors.rb +7 -2
- data/lib/adwords_api/report_header_handler.rb +1 -1
- data/lib/adwords_api/utils.rb +0 -16
- data/lib/adwords_api/v201109/ad_extension_override_service.rb +1 -1
- data/lib/adwords_api/v201109/ad_extension_override_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/ad_group_ad_service.rb +1 -1
- data/lib/adwords_api/v201109/ad_group_ad_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/ad_group_criterion_service.rb +1 -1
- data/lib/adwords_api/v201109/ad_group_criterion_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/ad_group_service.rb +1 -1
- data/lib/adwords_api/v201109/ad_group_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/ad_param_service.rb +1 -1
- data/lib/adwords_api/v201109/ad_param_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/alert_service.rb +1 -1
- data/lib/adwords_api/v201109/alert_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/budget_order_service.rb +1 -1
- data/lib/adwords_api/v201109/budget_order_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/bulk_mutate_job_service.rb +1 -1
- data/lib/adwords_api/v201109/bulk_mutate_job_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/campaign_ad_extension_service.rb +1 -1
- data/lib/adwords_api/v201109/campaign_ad_extension_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/campaign_criterion_service.rb +1 -1
- data/lib/adwords_api/v201109/campaign_criterion_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/campaign_service.rb +1 -1
- data/lib/adwords_api/v201109/campaign_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/campaign_target_service.rb +1 -1
- data/lib/adwords_api/v201109/campaign_target_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/constant_data_service.rb +1 -1
- data/lib/adwords_api/v201109/constant_data_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/conversion_tracker_service.rb +1 -1
- data/lib/adwords_api/v201109/conversion_tracker_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/create_account_service.rb +1 -1
- data/lib/adwords_api/v201109/create_account_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/customer_sync_service.rb +1 -1
- data/lib/adwords_api/v201109/customer_sync_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/data_service.rb +1 -1
- data/lib/adwords_api/v201109/data_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/experiment_service.rb +1 -1
- data/lib/adwords_api/v201109/experiment_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/geo_location_service.rb +1 -1
- data/lib/adwords_api/v201109/geo_location_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/info_service.rb +1 -1
- data/lib/adwords_api/v201109/info_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/location_criterion_service.rb +1 -1
- data/lib/adwords_api/v201109/location_criterion_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/media_service.rb +1 -1
- data/lib/adwords_api/v201109/media_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/mutate_job_service.rb +1 -1
- data/lib/adwords_api/v201109/mutate_job_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/report_definition_service.rb +1 -1
- data/lib/adwords_api/v201109/report_definition_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/serviced_account_service.rb +1 -1
- data/lib/adwords_api/v201109/serviced_account_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/targeting_idea_service.rb +1 -1
- data/lib/adwords_api/v201109/targeting_idea_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/traffic_estimator_service.rb +1 -1
- data/lib/adwords_api/v201109/traffic_estimator_service_registry.rb +3 -3
- data/lib/adwords_api/v201109/user_list_service.rb +1 -1
- data/lib/adwords_api/v201109/user_list_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/ad_extension_override_service.rb +1 -1
- data/lib/adwords_api/v201109_1/ad_extension_override_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/ad_group_ad_service.rb +1 -1
- data/lib/adwords_api/v201109_1/ad_group_ad_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/ad_group_criterion_service.rb +1 -1
- data/lib/adwords_api/v201109_1/ad_group_criterion_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/ad_group_service.rb +1 -1
- data/lib/adwords_api/v201109_1/ad_group_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/ad_param_service.rb +1 -1
- data/lib/adwords_api/v201109_1/ad_param_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/alert_service.rb +1 -1
- data/lib/adwords_api/v201109_1/alert_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/budget_order_service.rb +1 -1
- data/lib/adwords_api/v201109_1/budget_order_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/bulk_mutate_job_service.rb +1 -1
- data/lib/adwords_api/v201109_1/bulk_mutate_job_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/campaign_ad_extension_service.rb +1 -1
- data/lib/adwords_api/v201109_1/campaign_ad_extension_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/campaign_criterion_service.rb +1 -1
- data/lib/adwords_api/v201109_1/campaign_criterion_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/campaign_service.rb +1 -1
- data/lib/adwords_api/v201109_1/campaign_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/campaign_target_service.rb +1 -1
- data/lib/adwords_api/v201109_1/campaign_target_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/constant_data_service.rb +1 -1
- data/lib/adwords_api/v201109_1/constant_data_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/conversion_tracker_service.rb +1 -1
- data/lib/adwords_api/v201109_1/conversion_tracker_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/create_account_service.rb +1 -1
- data/lib/adwords_api/v201109_1/create_account_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/customer_service.rb +1 -1
- data/lib/adwords_api/v201109_1/customer_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/customer_sync_service.rb +1 -1
- data/lib/adwords_api/v201109_1/customer_sync_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/data_service.rb +1 -1
- data/lib/adwords_api/v201109_1/data_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/experiment_service.rb +1 -1
- data/lib/adwords_api/v201109_1/experiment_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/geo_location_service.rb +1 -1
- data/lib/adwords_api/v201109_1/geo_location_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/info_service.rb +1 -1
- data/lib/adwords_api/v201109_1/info_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/location_criterion_service.rb +1 -1
- data/lib/adwords_api/v201109_1/location_criterion_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/managed_customer_service.rb +1 -1
- data/lib/adwords_api/v201109_1/managed_customer_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/media_service.rb +1 -1
- data/lib/adwords_api/v201109_1/media_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/mutate_job_service.rb +1 -1
- data/lib/adwords_api/v201109_1/mutate_job_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/report_definition_service.rb +1 -1
- data/lib/adwords_api/v201109_1/report_definition_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/serviced_account_service.rb +1 -1
- data/lib/adwords_api/v201109_1/serviced_account_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/targeting_idea_service.rb +1 -1
- data/lib/adwords_api/v201109_1/targeting_idea_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/traffic_estimator_service.rb +1 -1
- data/lib/adwords_api/v201109_1/traffic_estimator_service_registry.rb +3 -3
- data/lib/adwords_api/v201109_1/user_list_service.rb +1 -1
- data/lib/adwords_api/v201109_1/user_list_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/ad_extension_override_service.rb +1 -1
- data/lib/adwords_api/v201206/ad_extension_override_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/ad_group_ad_service.rb +1 -1
- data/lib/adwords_api/v201206/ad_group_ad_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/ad_group_criterion_service.rb +1 -1
- data/lib/adwords_api/v201206/ad_group_criterion_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/ad_group_service.rb +1 -1
- data/lib/adwords_api/v201206/ad_group_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/ad_param_service.rb +1 -1
- data/lib/adwords_api/v201206/ad_param_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/alert_service.rb +1 -1
- data/lib/adwords_api/v201206/alert_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/budget_order_service.rb +1 -1
- data/lib/adwords_api/v201206/budget_order_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/bulk_mutate_job_service.rb +1 -1
- data/lib/adwords_api/v201206/bulk_mutate_job_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/campaign_ad_extension_service.rb +1 -1
- data/lib/adwords_api/v201206/campaign_ad_extension_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/campaign_criterion_service.rb +1 -1
- data/lib/adwords_api/v201206/campaign_criterion_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/campaign_service.rb +1 -1
- data/lib/adwords_api/v201206/campaign_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/constant_data_service.rb +1 -1
- data/lib/adwords_api/v201206/constant_data_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/conversion_tracker_service.rb +1 -1
- data/lib/adwords_api/v201206/conversion_tracker_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/customer_service.rb +1 -1
- data/lib/adwords_api/v201206/customer_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/customer_sync_service.rb +1 -1
- data/lib/adwords_api/v201206/customer_sync_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/data_service.rb +1 -1
- data/lib/adwords_api/v201206/data_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/experiment_service.rb +1 -1
- data/lib/adwords_api/v201206/experiment_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/geo_location_service.rb +1 -1
- data/lib/adwords_api/v201206/geo_location_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/info_service.rb +1 -1
- data/lib/adwords_api/v201206/info_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/location_criterion_service.rb +1 -1
- data/lib/adwords_api/v201206/location_criterion_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/managed_customer_service.rb +1 -1
- data/lib/adwords_api/v201206/managed_customer_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/media_service.rb +1 -1
- data/lib/adwords_api/v201206/media_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/mutate_job_service.rb +1 -1
- data/lib/adwords_api/v201206/mutate_job_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/report_definition_service.rb +1 -1
- data/lib/adwords_api/v201206/report_definition_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/targeting_idea_service.rb +1 -1
- data/lib/adwords_api/v201206/targeting_idea_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/traffic_estimator_service.rb +1 -1
- data/lib/adwords_api/v201206/traffic_estimator_service_registry.rb +3 -3
- data/lib/adwords_api/v201206/user_list_service.rb +1 -1
- data/lib/adwords_api/v201206/user_list_service_registry.rb +3 -3
- data/lib/adwords_api/version.rb +1 -1
- data/test/adwords_api/test_utils.rb +0 -13
- data/test/examples/v201109/test_reporting.rb +0 -5
- data/test/examples/v201109/utils.rb +1 -2
- data/test/examples/v201109_1/test_reporting.rb +0 -5
- data/test/examples/v201109_1/utils.rb +1 -2
- data/test/examples/v201206/test_reporting.rb +0 -5
- data/test/examples/v201206/utils.rb +1 -2
- metadata +4 -5
- data/examples/v201206/reporting/get_defined_reports.rb +0 -75
data/lib/adwords_api/version.rb
CHANGED
@@ -26,19 +26,6 @@ require 'adwords_api/utils'
|
|
26
26
|
|
27
27
|
class TestUtils < Test::Unit::TestCase
|
28
28
|
|
29
|
-
def test_map()
|
30
|
-
param1 = [
|
31
|
-
{:key => 'foo', :value => 'bar'},
|
32
|
-
{:key => 'baz', :value => 'zar'},
|
33
|
-
]
|
34
|
-
result1 = {'foo' => 'bar', 'baz' => 'zar'}
|
35
|
-
assert_equal(result1, AdwordsApi::Utils::map(param1))
|
36
|
-
|
37
|
-
param2 = []
|
38
|
-
result2 = {}
|
39
|
-
assert_equal(result2, AdwordsApi::Utils::map(param2))
|
40
|
-
end
|
41
|
-
|
42
29
|
def test_operation_index_for_error()
|
43
30
|
error1 = {:field_path => 'operations[0].operand.adGroupId'}
|
44
31
|
assert_equal(0, AdwordsApi::Utils::operation_index_for_error(error1))
|
@@ -25,7 +25,6 @@ require 'tempfile'
|
|
25
25
|
|
26
26
|
require 'reporting/download_criteria_report'
|
27
27
|
require 'reporting/get_campaign_stats'
|
28
|
-
require 'reporting/get_defined_reports'
|
29
28
|
require 'reporting/get_report_fields'
|
30
29
|
require 'reporting/parallel_report_download'
|
31
30
|
|
@@ -56,10 +55,6 @@ class TestReportingV201109 < Test::Unit::TestCase
|
|
56
55
|
get_campaign_stats()
|
57
56
|
end
|
58
57
|
|
59
|
-
def test_get_defined_reports
|
60
|
-
get_defined_reports()
|
61
|
-
end
|
62
|
-
|
63
58
|
def test_get_report_fields
|
64
59
|
report_type = 'ACCOUNT_PERFORMANCE_REPORT'
|
65
60
|
get_report_fields(report_type)
|
@@ -74,8 +74,7 @@ class UtilsV201109
|
|
74
74
|
:network_setting => {
|
75
75
|
:target_google_search => true,
|
76
76
|
:target_search_network => true,
|
77
|
-
:target_content_network =>
|
78
|
-
:target_content_contextual => false
|
77
|
+
:target_content_network => true
|
79
78
|
}
|
80
79
|
}
|
81
80
|
operation = {:operator => 'ADD', :operand => campaign}
|
@@ -25,7 +25,6 @@ require 'tempfile'
|
|
25
25
|
|
26
26
|
require 'reporting/download_criteria_report'
|
27
27
|
require 'reporting/get_campaign_stats'
|
28
|
-
require 'reporting/get_defined_reports'
|
29
28
|
require 'reporting/get_report_fields'
|
30
29
|
require 'reporting/parallel_report_download'
|
31
30
|
|
@@ -56,10 +55,6 @@ class TestReportingV201109_1 < Test::Unit::TestCase
|
|
56
55
|
get_campaign_stats()
|
57
56
|
end
|
58
57
|
|
59
|
-
def test_get_defined_reports
|
60
|
-
get_defined_reports()
|
61
|
-
end
|
62
|
-
|
63
58
|
def test_get_report_fields
|
64
59
|
report_type = 'ACCOUNT_PERFORMANCE_REPORT'
|
65
60
|
get_report_fields(report_type)
|
@@ -74,8 +74,7 @@ class UtilsV201109_1
|
|
74
74
|
:network_setting => {
|
75
75
|
:target_google_search => true,
|
76
76
|
:target_search_network => true,
|
77
|
-
:target_content_network =>
|
78
|
-
:target_content_contextual => false
|
77
|
+
:target_content_network => true
|
79
78
|
}
|
80
79
|
}
|
81
80
|
operation = {:operator => 'ADD', :operand => campaign}
|
@@ -26,7 +26,6 @@ require 'tempfile'
|
|
26
26
|
require 'reporting/download_criteria_report'
|
27
27
|
require 'reporting/download_criteria_report_with_awql'
|
28
28
|
require 'reporting/get_campaign_stats'
|
29
|
-
require 'reporting/get_defined_reports'
|
30
29
|
require 'reporting/get_report_fields'
|
31
30
|
require 'reporting/parallel_report_download'
|
32
31
|
|
@@ -67,10 +66,6 @@ class TestReportingV201206 < Test::Unit::TestCase
|
|
67
66
|
get_campaign_stats()
|
68
67
|
end
|
69
68
|
|
70
|
-
def test_get_defined_reports()
|
71
|
-
get_defined_reports()
|
72
|
-
end
|
73
|
-
|
74
69
|
def test_get_report_fields()
|
75
70
|
report_type = 'ACCOUNT_PERFORMANCE_REPORT'
|
76
71
|
get_report_fields(report_type)
|
@@ -74,8 +74,7 @@ class UtilsV201206
|
|
74
74
|
:network_setting => {
|
75
75
|
:target_google_search => true,
|
76
76
|
:target_search_network => true,
|
77
|
-
:target_content_network =>
|
78
|
-
:target_content_contextual => false
|
77
|
+
:target_content_network => true
|
79
78
|
}
|
80
79
|
}
|
81
80
|
operation = {:operator => 'ADD', :operand => campaign}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-adwords-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-ads-common
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.8.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.8.0
|
30
30
|
description: google-adwords-api is a AdWords API client library for Ruby
|
31
31
|
email:
|
32
32
|
- api.dklimkin@gmail.com
|
@@ -362,7 +362,6 @@ files:
|
|
362
362
|
- examples/v201109/remarketing/add_conversion_tracker.rb
|
363
363
|
- examples/v201109/remarketing/add_audience.rb
|
364
364
|
- examples/v201206/reporting/download_criteria_report.rb
|
365
|
-
- examples/v201206/reporting/get_defined_reports.rb
|
366
365
|
- examples/v201206/reporting/get_campaign_stats.rb
|
367
366
|
- examples/v201206/reporting/parallel_report_download.rb
|
368
367
|
- examples/v201206/reporting/get_report_fields.rb
|
@@ -1,75 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# Encoding: utf-8
|
3
|
-
#
|
4
|
-
# Author:: api.sgomes@gmail.com (Sérgio Gomes)
|
5
|
-
#
|
6
|
-
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
7
|
-
#
|
8
|
-
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
-
# you may not use this file except in compliance with the License.
|
10
|
-
# You may obtain a copy of the License at
|
11
|
-
#
|
12
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
#
|
14
|
-
# Unless required by applicable law or agreed to in writing, software
|
15
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
17
|
-
# implied.
|
18
|
-
# See the License for the specific language governing permissions and
|
19
|
-
# limitations under the License.
|
20
|
-
#
|
21
|
-
# This example gets all report definitions. Adding new definitions is
|
22
|
-
# deprecated, please use AdHoc reporting.
|
23
|
-
#
|
24
|
-
# Tags: ReportDefinitionService.get
|
25
|
-
|
26
|
-
require 'adwords_api'
|
27
|
-
|
28
|
-
def get_defined_reports()
|
29
|
-
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
30
|
-
# when called without parameters.
|
31
|
-
adwords = AdwordsApi::Api.new
|
32
|
-
|
33
|
-
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
34
|
-
# the configuration file or provide your own logger:
|
35
|
-
# adwords.logger = Logger.new('adwords_xml.log')
|
36
|
-
|
37
|
-
report_def_srv = adwords.service(:ReportDefinitionService, API_VERSION)
|
38
|
-
|
39
|
-
# Get all the report definitions.
|
40
|
-
selector = {}
|
41
|
-
response = report_def_srv.get(selector)
|
42
|
-
if response and response[:entries]
|
43
|
-
entries = response[:entries]
|
44
|
-
puts "#{entries.length} report definition(s) found."
|
45
|
-
entries.each do |entry|
|
46
|
-
puts " Report definition id is #{entry[:id]} and name is " +
|
47
|
-
"\"#{entry[:report_name]}\"."
|
48
|
-
end
|
49
|
-
else
|
50
|
-
puts 'No report definitions found.'
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
if __FILE__ == $0
|
55
|
-
API_VERSION = :v201206
|
56
|
-
|
57
|
-
begin
|
58
|
-
get_defined_reports()
|
59
|
-
|
60
|
-
# HTTP errors.
|
61
|
-
rescue AdsCommon::Errors::HttpError => e
|
62
|
-
puts "HTTP Error: %s" % e
|
63
|
-
|
64
|
-
# API errors.
|
65
|
-
rescue AdwordsApi::Errors::ApiException => e
|
66
|
-
puts "Message: %s" % e.message
|
67
|
-
puts 'Errors:'
|
68
|
-
e.errors.each_with_index do |error, index|
|
69
|
-
puts "\tError [%d]:" % (index + 1)
|
70
|
-
error.each do |field, value|
|
71
|
-
puts "\t\t%s: %s" % [field, value]
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|