google-ads-common 0.11.1 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aca8bb491bb1979f93711715859c97790db6fdf9
4
- data.tar.gz: 78ffbb5fa2fbda4985340f38a8ad9632756e5ce9
3
+ metadata.gz: 10caed5a26897a25b34a734be2e882529abc2441
4
+ data.tar.gz: f6e2f2cc9495b2998e84a4a1e47e3934a354f161
5
5
  SHA512:
6
- metadata.gz: 2a2daef0667e200028665475490329dfe8cba0b90d737d9b07ef77819e42922d0f2a30fb5243192ae259137fefb53f8c3e40f95906db823740bd766a14bf7f39
7
- data.tar.gz: 96ec439dbabb8ad81b4085460f2329e8d6ecebb8635fe0103471dc892423277d32dd3a5086aea4e3f724cb46a443fe373609f19cf94e54669dc294d397aaf909
6
+ metadata.gz: 31cafd81ea5bb9e67fef47cc9f407d86b1a6e14affc28e1afadf51ca172dd9ffd353d7082bee6ddbd1992332a12d9116957fdf939b784a38cb50b162a66c9ecf
7
+ data.tar.gz: 3aa55e15e0253bcf914a231bedb054171bc1f99148ab45b6f21bad8ec6b89df94a66b6ba21bbe89f3d9628d3f2d987f87fe0d73bc941c369075ab57e5e34f94f
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ 0.11.2:
2
+ - Updated required version of ads_savon to 1.0.1 to fix issue #74.
3
+ - Updated default adapter for httpi to httpclient, to fix various errors
4
+ with parsing responses.
5
+
1
6
  0.11.1:
2
7
  - Added streaming get and post options to AdsCommon::Http.
3
8
  - Added ability to support put requests to AdsCommon::Http.
data/README.md CHANGED
@@ -21,6 +21,7 @@ The following gem libraries are required:
21
21
 
22
22
  - google-ads-savon
23
23
  - httpi
24
+ - httpclient
24
25
  - signet
25
26
 
26
27
 
@@ -263,6 +263,10 @@ module AdsCommon
263
263
  self.logger = (provided_logger.nil?) ?
264
264
  create_default_logger() : provided_logger
265
265
 
266
+ # Set up default HTTPI adapter.
267
+ provided_adapter = @config.read('connection.adapter')
268
+ @config.set('connection.adapter', :httpclient) if provided_adapter.nil?
269
+
266
270
  # Validating most important parameters.
267
271
  ['service.environment', 'authentication.method'].each do |parameter|
268
272
  symbolize_config_value(parameter)
@@ -209,13 +209,14 @@ module AdsCommon
209
209
  def get_wsdls(version)
210
210
  res = {}
211
211
  wsdl_base = get_wsdl_base(default_environment(), version)
212
+ postfix = wsdl_base.start_with?('http') ? '?wsdl' : '.wsdl'
212
213
  services(version).each do |service|
213
214
  path = wsdl_base
214
215
  if (!subdir_config().nil?)
215
216
  subdir_name = subdir(version, service);
216
217
  path = path + subdir_name if subdir_name and !subdir_name.empty?
217
218
  end
218
- path = path + version.to_s + '/' + service.to_s + '?wsdl'
219
+ path = path + version.to_s + '/' + service.to_s + postfix
219
220
  res[service.to_s] = path
220
221
  end
221
222
  return res
@@ -68,7 +68,10 @@ module AdsCommon
68
68
  # Returns:
69
69
  # - none
70
70
  def process_wsdl()
71
- client = GoogleAdsSavon::Client.new(@wsdl_url)
71
+ proxy_path = get_proxy_path()
72
+ client = GoogleAdsSavon::Client.new(@wsdl_url) do |_, httpi|
73
+ httpi.proxy = proxy_path unless proxy_path.nil? || proxy_path.empty?
74
+ end
72
75
  begin
73
76
  @generator_args[:namespace] = client.wsdl.namespace
74
77
  do_process_wsdl_client(client)
@@ -137,6 +140,10 @@ module AdsCommon
137
140
  dir_name = File.dirname(path)
138
141
  Dir.mkdir(dir_name) if !File.directory?(dir_name)
139
142
  end
143
+
144
+ def get_proxy_path()
145
+ return ENV['ADSAPI_PROXY']
146
+ end
140
147
  end
141
148
  end
142
149
  end
@@ -29,7 +29,7 @@ module AdsCommon
29
29
  #
30
30
  # This is auto-generated code, changes will be overwritten.
31
31
  #
32
- # Copyright:: Copyright 2015, Google Inc. All Rights Reserved.
32
+ # Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
33
33
  # License:: Licensed under the Apache License, Version 2.0.
34
34
  #
35
35
  # <%= @generator_stamp %>
@@ -29,7 +29,7 @@ module AdsCommon
29
29
  #
30
30
  # This is auto-generated code, changes will be overwritten.
31
31
  #
32
- # Copyright:: Copyright 2015, Google Inc. All Rights Reserved.
32
+ # Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
33
33
  # License:: Licensed under the Apache License, Version 2.0.
34
34
  #
35
35
  # <%= @generator_stamp %>
@@ -19,6 +19,6 @@
19
19
 
20
20
  module AdsCommon
21
21
  module ApiConfig
22
- CLIENT_LIB_VERSION = '0.11.1'
22
+ CLIENT_LIB_VERSION = '0.11.2'
23
23
  end
24
24
  end
data/test/test_env.rb ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
3
+ #
4
+ # Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
5
+ #
6
+ # License:: Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15
+ # implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ # Tests environment is correct.
20
+
21
+ require 'openssl'
22
+ require 'test/unit'
23
+
24
+ class TestEnv < Test::Unit::TestCase
25
+
26
+ # Output ruby interpreter version to the tests log.
27
+ def test_ruby_version
28
+ puts "\nRunning tests with %s-%s-%s.\n" %
29
+ [RUBY_ENGINE, RUBY_VERSION, RUBY_PATCHLEVEL]
30
+ end
31
+
32
+ # Output SSL version to the tests log. There is a known issue with this
33
+ # required property not defined in some JRuby implementations.
34
+ def test_openssl_version
35
+ puts "\nUsing OpenSSL %s with %d methods.\n" %
36
+ [OpenSSL::OPENSSL_VERSION, OpenSSL::SSL::SSLContext::METHODS.count]
37
+ end
38
+ end
@@ -21,11 +21,14 @@
21
21
  require 'time'
22
22
 
23
23
  require 'ads_common/auth/oauth2_handler'
24
+ require 'ads_common/config'
24
25
  require 'webmock/test_unit'
25
26
 
26
27
  module AdsCommon
27
28
  module Auth
28
29
  class OAuth2Handler
30
+ attr_reader :scopes
31
+
29
32
  def client()
30
33
  @client
31
34
  end
@@ -56,7 +59,7 @@ class TestOAuth < Test::Unit::TestCase
56
59
  end
57
60
 
58
61
  def test_string_issued_at()
59
- handler = AdsCommon::Auth::OAuth2Handler.new('', {})
62
+ handler = AdsCommon::Auth::OAuth2Handler.new(AdsCommon::Config.new(), nil)
60
63
 
61
64
  # Modify @client in the handler to get around a full setup.
62
65
  handler.setup_client()
@@ -69,4 +72,13 @@ class TestOAuth < Test::Unit::TestCase
69
72
  token = handler.refresh_token!();
70
73
  end
71
74
  end
75
+
76
+ def test_additional_scopes()
77
+ config = AdsCommon::Config.new()
78
+ config.set('authentication.oauth2_extra_scopes', ['extra-scope'])
79
+ handler = AdsCommon::Auth::OAuth2Handler.new(config, 'base-scope')
80
+ scopes = handler.scopes
81
+ assert(scopes.include?('base-scope'), 'Missing base scope.')
82
+ assert(scopes.include?('extra-scope'), 'Missing extra scope.')
83
+ end
72
84
  end
@@ -20,6 +20,10 @@
20
20
 
21
21
  require 'test/unit'
22
22
 
23
+ # Work around jruby <= 1.7.8 issue with OpenSSL definition.
24
+ require 'openssl'
25
+ OpenSSL::SSL::SSLContext::METHODS = []
26
+
23
27
  require 'ads_common/config'
24
28
  require 'ads_common/savon_service'
25
29
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-ads-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Gomes
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-11-11 00:00:00.000000000 Z
13
+ date: 2016-02-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: google-ads-savon
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: 1.0.0
21
+ version: 1.0.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: 1.0.0
28
+ version: 1.0.1
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: httpi
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -40,6 +40,20 @@ dependencies:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '2.3'
43
+ - !ruby/object:Gem::Dependency
44
+ name: httpclient
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '2.7'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '2.7'
43
57
  - !ruby/object:Gem::Dependency
44
58
  name: signet
45
59
  requirement: !ruby/object:Gem::Requirement
@@ -104,6 +118,7 @@ files:
104
118
  - test/test_config.rb
105
119
  - test/test_config.yml
106
120
  - test/test_credential_handler.rb
121
+ - test/test_env.rb
107
122
  - test/test_oauth2_handler.rb
108
123
  - test/test_parameters_validator.rb
109
124
  - test/test_results_extractor.rb
@@ -140,4 +155,5 @@ test_files:
140
155
  - test/test_utils.rb
141
156
  - test/test_parameters_validator.rb
142
157
  - test/test_oauth2_handler.rb
158
+ - test/test_env.rb
143
159
  - test/test_results_extractor.rb