google-adwords-api 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ 0.6.2:
2
+ - Require google-ads-common 0.7.3 or later from now on.
3
+ - Support for OAuth2.0 authentication method.
4
+
1
5
  0.6.1:
2
6
  - Require google-ads-common 0.7.1 or later from now on.
3
7
  - Updated User-Agent to a single standard.
@@ -2,10 +2,24 @@
2
2
  # This is an example configuration file for the AdWords API client library.
3
3
  # Please fill in the required fields, and copy it over to your home directory.
4
4
  :authentication:
5
- # Authentication method, methods currently supported: OAuth, ClientLogin.
5
+ # Authentication method, methods currently supported:
6
+ # OAuth2, OAuth, ClientLogin.
6
7
  :method: ClientLogin
7
8
 
8
- # Auth parameters for OAuth method.
9
+ # Auth parameters for OAuth2.0 method.
10
+ # Set the OAuth2 client id and secret. Register your application here to
11
+ # obtain these values:
12
+ # https://code.google.com/apis/console#access
13
+ #:oauth2_client_id: INSERT_OAUTH2_CLIENT_ID_HERE
14
+ #:oauth2_client_secret: INSERT_OAUTH2_CLIENT_SECRET_HERE
15
+ # Optional, see: https://developers.google.com/accounts/docs/OAuth2WebServer
16
+ #:oauth2_callback: INSERT_OAUTH2_CALLBACK_URL_HERE
17
+ #:oauth2_state: INSERT_OAUTH2_STATE_HERE
18
+ #:oauth2_access_type: INSERT_OAUTH2_ACCESS_TYPE_HERE
19
+ #:oauth2_approval_prompt: INSERT_OAUTH2_APPROVAL_PROMPT_HERE
20
+
21
+ # Auth parameters for OAuth1.0a method.
22
+ # NOTE: OAuth1.0a method is deprecated, use OAuth2.0 instead.
9
23
  # Set the OAuth consumer key and secret. Anonymous values can be used for
10
24
  # testing, and real values can be obtained by registering your application:
11
25
  # http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html
@@ -19,6 +33,7 @@
19
33
  #:oauth_token_secret: INSERT_OAUTH_TOKEN_SECRET_HERE
20
34
 
21
35
  # Auth parameters for ClientLogin method.
36
+ # NOTE: ClientLogin method is deprecated, use OAuth2.0 instead.
22
37
  :password: INSERT_YOUR_PASSWORD_HERE
23
38
  :email: INSERT_YOUR_LOGIN_EMAIL_HERE
24
39
  # To manage your auth tokens manually, use the 'auth_token' property.
@@ -18,7 +18,10 @@
18
18
  # See the License for the specific language governing permissions and
19
19
  # limitations under the License.
20
20
  #
21
- # This example illustrates how to use OAuth authentication method.
21
+ # This example illustrates how to use OAuth1.0a authentication method.
22
+ #
23
+ # NOTE: OAuth1.0a authorization method is deprecated, use OAuth2.0 instead.
24
+ # See use_oauth2.rb for an example.
22
25
  #
23
26
  # Tags: CampaignService.get
24
27
 
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
3
+ #
4
+ # Author:: api.dklimkin@gmail.com (Danial Klimkin)
5
+ #
6
+ # Copyright:: Copyright 2012, 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 illustrates how to use OAuth2.0 authentication method.
22
+ #
23
+ # Tags: CampaignService.get
24
+
25
+ require 'adwords_api'
26
+
27
+ def use_oauth2()
28
+ # AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
29
+ # when called without parameters.
30
+ adwords = AdwordsApi::Api.new
31
+
32
+ # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
33
+ # the configuration file or provide your own logger:
34
+ # adwords.logger = Logger.new('adwords_xml.log')
35
+
36
+ campaign_srv = adwords.service(:CampaignService, API_VERSION)
37
+
38
+ # Get all the campaigns for this account; empty selector.
39
+ selector = {
40
+ :fields => ['Id', 'Name', 'Status'],
41
+ :ordering => [
42
+ {:field => 'Name', :sort_order => 'ASCENDING'}
43
+ ]
44
+ }
45
+
46
+ retry_count = 0
47
+
48
+ begin
49
+ response = campaign_srv.get(selector)
50
+ rescue AdsCommon::Errors::OAuth2VerificationRequired => e
51
+ if retry_count < MAX_RETRIES
52
+ puts "Hit Auth error, please navigate to URL:\n\t%s" % e.oauth_url
53
+ print 'log in and type the verification code: '
54
+ verification_code = gets.chomp
55
+ adwords.credential_handler.set_credential(
56
+ :oauth2_verification_code, verification_code)
57
+ retry_count += 1
58
+ retry
59
+ else
60
+ raise AdsCommon::Errors::AuthError, 'Failed to authenticate.'
61
+ end
62
+ end
63
+
64
+ if response and response[:entries]
65
+ campaigns = response[:entries]
66
+ campaigns.each do |campaign|
67
+ puts "Campaign ID %d, name '%s' and status '%s'" %
68
+ [campaign[:id], campaign[:name], campaign[:status]]
69
+ end
70
+ else
71
+ puts 'No campaigns were found.'
72
+ end
73
+ end
74
+
75
+ if __FILE__ == $0
76
+ API_VERSION = :v201109
77
+ MAX_RETRIES = 3
78
+
79
+ begin
80
+ use_oauth2()
81
+
82
+ # HTTP errors.
83
+ rescue AdsCommon::Errors::HttpError => e
84
+ puts "HTTP Error: %s" % e
85
+
86
+ # API errors.
87
+ rescue AdwordsApi::Errors::ApiException => e
88
+ puts "Message: %s" % e.message
89
+ puts 'Errors:'
90
+ e.errors.each_with_index do |error, index|
91
+ puts "\tError [%d]:" % (index + 1)
92
+ error.each do |field, value|
93
+ puts "\t\t%s: %s" % [field, value]
94
+ end
95
+ end
96
+ end
97
+ end
@@ -18,7 +18,10 @@
18
18
  # See the License for the specific language governing permissions and
19
19
  # limitations under the License.
20
20
  #
21
- # This example illustrates how to use OAuth authentication method.
21
+ # This example illustrates how to use OAuth1.0a authentication method.
22
+ #
23
+ # NOTE: OAuth1.0a authorization method is deprecated, use OAuth2.0 instead.
24
+ # See use_oauth2.rb for an example.
22
25
  #
23
26
  # Tags: CampaignService.get
24
27
 
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
3
+ #
4
+ # Author:: api.dklimkin@gmail.com (Danial Klimkin)
5
+ #
6
+ # Copyright:: Copyright 2012, 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 illustrates how to use OAuth2.0 authentication method.
22
+ #
23
+ # Tags: CampaignService.get
24
+
25
+ require 'adwords_api'
26
+
27
+ def use_oauth2()
28
+ # AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
29
+ # when called without parameters.
30
+ adwords = AdwordsApi::Api.new
31
+
32
+ # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
33
+ # the configuration file or provide your own logger:
34
+ # adwords.logger = Logger.new('adwords_xml.log')
35
+
36
+ campaign_srv = adwords.service(:CampaignService, API_VERSION)
37
+
38
+ # Get all the campaigns for this account; empty selector.
39
+ selector = {
40
+ :fields => ['Id', 'Name', 'Status'],
41
+ :ordering => [
42
+ {:field => 'Name', :sort_order => 'ASCENDING'}
43
+ ]
44
+ }
45
+
46
+ retry_count = 0
47
+
48
+ begin
49
+ response = campaign_srv.get(selector)
50
+ rescue AdsCommon::Errors::OAuth2VerificationRequired => e
51
+ if retry_count < MAX_RETRIES
52
+ puts "Hit Auth error, please navigate to URL:\n\t%s" % e.oauth_url
53
+ print 'log in and type the verification code: '
54
+ verification_code = gets.chomp
55
+ adwords.credential_handler.set_credential(
56
+ :oauth2_verification_code, verification_code)
57
+ retry_count += 1
58
+ retry
59
+ else
60
+ raise AdsCommon::Errors::AuthError, 'Failed to authenticate.'
61
+ end
62
+ end
63
+
64
+ if response and response[:entries]
65
+ campaigns = response[:entries]
66
+ campaigns.each do |campaign|
67
+ puts "Campaign ID %d, name '%s' and status '%s'" %
68
+ [campaign[:id], campaign[:name], campaign[:status]]
69
+ end
70
+ else
71
+ puts 'No campaigns were found.'
72
+ end
73
+ end
74
+
75
+ if __FILE__ == $0
76
+ API_VERSION = :v201109_1
77
+ MAX_RETRIES = 3
78
+
79
+ begin
80
+ use_oauth2()
81
+
82
+ # HTTP errors.
83
+ rescue AdsCommon::Errors::HttpError => e
84
+ puts "HTTP Error: %s" % e
85
+
86
+ # API errors.
87
+ rescue AdwordsApi::Errors::ApiException => e
88
+ puts "Message: %s" % e.message
89
+ puts 'Errors:'
90
+ e.errors.each_with_index do |error, index|
91
+ puts "\tError [%d]:" % (index + 1)
92
+ error.each do |field, value|
93
+ puts "\t\t%s: %s" % [field, value]
94
+ end
95
+ end
96
+ end
97
+ end
@@ -67,7 +67,7 @@ module AdwordsApi
67
67
  version.to_s
68
68
  AdwordsApi::ClientLoginHeaderHandler.new(
69
69
  @credential_handler, auth_handler, namespace, auth_ns, version)
70
- when :OAUTH
70
+ when :OAUTH, :OAUTH2
71
71
  AdsCommon::SavonHeaders::OAuthHeaderHandler.new(
72
72
  @credential_handler, auth_handler, namespace, version)
73
73
  end
@@ -20,8 +20,6 @@
20
20
  # Helper methods for loading and managing the available services in the AdWords
21
21
  # API.
22
22
 
23
- require 'savon'
24
-
25
23
  require 'ads_common/api_config'
26
24
 
27
25
  require 'adwords_api/version'
@@ -34,7 +34,7 @@ module AdwordsApi
34
34
  # - version: services version
35
35
  #
36
36
  def initialize(credential_handler, auth_handler, namespace, auth_namespace,
37
- version)
37
+ version)
38
38
  super(credential_handler, auth_handler, namespace, version)
39
39
  @auth_namespace = auth_namespace
40
40
  end
@@ -46,10 +46,9 @@ module AdwordsApi
46
46
  # Args:
47
47
  # - request: a HTTPI Request for extra configuration (unused)
48
48
  # - soap: a Savon soap object to fill fields in
49
- # - args: request parameters to adjust for namespaces
50
49
  #
51
50
  # Returns:
52
- # - Modified soap structure
51
+ # - modified soap structure
53
52
  #
54
53
  def prepare_request(request, soap)
55
54
  super(request, soap)
@@ -57,6 +56,7 @@ module AdwordsApi
57
56
  header_name = prepend_namespace(get_header_element_name())
58
57
  soap.header[:attributes!][header_name] ||= {}
59
58
  soap.header[:attributes!][header_name]['xmlns'] = @auth_namespace
59
+ return soap
60
60
  end
61
61
 
62
62
  private
@@ -74,7 +74,7 @@ module AdwordsApi
74
74
  # Returns agent name and data for user-agent string generation.
75
75
  def get_user_agent_data(extra_ids)
76
76
  agent_app = @config.read('authentication.user_agent')
77
- extra_ids << ["AwApi-Ruby/%s" % AdwordsApi::ApiConfig::CLIENT_LIB_VERSION]
77
+ extra_ids << ['AwApi-Ruby/%s' % AdwordsApi::ApiConfig::CLIENT_LIB_VERSION]
78
78
  return [extra_ids, agent_app]
79
79
  end
80
80
 
@@ -31,7 +31,7 @@ module AdwordsApi
31
31
 
32
32
  def initialize(exception_fault)
33
33
  @array_fields ||= []
34
- exception_fault.each {|key, value| set_field(key, value)}
34
+ exception_fault.each { |key, value| set_field(key, value) }
35
35
  end
36
36
 
37
37
  private
@@ -52,7 +52,7 @@ module AdwordsApi
52
52
  'Authorization' =>
53
53
  @auth_handler.auth_string(credentials, HTTPI::Request.new(url)),
54
54
  'User-Agent' => @credential_handler.generate_http_user_agent(),
55
- 'clientCustomerId' => credentials[:client_customer_id],
55
+ 'clientCustomerId' => credentials[:client_customer_id].to_s,
56
56
  'developerToken' => credentials[:developer_token]
57
57
  }
58
58
  money_in_micros = @config.read('library.return_money_in_micros')
@@ -97,7 +97,7 @@ module AdwordsApi
97
97
  # Send POST request for a report and returns Response object.
98
98
  def get_report_response(report_definition, cid)
99
99
  definition_text = get_report_definition_text(report_definition)
100
- data = "__rdxml=%s" % CGI.escape(definition_text)
100
+ data = '__rdxml=%s' % CGI.escape(definition_text)
101
101
  url = @api.api_config.adhoc_report_download_url(
102
102
  @api.config.read('service.environment'), @version)
103
103
  headers = get_report_request_headers(url, cid)
@@ -115,7 +115,7 @@ module AdwordsApi
115
115
  when Hash then report_definition_to_xml(report_definition)
116
116
  else
117
117
  raise AdwordsApi::Errors::InvalidReportDefinitionError,
118
- "Unknown object for report definition: %s" %
118
+ 'Unknown object for report definition: %s' %
119
119
  report_definition.class
120
120
  end
121
121
  end
@@ -136,8 +136,8 @@ module AdwordsApi
136
136
  def log_request(url, headers, body)
137
137
  logger = @api.logger
138
138
  logger.debug("Report request to: '%s'" % url)
139
- logger.debug("HTTP headers: [%s]" %
140
- (headers.map {|k, v| [k, v].join(': ')}.join(', ')))
139
+ logger.debug('HTTP headers: [%s]' %
140
+ (headers.map { |k, v| [k, v].join(': ') }.join(', ')))
141
141
  logger.debug(body)
142
142
  end
143
143
 
@@ -154,13 +154,13 @@ module AdwordsApi
154
154
  if matches
155
155
  message = (matches[3].nil?) ? data : matches[3]
156
156
  raise AdwordsApi::Errors::ReportError.new(response.code,
157
- "Report download error occured: %s" % message)
157
+ 'Report download error occured: %s' % message)
158
158
  end
159
159
  end
160
160
  # Check for error code.
161
161
  unless response.code == 200
162
162
  raise AdwordsApi::Errors::ReportError.new(response.code,
163
- "Report download error occured, http code: %d, body: %s" %
163
+ 'Report download error occured, http code: %d, body: %s' %
164
164
  [response.code, response.body])
165
165
  end
166
166
  return nil
@@ -202,7 +202,7 @@ module AdwordsApi
202
202
  # Adds fields order hint to generator based on specification.
203
203
  def add_report_definition_hash_order(node, name = :root)
204
204
  def_order = REPORT_DEFINITION_ORDER[name]
205
- var_order = def_order.reject {|field| !node.include?(field)}
205
+ var_order = def_order.reject { |field| !node.include?(field) }
206
206
  node.keys.each do |key|
207
207
  if REPORT_DEFINITION_ORDER.include?(key)
208
208
  case node[key]
@@ -21,8 +21,9 @@
21
21
 
22
22
  module AdwordsApi
23
23
  module Utils
24
+
24
25
  # Gets a map from an array of map entries. A map entry is any object that
25
- # has a key and value field.
26
+ # has a key and value hash fields.
26
27
  #
27
28
  # Args:
28
29
  # - entries: list of map entries
@@ -21,6 +21,6 @@
21
21
 
22
22
  module AdwordsApi
23
23
  module ApiConfig
24
- CLIENT_LIB_VERSION = '0.6.1'
24
+ CLIENT_LIB_VERSION = '0.6.2'
25
25
  end
26
26
  end
@@ -57,13 +57,13 @@ GZIPPED_REPORT = "\x1F\x8B\b\x00\x00\x00\x00\x00\x00\x00Sr.-.\xC9\xCFUptq\x0F\xF
57
57
 
58
58
  class TestReportUtils < Test::Unit::TestCase
59
59
  # Initialize tests.
60
- def setup
60
+ def setup()
61
61
  @api = AdwordsApi::Api.new
62
62
  @report_utils = @api.report_utils(API_VERSION)
63
63
  end
64
64
 
65
65
  # Testing HTTP code 400.
66
- def test_check_for_errors_400
66
+ def test_check_for_errors_400()
67
67
  REPLY_TYPES.each do |reply_type|
68
68
  begin
69
69
  response = ResponseStub.new(400, reply_type[:reply])
@@ -77,7 +77,7 @@ class TestReportUtils < Test::Unit::TestCase
77
77
  end
78
78
 
79
79
  # Testing HTTP code 500.
80
- def test_check_for_errors_500
80
+ def test_check_for_errors_500()
81
81
  REPLY_TYPES.each do |reply_type|
82
82
  begin
83
83
  response = ResponseStub.new(500, nil)
@@ -90,7 +90,7 @@ class TestReportUtils < Test::Unit::TestCase
90
90
  end
91
91
 
92
92
  # Testing HTTP code 200 with success.
93
- def test_check_for_errors_200_success
93
+ def test_check_for_errors_200_success()
94
94
  response = ResponseStub.new(200, VALID_REPORT)
95
95
  assert_nothing_raised do
96
96
  @report_utils.check_for_errors(response)
@@ -98,7 +98,7 @@ class TestReportUtils < Test::Unit::TestCase
98
98
  end
99
99
 
100
100
  # Testing HTTP code 200 with failure.
101
- def test_check_for_errors_200_success
101
+ def test_check_for_errors_200_success()
102
102
  REPLY_TYPES.each do |reply_type|
103
103
  begin
104
104
  response = ResponseStub.new(200, reply_type[:reply])
@@ -112,7 +112,7 @@ class TestReportUtils < Test::Unit::TestCase
112
112
  end
113
113
 
114
114
  # Testing correct gzipped reply.
115
- def test_gzipped_data
115
+ def test_gzipped_data()
116
116
  report = (RUBY_VERSION >= '1.9.1') ?
117
117
  GZIPPED_REPORT.force_encoding('UTF-8') : GZIPPED_REPORT
118
118
  response = ResponseStub.new(200, report)
@@ -122,7 +122,7 @@ class TestReportUtils < Test::Unit::TestCase
122
122
  end
123
123
 
124
124
  # Tests generated hash order for root (complete set).
125
- def test_add_report_definition_hash_order_root1
125
+ def test_add_report_definition_hash_order_root1()
126
126
  node = {
127
127
  :include_zero_impressions => false,
128
128
  :download_format => 'CSV',
@@ -139,7 +139,7 @@ class TestReportUtils < Test::Unit::TestCase
139
139
  end
140
140
 
141
141
  # Tests generated hash order for root (incomplete set).
142
- def test_add_report_definition_hash_order_root2
142
+ def test_add_report_definition_hash_order_root2()
143
143
  node = {
144
144
  :download_format => 'CSV',
145
145
  :report_type => 'CRITERIA_PERFORMANCE_REPORT',
@@ -155,7 +155,7 @@ class TestReportUtils < Test::Unit::TestCase
155
155
  end
156
156
 
157
157
  # Tests generated hash order for whole structure.
158
- def test_add_report_definition_hash_order_deep
158
+ def test_add_report_definition_hash_order_deep()
159
159
  node = {
160
160
  :report_name => 'report_name',
161
161
  :report_type => 'CRITERIA_PERFORMANCE_REPORT',
@@ -25,7 +25,8 @@ require 'test/unit'
25
25
  require 'adwords_api/utils'
26
26
 
27
27
  class TestUtils < Test::Unit::TestCase
28
- def test_map
28
+
29
+ def test_map()
29
30
  param1 = [
30
31
  {:key => 'foo', :value => 'bar'},
31
32
  {:key => 'baz', :value => 'zar'},
@@ -38,7 +39,7 @@ class TestUtils < Test::Unit::TestCase
38
39
  assert_equal(result2, AdwordsApi::Utils::map(param2))
39
40
  end
40
41
 
41
- def test_operation_index_for_error
42
+ def test_operation_index_for_error()
42
43
  error1 = {:field_path => 'operations[0].operand.adGroupId'}
43
44
  assert_equal(0, AdwordsApi::Utils::operation_index_for_error(error1))
44
45
 
@@ -49,7 +50,7 @@ class TestUtils < Test::Unit::TestCase
49
50
  assert_equal(nil, AdwordsApi::Utils::operation_index_for_error(error3))
50
51
  end
51
52
 
52
- def test_format_id
53
+ def test_format_id()
53
54
  assert_equal('123-456-7890', AdwordsApi::Utils::format_id(1234567890))
54
55
  assert_equal('234-567-8901', AdwordsApi::Utils::format_id('2345678901'))
55
56
  assert_equal('345-678-9012', AdwordsApi::Utils::format_id('345-678-9012'))
@@ -28,8 +28,9 @@ require 'adwords_api'
28
28
  require 'adwords_api/v201109/targeting_idea_service_registry'
29
29
 
30
30
  class TestIssue31 < Test::Unit::TestCase
31
- def setup
32
- @registry = AdwordsApi::V201109::TargetingIdeaService::TargetingIdeaServiceRegistry
31
+ def setup()
32
+ @registry =
33
+ AdwordsApi::V201109::TargetingIdeaService::TargetingIdeaServiceRegistry
33
34
  end
34
35
 
35
36
  def run_test(selector)
@@ -38,7 +39,7 @@ class TestIssue31 < Test::Unit::TestCase
38
39
  return Gyoku.xml(result_hash)
39
40
  end
40
41
 
41
- def test_issue_31_single_xsi_type
42
+ def test_issue_31_single_xsi_type()
42
43
  selector = {
43
44
  :search_parameters => [
44
45
  {:xsi_type => 'KeywordMatchTypeSearchParameter',
@@ -52,7 +53,7 @@ class TestIssue31 < Test::Unit::TestCase
52
53
  'KeywordMatchTypeSearchParameter')
53
54
  end
54
55
 
55
- def test_issue_31_multiple_xsi_types
56
+ def test_issue_31_multiple_xsi_types()
56
57
  selector = {
57
58
  :search_parameters => [
58
59
  {:xsi_type => 'AverageTargetedMonthlySearchesSearchParameter',
@@ -29,7 +29,7 @@ require 'adwords_api'
29
29
  require 'adwords_api/v201109_1/mutate_job_service_registry'
30
30
 
31
31
  class TestIssue63 < Test::Unit::TestCase
32
- def setup
32
+ def setup()
33
33
  @registry =
34
34
  AdwordsApi::V201109_1::MutateJobService::MutateJobServiceRegistry
35
35
  end
@@ -40,21 +40,21 @@ class TestIssue63 < Test::Unit::TestCase
40
40
  return extractor.extract_result(data, :get_result)
41
41
  end
42
42
 
43
- def test_issue_63_single_mutate_error
43
+ def test_issue_63_single_mutate_error()
44
44
  result = run_test(single_error_xml)
45
45
  errors = result[:simple_mutate_result][:errors]
46
46
  assert_kind_of(Array, errors)
47
47
  assert_equal(1, errors.size)
48
48
  end
49
49
 
50
- def test_issue_63_multiple_mutate_errors
50
+ def test_issue_63_multiple_mutate_errors()
51
51
  result = run_test(multiple_errors_xml)
52
52
  errors = result[:simple_mutate_result][:errors]
53
53
  assert_kind_of(Array, errors)
54
54
  assert_equal(2, errors.size)
55
55
  end
56
56
 
57
- def single_error_xml
57
+ def single_error_xml()
58
58
  return <<EOT
59
59
  <?xml version="1.0"?>
60
60
  <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
@@ -27,8 +27,8 @@ $:.unshift File.expand_path('../../', __FILE__)
27
27
 
28
28
  # AdWords API units tests.
29
29
  adwords_mask = File.join(File.dirname(__FILE__), 'adwords_api', 'test_*.rb')
30
- Dir.glob(adwords_mask).each {|file| require file}
30
+ Dir.glob(adwords_mask).each { |file| require file }
31
31
 
32
32
  # Reported bugs tests.
33
33
  bugs_mask = File.join(File.dirname(__FILE__), 'bugs', 'test_*.rb')
34
- Dir.glob(bugs_mask).each {|file| require file}
34
+ Dir.glob(bugs_mask).each { |file| require file }
metadata CHANGED
@@ -1,159 +1,48 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: google-adwords-api
3
- version: !ruby/object:Gem::Version
4
- version: 0.6.1
3
+ version: !ruby/object:Gem::Version
4
+ hash: 3
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 6
9
+ - 2
10
+ version: 0.6.2
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Danial Klimkin
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-06-06 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: savon
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 0.9.9
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: 0.9.9
30
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-06-21 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
31
21
  name: google-ads-common
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: 0.7.1
38
- type: :runtime
39
22
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
41
24
  none: false
42
- requirements:
25
+ requirements:
43
26
  - - ~>
44
- - !ruby/object:Gem::Version
45
- version: 0.7.1
27
+ - !ruby/object:Gem::Version
28
+ hash: 5
29
+ segments:
30
+ - 0
31
+ - 7
32
+ - 3
33
+ version: 0.7.3
34
+ type: :runtime
35
+ version_requirements: *id001
46
36
  description: google-adwords-api is a AdWords API client library for Ruby
47
- email:
37
+ email:
48
38
  - api.dklimkin@gmail.com
49
39
  executables: []
40
+
50
41
  extensions: []
42
+
51
43
  extra_rdoc_files: []
52
- files:
53
- - examples/v201109_1/reporting/download_criteria_report.rb
54
- - examples/v201109_1/reporting/get_defined_reports.rb
55
- - examples/v201109_1/reporting/get_campaign_stats.rb
56
- - examples/v201109_1/reporting/parallel_report_download.rb
57
- - examples/v201109_1/reporting/get_report_fields.rb
58
- - examples/v201109_1/error_handling/handle_policy_violation_error.rb
59
- - examples/v201109_1/error_handling/handle_two_factor_authorization_error.rb
60
- - examples/v201109_1/error_handling/handle_captcha_challenge.rb
61
- - examples/v201109_1/error_handling/handle_partial_failures.rb
62
- - examples/v201109_1/targeting/lookup_location.rb
63
- - examples/v201109_1/targeting/get_targetable_languages_and_carriers.rb
64
- - examples/v201109_1/targeting/add_campaign_targeting_criteria.rb
65
- - examples/v201109_1/targeting/get_campaign_targeting_criteria.rb
66
- - examples/v201109_1/campaign_management/validate_text_ad.rb
67
- - examples/v201109_1/campaign_management/add_experiment.rb
68
- - examples/v201109_1/campaign_management/set_ad_parameters.rb
69
- - examples/v201109_1/campaign_management/add_location_extension.rb
70
- - examples/v201109_1/campaign_management/add_keywords_in_bulk.rb
71
- - examples/v201109_1/campaign_management/promote_experiment.rb
72
- - examples/v201109_1/campaign_management/get_all_disapproved_ads.rb
73
- - examples/v201109_1/campaign_management/add_location_extension_override.rb
74
- - examples/v201109_1/account_management/get_account_hierarchy.rb
75
- - examples/v201109_1/account_management/get_account_changes.rb
76
- - examples/v201109_1/account_management/get_client_unit_usage.rb
77
- - examples/v201109_1/account_management/get_client_customer_id.rb
78
- - examples/v201109_1/account_management/get_account_alerts.rb
79
- - examples/v201109_1/account_management/create_account.rb
80
- - examples/v201109_1/optimization/estimate_keyword_traffic.rb
81
- - examples/v201109_1/optimization/get_keyword_bid_simulations.rb
82
- - examples/v201109_1/optimization/get_keyword_ideas.rb
83
- - examples/v201109_1/optimization/get_placement_ideas.rb
84
- - examples/v201109_1/basic_operations/update_campaign.rb
85
- - examples/v201109_1/basic_operations/get_campaigns.rb
86
- - examples/v201109_1/basic_operations/get_ad_groups.rb
87
- - examples/v201109_1/basic_operations/add_campaigns.rb
88
- - examples/v201109_1/basic_operations/delete_ad_group.rb
89
- - examples/v201109_1/basic_operations/delete_keyword.rb
90
- - examples/v201109_1/basic_operations/delete_ad.rb
91
- - examples/v201109_1/basic_operations/add_ad_groups.rb
92
- - examples/v201109_1/basic_operations/update_ad_group.rb
93
- - examples/v201109_1/basic_operations/get_keywords.rb
94
- - examples/v201109_1/basic_operations/delete_campaign.rb
95
- - examples/v201109_1/basic_operations/get_text_ads.rb
96
- - examples/v201109_1/basic_operations/add_keywords.rb
97
- - examples/v201109_1/basic_operations/add_text_ads.rb
98
- - examples/v201109_1/basic_operations/pause_ad.rb
99
- - examples/v201109_1/basic_operations/update_keyword.rb
100
- - examples/v201109_1/misc/upload_image.rb
101
- - examples/v201109_1/misc/get_all_images_and_videos.rb
102
- - examples/v201109_1/misc/use_oauth.rb
103
- - examples/v201109_1/remarketing/add_conversion_tracker.rb
104
- - examples/v201109_1/remarketing/add_audience.rb
105
- - examples/v201109/reporting/download_criteria_report.rb
106
- - examples/v201109/reporting/get_defined_reports.rb
107
- - examples/v201109/reporting/get_campaign_stats.rb
108
- - examples/v201109/reporting/parallel_report_download.rb
109
- - examples/v201109/reporting/get_report_fields.rb
110
- - examples/v201109/error_handling/handle_policy_violation_error.rb
111
- - examples/v201109/error_handling/handle_two_factor_authorization_error.rb
112
- - examples/v201109/error_handling/handle_captcha_challenge.rb
113
- - examples/v201109/error_handling/handle_partial_failures.rb
114
- - examples/v201109/targeting/lookup_location.rb
115
- - examples/v201109/targeting/get_targetable_languages_and_carriers.rb
116
- - examples/v201109/targeting/add_campaign_targeting_criteria.rb
117
- - examples/v201109/targeting/get_campaign_targeting_criteria.rb
118
- - examples/v201109/campaign_management/validate_text_ad.rb
119
- - examples/v201109/campaign_management/add_experiment.rb
120
- - examples/v201109/campaign_management/set_ad_parameters.rb
121
- - examples/v201109/campaign_management/add_location_extension.rb
122
- - examples/v201109/campaign_management/add_keywords_in_bulk.rb
123
- - examples/v201109/campaign_management/promote_experiment.rb
124
- - examples/v201109/campaign_management/get_all_disapproved_ads.rb
125
- - examples/v201109/campaign_management/add_location_extension_override.rb
126
- - examples/v201109/account_management/get_account_hierarchy.rb
127
- - examples/v201109/account_management/get_account_changes.rb
128
- - examples/v201109/account_management/get_client_unit_usage.rb
129
- - examples/v201109/account_management/get_client_customer_id.rb
130
- - examples/v201109/account_management/get_account_alerts.rb
131
- - examples/v201109/account_management/create_account.rb
132
- - examples/v201109/optimization/estimate_keyword_traffic.rb
133
- - examples/v201109/optimization/get_keyword_bid_simulations.rb
134
- - examples/v201109/optimization/get_keyword_ideas.rb
135
- - examples/v201109/optimization/get_placement_ideas.rb
136
- - examples/v201109/basic_operations/update_campaign.rb
137
- - examples/v201109/basic_operations/get_campaigns.rb
138
- - examples/v201109/basic_operations/get_ad_groups.rb
139
- - examples/v201109/basic_operations/add_campaigns.rb
140
- - examples/v201109/basic_operations/delete_ad_group.rb
141
- - examples/v201109/basic_operations/delete_keyword.rb
142
- - examples/v201109/basic_operations/delete_ad.rb
143
- - examples/v201109/basic_operations/add_ad_groups.rb
144
- - examples/v201109/basic_operations/update_ad_group.rb
145
- - examples/v201109/basic_operations/get_keywords.rb
146
- - examples/v201109/basic_operations/delete_campaign.rb
147
- - examples/v201109/basic_operations/get_text_ads.rb
148
- - examples/v201109/basic_operations/add_keywords.rb
149
- - examples/v201109/basic_operations/add_text_ads.rb
150
- - examples/v201109/basic_operations/pause_ad.rb
151
- - examples/v201109/basic_operations/update_keyword.rb
152
- - examples/v201109/misc/upload_image.rb
153
- - examples/v201109/misc/get_all_images_and_videos.rb
154
- - examples/v201109/misc/use_oauth.rb
155
- - examples/v201109/remarketing/add_conversion_tracker.rb
156
- - examples/v201109/remarketing/add_audience.rb
44
+
45
+ files:
157
46
  - lib/adwords_api/utils.rb
158
47
  - lib/adwords_api/version.rb
159
48
  - lib/adwords_api/report_utils.rb
@@ -306,33 +195,150 @@ files:
306
195
  - test/adwords_api/test_credential_handler.rb
307
196
  - test/adwords_api/test_api_config.rb
308
197
  - test/adwords_api/test_utils.rb
198
+ - examples/v201109_1/reporting/download_criteria_report.rb
199
+ - examples/v201109_1/reporting/get_defined_reports.rb
200
+ - examples/v201109_1/reporting/get_campaign_stats.rb
201
+ - examples/v201109_1/reporting/parallel_report_download.rb
202
+ - examples/v201109_1/reporting/get_report_fields.rb
203
+ - examples/v201109_1/error_handling/handle_policy_violation_error.rb
204
+ - examples/v201109_1/error_handling/handle_two_factor_authorization_error.rb
205
+ - examples/v201109_1/error_handling/handle_captcha_challenge.rb
206
+ - examples/v201109_1/error_handling/handle_partial_failures.rb
207
+ - examples/v201109_1/targeting/lookup_location.rb
208
+ - examples/v201109_1/targeting/get_targetable_languages_and_carriers.rb
209
+ - examples/v201109_1/targeting/add_campaign_targeting_criteria.rb
210
+ - examples/v201109_1/targeting/get_campaign_targeting_criteria.rb
211
+ - examples/v201109_1/campaign_management/validate_text_ad.rb
212
+ - examples/v201109_1/campaign_management/add_experiment.rb
213
+ - examples/v201109_1/campaign_management/set_ad_parameters.rb
214
+ - examples/v201109_1/campaign_management/add_location_extension.rb
215
+ - examples/v201109_1/campaign_management/add_keywords_in_bulk.rb
216
+ - examples/v201109_1/campaign_management/promote_experiment.rb
217
+ - examples/v201109_1/campaign_management/get_all_disapproved_ads.rb
218
+ - examples/v201109_1/campaign_management/add_location_extension_override.rb
219
+ - examples/v201109_1/account_management/get_account_hierarchy.rb
220
+ - examples/v201109_1/account_management/get_account_changes.rb
221
+ - examples/v201109_1/account_management/get_client_unit_usage.rb
222
+ - examples/v201109_1/account_management/get_client_customer_id.rb
223
+ - examples/v201109_1/account_management/get_account_alerts.rb
224
+ - examples/v201109_1/account_management/create_account.rb
225
+ - examples/v201109_1/optimization/estimate_keyword_traffic.rb
226
+ - examples/v201109_1/optimization/get_keyword_bid_simulations.rb
227
+ - examples/v201109_1/optimization/get_keyword_ideas.rb
228
+ - examples/v201109_1/optimization/get_placement_ideas.rb
229
+ - examples/v201109_1/basic_operations/update_campaign.rb
230
+ - examples/v201109_1/basic_operations/get_campaigns.rb
231
+ - examples/v201109_1/basic_operations/get_ad_groups.rb
232
+ - examples/v201109_1/basic_operations/add_campaigns.rb
233
+ - examples/v201109_1/basic_operations/delete_ad_group.rb
234
+ - examples/v201109_1/basic_operations/delete_keyword.rb
235
+ - examples/v201109_1/basic_operations/delete_ad.rb
236
+ - examples/v201109_1/basic_operations/add_ad_groups.rb
237
+ - examples/v201109_1/basic_operations/update_ad_group.rb
238
+ - examples/v201109_1/basic_operations/get_keywords.rb
239
+ - examples/v201109_1/basic_operations/delete_campaign.rb
240
+ - examples/v201109_1/basic_operations/get_text_ads.rb
241
+ - examples/v201109_1/basic_operations/add_keywords.rb
242
+ - examples/v201109_1/basic_operations/add_text_ads.rb
243
+ - examples/v201109_1/basic_operations/pause_ad.rb
244
+ - examples/v201109_1/basic_operations/update_keyword.rb
245
+ - examples/v201109_1/misc/upload_image.rb
246
+ - examples/v201109_1/misc/get_all_images_and_videos.rb
247
+ - examples/v201109_1/misc/use_oauth.rb
248
+ - examples/v201109_1/misc/use_oauth2.rb
249
+ - examples/v201109_1/remarketing/add_conversion_tracker.rb
250
+ - examples/v201109_1/remarketing/add_audience.rb
251
+ - examples/v201109/reporting/download_criteria_report.rb
252
+ - examples/v201109/reporting/get_defined_reports.rb
253
+ - examples/v201109/reporting/get_campaign_stats.rb
254
+ - examples/v201109/reporting/parallel_report_download.rb
255
+ - examples/v201109/reporting/get_report_fields.rb
256
+ - examples/v201109/error_handling/handle_policy_violation_error.rb
257
+ - examples/v201109/error_handling/handle_two_factor_authorization_error.rb
258
+ - examples/v201109/error_handling/handle_captcha_challenge.rb
259
+ - examples/v201109/error_handling/handle_partial_failures.rb
260
+ - examples/v201109/targeting/lookup_location.rb
261
+ - examples/v201109/targeting/get_targetable_languages_and_carriers.rb
262
+ - examples/v201109/targeting/add_campaign_targeting_criteria.rb
263
+ - examples/v201109/targeting/get_campaign_targeting_criteria.rb
264
+ - examples/v201109/campaign_management/validate_text_ad.rb
265
+ - examples/v201109/campaign_management/add_experiment.rb
266
+ - examples/v201109/campaign_management/set_ad_parameters.rb
267
+ - examples/v201109/campaign_management/add_location_extension.rb
268
+ - examples/v201109/campaign_management/add_keywords_in_bulk.rb
269
+ - examples/v201109/campaign_management/promote_experiment.rb
270
+ - examples/v201109/campaign_management/get_all_disapproved_ads.rb
271
+ - examples/v201109/campaign_management/add_location_extension_override.rb
272
+ - examples/v201109/account_management/get_account_hierarchy.rb
273
+ - examples/v201109/account_management/get_account_changes.rb
274
+ - examples/v201109/account_management/get_client_unit_usage.rb
275
+ - examples/v201109/account_management/get_client_customer_id.rb
276
+ - examples/v201109/account_management/get_account_alerts.rb
277
+ - examples/v201109/account_management/create_account.rb
278
+ - examples/v201109/optimization/estimate_keyword_traffic.rb
279
+ - examples/v201109/optimization/get_keyword_bid_simulations.rb
280
+ - examples/v201109/optimization/get_keyword_ideas.rb
281
+ - examples/v201109/optimization/get_placement_ideas.rb
282
+ - examples/v201109/basic_operations/update_campaign.rb
283
+ - examples/v201109/basic_operations/get_campaigns.rb
284
+ - examples/v201109/basic_operations/get_ad_groups.rb
285
+ - examples/v201109/basic_operations/add_campaigns.rb
286
+ - examples/v201109/basic_operations/delete_ad_group.rb
287
+ - examples/v201109/basic_operations/delete_keyword.rb
288
+ - examples/v201109/basic_operations/delete_ad.rb
289
+ - examples/v201109/basic_operations/add_ad_groups.rb
290
+ - examples/v201109/basic_operations/update_ad_group.rb
291
+ - examples/v201109/basic_operations/get_keywords.rb
292
+ - examples/v201109/basic_operations/delete_campaign.rb
293
+ - examples/v201109/basic_operations/get_text_ads.rb
294
+ - examples/v201109/basic_operations/add_keywords.rb
295
+ - examples/v201109/basic_operations/add_text_ads.rb
296
+ - examples/v201109/basic_operations/pause_ad.rb
297
+ - examples/v201109/basic_operations/update_keyword.rb
298
+ - examples/v201109/misc/upload_image.rb
299
+ - examples/v201109/misc/get_all_images_and_videos.rb
300
+ - examples/v201109/misc/use_oauth.rb
301
+ - examples/v201109/misc/use_oauth2.rb
302
+ - examples/v201109/remarketing/add_conversion_tracker.rb
303
+ - examples/v201109/remarketing/add_audience.rb
309
304
  - COPYING
310
305
  - README
311
306
  - ChangeLog
312
307
  - adwords_api.yml
313
308
  homepage: http://code.google.com/p/google-api-ads-ruby/
314
309
  licenses: []
310
+
315
311
  post_install_message:
316
312
  rdoc_options: []
317
- require_paths:
313
+
314
+ require_paths:
318
315
  - lib
319
- required_ruby_version: !ruby/object:Gem::Requirement
316
+ required_ruby_version: !ruby/object:Gem::Requirement
320
317
  none: false
321
- requirements:
322
- - - ! '>='
323
- - !ruby/object:Gem::Version
324
- version: '0'
325
- required_rubygems_version: !ruby/object:Gem::Requirement
318
+ requirements:
319
+ - - ">="
320
+ - !ruby/object:Gem::Version
321
+ hash: 3
322
+ segments:
323
+ - 0
324
+ version: "0"
325
+ required_rubygems_version: !ruby/object:Gem::Requirement
326
326
  none: false
327
- requirements:
328
- - - ! '>='
329
- - !ruby/object:Gem::Version
327
+ requirements:
328
+ - - ">="
329
+ - !ruby/object:Gem::Version
330
+ hash: 23
331
+ segments:
332
+ - 1
333
+ - 3
334
+ - 6
330
335
  version: 1.3.6
331
336
  requirements: []
337
+
332
338
  rubyforge_project: google-adwords-api
333
339
  rubygems_version: 1.8.24
334
340
  signing_key:
335
341
  specification_version: 3
336
342
  summary: Ruby Client libraries for AdWords API
337
- test_files:
343
+ test_files:
338
344
  - test/suite_unittests.rb