google-ads-common 0.10.1 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDliZjJiZGQzMGJjMTUyMGU0ODc3MGNkZDlhZjRjZWNjZDYzZGRjMA==
5
+ data.tar.gz: !binary |-
6
+ OTVmZjM4ZGQxZGU5M2RlMTYxZTZjZGQzMTA5ODkwYWM1NzNmNjY3ZA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MTRmMWZiZTg2OTBmZmNlZThiM2RiZWNjZjE3ZDA0YWJiMmE5ZTYxMzkyMWVh
10
+ YjcyZmI2OGM5MjdlOTNkMzc1ZmFiOGI1MDQ0ZTViMTYyYzY5OTBiNTMxODcy
11
+ YWIwODViYTFjZGExMzgyYzIzYTdmNzJlMTk0OGU2ZjM3N2IwOWU=
12
+ data.tar.gz: !binary |-
13
+ NzJkZTkxZWRkZmM1MGZlMTlhZmIzZmE3ZTM2OWE1YWJlODc0NzIxODEyMGI1
14
+ ZGQ3ODBiODVjZWY0NGE2OTQxNjUwN2U5MmI1MzYyOTQzZmE1MzcwMzZiNmY3
15
+ NzNmODIyYTY4NDJjMWZiYzcxZDU3NmQxZTI5MmRhZjIzMGJlN2U=
data/ChangeLog CHANGED
@@ -1,3 +1,11 @@
1
+ 0.11.0:
2
+ - Updated to use 'ads_savon' library over 'savon'.
3
+ - Add support for services to return SOAP XML without making a request. This
4
+ requires stub regeneration in the specific libraries.
5
+ - Updated httpi dependency to version 2.3.
6
+ - Updated http to follow redirects by default, to allow use of
7
+ AdsCommon::Http for fetching web resources that require redirects.
8
+
1
9
  0.10.1:
2
10
  - General file cleanup.
3
11
  - Fix the OAUTH2_SERVICE_ACCOUNT constant in ads_common.
data/README.md CHANGED
@@ -19,7 +19,7 @@ Install it using the gem install command.
19
19
 
20
20
  The following gem libraries are required:
21
21
 
22
- - savon
22
+ - google-ads-savon
23
23
  - httpi
24
24
  - signet
25
25
 
@@ -82,7 +82,7 @@ module AdsCommon
82
82
 
83
83
  # Refreshes access token from refresh token.
84
84
  def refresh_token!()
85
- return nil if @token.nil? or @token[:refresh_token].nil?
85
+ return nil if @token.nil?
86
86
  @client.refresh!
87
87
  @token = token_from_client(@client)
88
88
  return @token
@@ -17,7 +17,7 @@
17
17
  #
18
18
  # Code template generator base class
19
19
 
20
- require 'savon'
20
+ require 'ads_savon'
21
21
  require 'erb'
22
22
 
23
23
  module AdsCommon
@@ -18,7 +18,7 @@
18
18
  # Generates the wrappers for API services. Only used during the
19
19
  # 'rake generate' step of library setup.
20
20
 
21
- require 'savon'
21
+ require 'ads_savon'
22
22
 
23
23
  require 'ads_common/build/savon_service_generator'
24
24
  require 'ads_common/build/savon_registry'
@@ -51,7 +51,7 @@ module AdsCommon
51
51
  }
52
52
  @logger = Logger.new(STDOUT)
53
53
  @logger.level = Logger::INFO
54
- Savon.configure do |config|
54
+ GoogleAdsSavon.configure do |config|
55
55
  config.logger = @logger
56
56
  config.log_level = :debug
57
57
  end
@@ -68,7 +68,7 @@ module AdsCommon
68
68
  # Returns:
69
69
  # - none
70
70
  def process_wsdl()
71
- client = Savon::Client.new(@wsdl_url)
71
+ client = GoogleAdsSavon::Client.new(@wsdl_url)
72
72
  begin
73
73
  @generator_args[:namespace] = client.wsdl.namespace
74
74
  do_process_wsdl_client(client)
@@ -18,7 +18,7 @@
18
18
  # Registry object for Savon backend. Used on generation step as parsed
19
19
  # representation of WSDL for API stubs generation.
20
20
 
21
- require 'savon'
21
+ require 'ads_savon'
22
22
  require 'rexml/document'
23
23
 
24
24
  require 'ads_common/utils'
@@ -17,7 +17,7 @@
17
17
  #
18
18
  # Code template for registry generation for Savon backend
19
19
 
20
- require 'savon'
20
+ require 'ads_savon'
21
21
  require 'ads_common/build/savon_abstract_generator'
22
22
  require 'pp'
23
23
 
@@ -17,7 +17,7 @@
17
17
  #
18
18
  # Code template for wrappers generation for Savon backend
19
19
 
20
- require 'savon'
20
+ require 'ads_savon'
21
21
  require 'ads_common/build/savon_abstract_generator'
22
22
 
23
23
  module AdsCommon
@@ -49,6 +49,10 @@ module AdsCommon
49
49
  def <%= action %>(*args, &block)
50
50
  return execute_action('<%= action %>', args, &block)
51
51
  end
52
+
53
+ def <%= action %>_to_xml(*args)
54
+ return get_soap_xml('<%= action %>', args)
55
+ end
52
56
  <% end %>
53
57
 
54
58
  private
@@ -69,7 +69,7 @@ module AdsCommon
69
69
  agent_app ||= File.basename($0)
70
70
  agent_data = extra_ids
71
71
  agent_data << 'Common-Ruby/%s' % AdsCommon::ApiConfig::CLIENT_LIB_VERSION
72
- agent_data << 'Savon/%s' % Savon::VERSION
72
+ agent_data << 'GoogleAdsSavon/%s' % GoogleAdsSavon::VERSION
73
73
  ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
74
74
  agent_data << [ruby_engine, RUBY_VERSION].join('/')
75
75
  agent_data << 'HTTPI/%s' % HTTPI::VERSION
@@ -62,6 +62,7 @@ module AdsCommon
62
62
  # Defaulting to stricter :peer validation.
63
63
  def self.prepare_request(url, config, headers = nil, data = nil)
64
64
  request = HTTPI::Request.new(url)
65
+ request.follow_redirect = true
65
66
  request.headers = headers if headers
66
67
  request.body = data if data
67
68
  configure_httpi(config, request)
@@ -17,7 +17,7 @@
17
17
  #
18
18
  # Base class for handlers of SOAP headers.
19
19
 
20
- require 'savon'
20
+ require 'ads_savon'
21
21
 
22
22
  module AdsCommon
23
23
  module SavonHeaders
@@ -17,7 +17,7 @@
17
17
  #
18
18
  # Base class for all generated API services based on Savon backend.
19
19
 
20
- require 'savon'
20
+ require 'ads_savon'
21
21
 
22
22
  require 'ads_common/http'
23
23
  require 'ads_common/parameters_validator'
@@ -38,6 +38,7 @@ module AdsCommon
38
38
  end
39
39
  @config, @version, @namespace = config, version, namespace
40
40
  @client = create_savon_client(endpoint, namespace)
41
+ @xml_only = false
41
42
  end
42
43
 
43
44
  private
@@ -59,8 +60,7 @@ module AdsCommon
59
60
 
60
61
  # Creates and sets up Savon client.
61
62
  def create_savon_client(endpoint, namespace)
62
- Nori.advanced_typecasting = false
63
- client = Savon::Client.new do |wsdl, httpi|
63
+ client = GoogleAdsSavon::Client.new do |wsdl, httpi|
64
64
  wsdl.endpoint = endpoint
65
65
  wsdl.namespace = namespace
66
66
  AdsCommon::Http.configure_httpi(@config, httpi)
@@ -70,13 +70,22 @@ module AdsCommon
70
70
  return client
71
71
  end
72
72
 
73
+ # Generates and returns SOAP XML for the specified action and args.
74
+ def get_soap_xml(action_name, args)
75
+ registry = get_service_registry()
76
+ validator = ParametersValidator.new(registry)
77
+ args = validator.validate_args(action_name, args)
78
+ return handle_soap_request(
79
+ action_name.to_sym, true, args, validator.extra_namespaces)
80
+ end
81
+
73
82
  # Executes SOAP action specified as a string with given arguments.
74
83
  def execute_action(action_name, args, &block)
75
84
  registry = get_service_registry()
76
85
  validator = ParametersValidator.new(registry)
77
86
  args = validator.validate_args(action_name, args)
78
- response = execute_soap_request(
79
- action_name.to_sym, args, validator.extra_namespaces)
87
+ response = handle_soap_request(
88
+ action_name.to_sym, false, args, validator.extra_namespaces)
80
89
  log_headers(response.http.headers)
81
90
  handle_errors(response)
82
91
  extractor = ResultsExtractor.new(registry)
@@ -92,7 +101,7 @@ module AdsCommon
92
101
  end
93
102
 
94
103
  # Executes the SOAP request with original SOAP name.
95
- def execute_soap_request(action, args, extra_namespaces)
104
+ def handle_soap_request(action, xml_only, args, extra_namespaces)
96
105
  original_action_name =
97
106
  get_service_registry.get_method_signature(action)[:original_name]
98
107
  original_action_name = action if original_action_name.nil?
@@ -100,6 +109,7 @@ module AdsCommon
100
109
  soap.body = args
101
110
  header_handler.prepare_request(http, soap)
102
111
  soap.namespaces.merge!(extra_namespaces) unless extra_namespaces.nil?
112
+ return soap.to_xml if xml_only
103
113
  end
104
114
  return response
105
115
  end
@@ -19,6 +19,6 @@
19
19
 
20
20
  module AdsCommon
21
21
  module ApiConfig
22
- CLIENT_LIB_VERSION = '0.10.1'
22
+ CLIENT_LIB_VERSION = '0.11.0'
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-ads-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
5
- prerelease:
4
+ version: 0.11.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sergio Gomes
@@ -11,44 +10,39 @@ authors:
11
10
  autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2015-08-26 00:00:00.000000000 Z
13
+ date: 2015-10-08 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
- name: savon
16
+ name: google-ads-savon
18
17
  requirement: !ruby/object:Gem::Requirement
19
- none: false
20
18
  requirements:
21
19
  - - ~>
22
20
  - !ruby/object:Gem::Version
23
- version: 1.2.0
21
+ version: 1.0.0
24
22
  type: :runtime
25
23
  prerelease: false
26
24
  version_requirements: !ruby/object:Gem::Requirement
27
- none: false
28
25
  requirements:
29
26
  - - ~>
30
27
  - !ruby/object:Gem::Version
31
- version: 1.2.0
28
+ version: 1.0.0
32
29
  - !ruby/object:Gem::Dependency
33
30
  name: httpi
34
31
  requirement: !ruby/object:Gem::Requirement
35
- none: false
36
32
  requirements:
37
33
  - - ~>
38
34
  - !ruby/object:Gem::Version
39
- version: 1.1.0
35
+ version: '2.3'
40
36
  type: :runtime
41
37
  prerelease: false
42
38
  version_requirements: !ruby/object:Gem::Requirement
43
- none: false
44
39
  requirements:
45
40
  - - ~>
46
41
  - !ruby/object:Gem::Version
47
- version: 1.1.0
42
+ version: '2.3'
48
43
  - !ruby/object:Gem::Dependency
49
44
  name: signet
50
45
  requirement: !ruby/object:Gem::Requirement
51
- none: false
52
46
  requirements:
53
47
  - - ~>
54
48
  - !ruby/object:Gem::Version
@@ -56,7 +50,6 @@ dependencies:
56
50
  type: :runtime
57
51
  prerelease: false
58
52
  version_requirements: !ruby/object:Gem::Requirement
59
- none: false
60
53
  requirements:
61
54
  - - ~>
62
55
  - !ruby/object:Gem::Version
@@ -64,7 +57,6 @@ dependencies:
64
57
  - !ruby/object:Gem::Dependency
65
58
  name: rake
66
59
  requirement: !ruby/object:Gem::Requirement
67
- none: false
68
60
  requirements:
69
61
  - - ! '>='
70
62
  - !ruby/object:Gem::Version
@@ -72,81 +64,80 @@ dependencies:
72
64
  type: :development
73
65
  prerelease: false
74
66
  version_requirements: !ruby/object:Gem::Requirement
75
- none: false
76
67
  requirements:
77
68
  - - ! '>='
78
69
  - !ruby/object:Gem::Version
79
70
  version: 10.4.2
80
71
  description: Essential utilities shared by all Ads Ruby client libraries
81
- email:
72
+ email:
73
+ - adwordsapiadvisor+michael@google.com
82
74
  executables: []
83
75
  extensions: []
84
76
  extra_rdoc_files: []
85
77
  files:
78
+ - COPYING
79
+ - ChangeLog
80
+ - README.md
86
81
  - lib/ads_common/api.rb
87
- - lib/ads_common/version.rb
88
- - lib/ads_common/errors.rb
82
+ - lib/ads_common/api_config.rb
89
83
  - lib/ads_common/auth/base_handler.rb
90
- - lib/ads_common/auth/oauth2_service_account_handler.rb
91
84
  - lib/ads_common/auth/oauth2_handler.rb
92
- - lib/ads_common/credential_handler.rb
93
- - lib/ads_common/api_config.rb
94
- - lib/ads_common/utils.rb
95
- - lib/ads_common/build/savon_service_generator.rb
96
- - lib/ads_common/build/savon_registry.rb
97
- - lib/ads_common/build/savon_registry_generator.rb
85
+ - lib/ads_common/auth/oauth2_service_account_handler.rb
98
86
  - lib/ads_common/build/savon_abstract_generator.rb
99
87
  - lib/ads_common/build/savon_generator.rb
88
+ - lib/ads_common/build/savon_registry.rb
89
+ - lib/ads_common/build/savon_registry_generator.rb
90
+ - lib/ads_common/build/savon_service_generator.rb
100
91
  - lib/ads_common/config.rb
92
+ - lib/ads_common/credential_handler.rb
93
+ - lib/ads_common/errors.rb
94
+ - lib/ads_common/http.rb
101
95
  - lib/ads_common/parameters_validator.rb
96
+ - lib/ads_common/results_extractor.rb
102
97
  - lib/ads_common/savon_headers/base_header_handler.rb
103
98
  - lib/ads_common/savon_headers/oauth_header_handler.rb
104
- - lib/ads_common/results_extractor.rb
105
- - lib/ads_common/http.rb
106
99
  - lib/ads_common/savon_service.rb
107
- - test/suite_unittests.rb
100
+ - lib/ads_common/utils.rb
101
+ - lib/ads_common/version.rb
108
102
  - test/coverage.rb
109
- - test/test_results_extractor.rb
103
+ - test/suite_unittests.rb
110
104
  - test/test_config.rb
111
- - test/test_utils.rb
105
+ - test/test_config.yml
112
106
  - test/test_credential_handler.rb
113
107
  - test/test_oauth2_handler.rb
114
- - test/test_savon_service.rb
115
- - test/test_config.yml
116
108
  - test/test_parameters_validator.rb
117
- - COPYING
118
- - README.md
119
- - ChangeLog
109
+ - test/test_results_extractor.rb
110
+ - test/test_savon_service.rb
111
+ - test/test_utils.rb
120
112
  homepage: https://github.com/googleads/google-api-ads-ruby
121
113
  licenses:
122
114
  - Apache-2.0
115
+ metadata: {}
123
116
  post_install_message:
124
117
  rdoc_options: []
125
118
  require_paths:
126
119
  - lib
127
120
  required_ruby_version: !ruby/object:Gem::Requirement
128
- none: false
129
121
  requirements:
130
122
  - - ! '>='
131
123
  - !ruby/object:Gem::Version
132
124
  version: '0'
133
125
  required_rubygems_version: !ruby/object:Gem::Requirement
134
- none: false
135
126
  requirements:
136
127
  - - ! '>='
137
128
  - !ruby/object:Gem::Version
138
129
  version: 1.3.6
139
130
  requirements: []
140
131
  rubyforge_project: google-ads-common
141
- rubygems_version: 1.8.23
132
+ rubygems_version: 2.2.2
142
133
  signing_key:
143
- specification_version: 3
134
+ specification_version: 4
144
135
  summary: Common code for Google Ads APIs
145
136
  test_files:
146
- - test/test_results_extractor.rb
137
+ - test/test_savon_service.rb
147
138
  - test/test_config.rb
148
- - test/test_utils.rb
149
139
  - test/test_credential_handler.rb
150
- - test/test_oauth2_handler.rb
151
- - test/test_savon_service.rb
140
+ - test/test_utils.rb
152
141
  - test/test_parameters_validator.rb
142
+ - test/test_oauth2_handler.rb
143
+ - test/test_results_extractor.rb