google-ads-common 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +9 -9
- data/ChangeLog +3 -0
- data/README.md +88 -0
- data/lib/ads_common/build/savon_registry_generator.rb +1 -1
- data/lib/ads_common/build/savon_service_generator.rb +1 -1
- data/lib/ads_common/parameters_validator.rb +40 -1
- data/lib/ads_common/version.rb +1 -1
- data/test/test_credential_handler.rb +4 -4
- metadata +29 -30
- data/README +0 -77
- data/test/ads_devrel_ruby_ads_common.blueprint +0 -36
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2VjOTE1ODA4OGQzOGY2NmU4MDczOWE4OTYwMzUwMDgzNTg3YzU0OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
7
|
-
|
6
|
+
MzFiODExZTFhOTQ3OGI5NzU3NWFmYzRiYzZmOWRkOGFjYjhkM2U0NQ==
|
7
|
+
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWE4MDc2MTQzNjEyMDRhNzE2ZjhkZTI0ODhjM2Y3ZDIzMDAyMjIyZmYyNThi
|
10
|
+
Y2JjODZjNjQ3ZmNkZGZjZDA0Mjk1YWUzMTZlNTVjMDBhZDNjNTAwOWQwZWY3
|
11
|
+
M2EwOTRiMzdhYzk5MDQ1M2JlOWFmOGMxODgwOWJhY2EyZDUzYTc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWM4MmQxYTE0ODNjNTIzNDdjOTRjZTkzYTNhOGFiOWQ1N2ViNTdjNjkzOTQx
|
14
|
+
NDU0ZDIzNDJiZjcxM2FjZjg4ODI3OTFlY2I2MDFhMGRjZmM3MTIxNWRlZDQ4
|
15
|
+
NTUzMThkYWU1MmU1N2U5YWFkZDQxNTc2MWI4NzRlNDMxYzkxNTA=
|
data/ChangeLog
CHANGED
data/README.md
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# Google AdsCommon Library
|
2
|
+
|
3
|
+
This gem is a dependency for the new generation of Ruby Google Ads client
|
4
|
+
libraries. It contains common code shared among all of these libraries, such as
|
5
|
+
authentication, SOAP stub generation, error handling, logging, etc.
|
6
|
+
|
7
|
+
|
8
|
+
# Docs for Users
|
9
|
+
|
10
|
+
## 1 - Installation:
|
11
|
+
|
12
|
+
`google-ads-common` is a Ruby gem. See
|
13
|
+
|
14
|
+
> [http://docs.rubygems.org/read/book/1]()
|
15
|
+
|
16
|
+
Install it using the gem install command.
|
17
|
+
|
18
|
+
$ gem install google-ads-common
|
19
|
+
|
20
|
+
The following gem libraries are required:
|
21
|
+
|
22
|
+
- savon
|
23
|
+
- httpi
|
24
|
+
- signet
|
25
|
+
|
26
|
+
|
27
|
+
# Docs for Developers
|
28
|
+
|
29
|
+
## 1 - Directory Structure
|
30
|
+
|
31
|
+
- `lib/ads_common/`: Contains the bulk of the library.
|
32
|
+
- `auth/`: Contains classes that can handle different authentication methods.
|
33
|
+
Currently only supports ClientLogin.
|
34
|
+
- `build/`: Contains classes that handle code generation, packaging and other
|
35
|
+
build-time tasks for client libraries (not for google-ads-common).
|
36
|
+
- `savon_headers/`: Contains classes that handle header injection into savon
|
37
|
+
requests.
|
38
|
+
- `test/`: Contains the unit tests for the library.
|
39
|
+
|
40
|
+
|
41
|
+
## 2 - Commands
|
42
|
+
|
43
|
+
To build the gem:
|
44
|
+
|
45
|
+
$ gem build google-ads-common.gemspec
|
46
|
+
|
47
|
+
To run unit tests on the library:
|
48
|
+
|
49
|
+
$ rake test
|
50
|
+
|
51
|
+
|
52
|
+
## 3 - Resources
|
53
|
+
|
54
|
+
Ruby client libraries code page:
|
55
|
+
|
56
|
+
> [https://github.com/googleads/google-api-ads-ruby]()
|
57
|
+
|
58
|
+
Google Ads Developers Plus page:
|
59
|
+
|
60
|
+
> [https://plus.google.com/+GoogleAdsDevelopers]()
|
61
|
+
|
62
|
+
|
63
|
+
# Copyright/License Info
|
64
|
+
|
65
|
+
Copyright 2010-2014, Google Inc. All Rights Reserved.
|
66
|
+
|
67
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
68
|
+
you may not use this file except in compliance with the License.
|
69
|
+
You may obtain a copy of the License at
|
70
|
+
|
71
|
+
> [http://www.apache.org/licenses/LICENSE-2.0]()
|
72
|
+
|
73
|
+
Unless required by applicable law or agreed to in writing, software
|
74
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
75
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
76
|
+
See the License for the specific language governing permissions and
|
77
|
+
limitations under the License.
|
78
|
+
|
79
|
+
|
80
|
+
## Authors
|
81
|
+
|
82
|
+
- Sérgio Gomes (api.sgomes@gmail.com)
|
83
|
+
- Danial Klimkin (api.dklimkin@gmail.com)
|
84
|
+
- Michael Cloonan (api.mcloonan@gmail.com)
|
85
|
+
|
86
|
+
## Maintainer
|
87
|
+
|
88
|
+
- Michael Cloonan (api.mcloonan@gmail.com)
|
@@ -31,7 +31,7 @@ module AdsCommon
|
|
31
31
|
#
|
32
32
|
# This is auto-generated code, changes will be overwritten.
|
33
33
|
#
|
34
|
-
# Copyright:: Copyright
|
34
|
+
# Copyright:: Copyright 2014, Google Inc. All Rights Reserved.
|
35
35
|
# License:: Licensed under the Apache License, Version 2.0.
|
36
36
|
#
|
37
37
|
# <%= @generator_stamp %>
|
@@ -31,7 +31,7 @@ module AdsCommon
|
|
31
31
|
#
|
32
32
|
# This is auto-generated code, changes will be overwritten.
|
33
33
|
#
|
34
|
-
# Copyright:: Copyright
|
34
|
+
# Copyright:: Copyright 2014, Google Inc. All Rights Reserved.
|
35
35
|
# License:: Licensed under the Apache License, Version 2.0.
|
36
36
|
#
|
37
37
|
# <%= @generator_stamp %>
|
@@ -19,6 +19,8 @@
|
|
19
19
|
#
|
20
20
|
# This class validates input parameters before passing them to Savon.
|
21
21
|
|
22
|
+
require 'ads_common/utils'
|
23
|
+
|
22
24
|
module AdsCommon
|
23
25
|
class ParametersValidator
|
24
26
|
# Savon special keys.
|
@@ -71,12 +73,49 @@ module AdsCommon
|
|
71
73
|
item_type = get_full_type_signature(field[:type])
|
72
74
|
item_ns = field[:ns] || type_ns
|
73
75
|
key = handle_namespace_override(args_hash, key, item_ns) if item_ns
|
74
|
-
|
76
|
+
|
77
|
+
# Separate validation for choice types as we need to inject nodes into
|
78
|
+
# the tree. Validate as usual if not a choice type.
|
79
|
+
unless validate_choice_argument(item, args_hash, key, item_type)
|
80
|
+
validate_arg(item, args_hash, key, item_type)
|
81
|
+
end
|
75
82
|
end
|
76
83
|
end
|
77
84
|
return args_hash
|
78
85
|
end
|
79
86
|
|
87
|
+
# Special handling for choice types. Goes over each item, checks xsi_type
|
88
|
+
# is set and correct and injects new node for it into the tree. After that,
|
89
|
+
# recurces with the correct item type.
|
90
|
+
def validate_choice_argument(item, parent, key, item_type)
|
91
|
+
result = false
|
92
|
+
if item_type.kind_of?(Hash) && item_type.include?(:choices)
|
93
|
+
new_root = {}
|
94
|
+
choice_items = arrayize(item)
|
95
|
+
choice_items.each do |choice_item|
|
96
|
+
choice_type = choice_item.delete(:xsi_type)
|
97
|
+
choice_item_type =
|
98
|
+
find_choice_by_xsi_type(choice_type, item_type[:choices])
|
99
|
+
if choice_type.nil? || choice_item_type.nil?
|
100
|
+
raise AdsCommon::Errors::TypeMismatchError.new(
|
101
|
+
'choice subtype', choice_type, choice_item.to_s())
|
102
|
+
end
|
103
|
+
new_root[choice_type] ||= []
|
104
|
+
new_root[choice_type] << choice_item
|
105
|
+
type_signature = get_full_type_signature(choice_type)
|
106
|
+
validate_arg(choice_item, new_root, choice_type, type_signature)
|
107
|
+
end
|
108
|
+
parent[key] = new_root
|
109
|
+
result = true
|
110
|
+
end
|
111
|
+
return result
|
112
|
+
end
|
113
|
+
|
114
|
+
def find_choice_by_xsi_type(xsi_type, item_def)
|
115
|
+
index = item_def.index {|item| xsi_type.eql?(item[:original_name])}
|
116
|
+
return index.nil? ? nil : item_def[index]
|
117
|
+
end
|
118
|
+
|
80
119
|
# Checks if no extra fields provided outside of known ones.
|
81
120
|
def check_extra_fields(args_hash, known_fields)
|
82
121
|
extra_fields = args_hash.keys - known_fields - IGNORED_HASH_KEYS
|
data/lib/ads_common/version.rb
CHANGED
@@ -80,22 +80,22 @@ class TestCredentialHandler < Test::Unit::TestCase
|
|
80
80
|
credentials[:foo] = 'bar'
|
81
81
|
credentials[:baz] = 42
|
82
82
|
mock1 = MiniTest::Mock.new()
|
83
|
-
mock1.expect(:property_changed,
|
84
|
-
mock1.expect(:property_changed, nil, [:baz, 42])
|
83
|
+
mock1.expect(:property_changed, nil, [:baz, 42])
|
85
84
|
@handler.set_auth_handler(mock1)
|
86
85
|
@handler.credentials = credentials
|
87
86
|
assert(mock1.verify)
|
88
87
|
|
89
88
|
credentials.delete(:baz)
|
90
89
|
mock2 = MiniTest::Mock.new()
|
91
|
-
mock2.expect(:property_changed,
|
90
|
+
mock2.expect(:property_changed, nil, [:baz, nil])
|
92
91
|
@handler.set_auth_handler(mock2)
|
93
92
|
@handler.credentials = credentials
|
94
93
|
assert(mock2.verify)
|
95
94
|
|
96
95
|
credentials[:foo] = nil
|
97
96
|
mock3 = MiniTest::Mock.new()
|
98
|
-
mock3.expect(:property_changed,
|
97
|
+
mock3.expect(:property_changed, nil, [:foo, nil])
|
98
|
+
mock3.expect(:property_changed, nil, [:baz, nil])
|
99
99
|
@handler.set_auth_handler(mock3)
|
100
100
|
@handler.credentials = credentials
|
101
101
|
assert(mock3.verify)
|
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.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Gomes
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-12-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -60,42 +60,41 @@ executables: []
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
+
- COPYING
|
64
|
+
- ChangeLog
|
65
|
+
- README.md
|
63
66
|
- lib/ads_common/api.rb
|
64
|
-
- lib/ads_common/
|
65
|
-
- lib/ads_common/parameters_validator.rb
|
66
|
-
- lib/ads_common/utils.rb
|
67
|
+
- lib/ads_common/api_config.rb
|
67
68
|
- lib/ads_common/auth/base_handler.rb
|
68
|
-
- lib/ads_common/auth/oauth2_jwt_handler.rb
|
69
|
-
- lib/ads_common/auth/oauth2_handler.rb
|
70
69
|
- lib/ads_common/auth/client_login_handler.rb
|
71
|
-
- lib/ads_common/
|
70
|
+
- lib/ads_common/auth/oauth2_handler.rb
|
71
|
+
- lib/ads_common/auth/oauth2_jwt_handler.rb
|
72
|
+
- lib/ads_common/build/savon_abstract_generator.rb
|
73
|
+
- lib/ads_common/build/savon_generator.rb
|
74
|
+
- lib/ads_common/build/savon_registry.rb
|
75
|
+
- lib/ads_common/build/savon_registry_generator.rb
|
76
|
+
- lib/ads_common/build/savon_service_generator.rb
|
72
77
|
- lib/ads_common/config.rb
|
73
|
-
- lib/ads_common/
|
74
|
-
- lib/ads_common/savon_headers/oauth_header_handler.rb
|
75
|
-
- lib/ads_common/savon_headers/base_header_handler.rb
|
78
|
+
- lib/ads_common/credential_handler.rb
|
76
79
|
- lib/ads_common/errors.rb
|
80
|
+
- lib/ads_common/http.rb
|
81
|
+
- lib/ads_common/parameters_validator.rb
|
77
82
|
- lib/ads_common/results_extractor.rb
|
83
|
+
- lib/ads_common/savon_headers/base_header_handler.rb
|
84
|
+
- lib/ads_common/savon_headers/oauth_header_handler.rb
|
85
|
+
- lib/ads_common/savon_service.rb
|
86
|
+
- lib/ads_common/utils.rb
|
78
87
|
- lib/ads_common/version.rb
|
79
|
-
-
|
80
|
-
- lib/ads_common/build/savon_service_generator.rb
|
81
|
-
- lib/ads_common/build/savon_abstract_generator.rb
|
82
|
-
- lib/ads_common/build/savon_registry_generator.rb
|
83
|
-
- lib/ads_common/build/savon_generator.rb
|
84
|
-
- lib/ads_common/api_config.rb
|
85
|
-
- test/test_credential_handler.rb
|
88
|
+
- test/coverage.rb
|
86
89
|
- test/suite_unittests.rb
|
87
|
-
- test/test_utils.rb
|
88
|
-
- test/ads_devrel_ruby_ads_common.blueprint
|
89
90
|
- test/test_client_login_handler.rb
|
90
|
-
- test/coverage.rb
|
91
|
-
- test/test_savon_service.rb
|
92
91
|
- test/test_config.rb
|
93
|
-
- test/test_results_extractor.rb
|
94
92
|
- test/test_config.yml
|
93
|
+
- test/test_credential_handler.rb
|
95
94
|
- test/test_parameters_validator.rb
|
96
|
-
-
|
97
|
-
-
|
98
|
-
-
|
95
|
+
- test/test_results_extractor.rb
|
96
|
+
- test/test_savon_service.rb
|
97
|
+
- test/test_utils.rb
|
99
98
|
homepage: http://code.google.com/p/google-api-ads-ruby/
|
100
99
|
licenses:
|
101
100
|
- Apache-2.0
|
@@ -116,15 +115,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
115
|
version: 1.3.6
|
117
116
|
requirements: []
|
118
117
|
rubyforge_project: google-ads-common
|
119
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.2.2
|
120
119
|
signing_key:
|
121
120
|
specification_version: 4
|
122
121
|
summary: Common code for Google Ads APIs
|
123
122
|
test_files:
|
124
|
-
- test/test_credential_handler.rb
|
125
123
|
- test/test_utils.rb
|
124
|
+
- test/test_credential_handler.rb
|
125
|
+
- test/test_parameters_validator.rb
|
126
126
|
- test/test_client_login_handler.rb
|
127
|
+
- test/test_results_extractor.rb
|
127
128
|
- test/test_savon_service.rb
|
128
129
|
- test/test_config.rb
|
129
|
-
- test/test_results_extractor.rb
|
130
|
-
- test/test_parameters_validator.rb
|
data/README
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
= Google AdsCommon Library
|
2
|
-
|
3
|
-
This gem is a dependency for the new generation of Ruby Google Ads client
|
4
|
-
libraries. It contains common code shared among all of these libraries, such as
|
5
|
-
authentication, SOAP stub generation, error handling, logging, etc.
|
6
|
-
|
7
|
-
|
8
|
-
= Docs for Users
|
9
|
-
|
10
|
-
== 1 - Installation:
|
11
|
-
|
12
|
-
google-ads-common is a Ruby gem. See http://docs.rubygems.org/read/book/1
|
13
|
-
|
14
|
-
Install it using the gem install command.
|
15
|
-
$ gem install google-ads-common
|
16
|
-
|
17
|
-
The following gem libraries are required:
|
18
|
-
- savon
|
19
|
-
- httpi
|
20
|
-
- signet
|
21
|
-
|
22
|
-
|
23
|
-
= Docs for Developers
|
24
|
-
|
25
|
-
== 1 - Directory Structure
|
26
|
-
|
27
|
-
- +lib/ads_common/+: Contains the bulk of the library.
|
28
|
-
- +auth/+: Contains classes that can handle different authentication methods.
|
29
|
-
Currently only supports ClientLogin.
|
30
|
-
- +build/+: Contains classes that handle code generation, packaging and other
|
31
|
-
build-time tasks for client libraries (not for google-ads-common).
|
32
|
-
- +savon_headers/+: Contains classes that handle header injection into savon
|
33
|
-
requests.
|
34
|
-
- +test/+: Contains the unit tests for the library.
|
35
|
-
|
36
|
-
|
37
|
-
== 2 - Commands
|
38
|
-
|
39
|
-
$ gem build google-ads-common.gemspec
|
40
|
-
to build the gem
|
41
|
-
|
42
|
-
$ rake test
|
43
|
-
to run unit tests on the library
|
44
|
-
|
45
|
-
|
46
|
-
== 3 - Resources
|
47
|
-
|
48
|
-
Ruby client libraries code page:
|
49
|
-
|
50
|
-
http://code.google.com/p/google-api-ads-ruby/
|
51
|
-
|
52
|
-
Google Ads Developers Plus page:
|
53
|
-
|
54
|
-
https://plus.google.com/+GoogleAdsDevelopers
|
55
|
-
|
56
|
-
|
57
|
-
= Copyright/License Info
|
58
|
-
|
59
|
-
Copyright 2010-2013, Google Inc. All Rights Reserved.
|
60
|
-
|
61
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
62
|
-
you may not use this file except in compliance with the License.
|
63
|
-
You may obtain a copy of the License at
|
64
|
-
|
65
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
66
|
-
|
67
|
-
Unless required by applicable law or agreed to in writing, software
|
68
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
69
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
70
|
-
See the License for the specific language governing permissions and
|
71
|
-
limitations under the License.
|
72
|
-
|
73
|
-
|
74
|
-
== Authors
|
75
|
-
|
76
|
-
Sérgio Gomes (api.sgomes@gmail.com)
|
77
|
-
Danial Klimkin (api.dklimkin@gmail.com)
|
@@ -1,36 +0,0 @@
|
|
1
|
-
include "devtools/blueprint/ncl/blueprint_file.ncl";
|
2
|
-
|
3
|
-
blueprint_file = ::blueprint::BlueprintFile(
|
4
|
-
buildable_units = [
|
5
|
-
::blueprint::BuildableUnit(
|
6
|
-
build_patterns = [
|
7
|
-
"//third_party/ruby/ads_api/ads_common/...",
|
8
|
-
],
|
9
|
-
test_patterns = [
|
10
|
-
"//third_party/ruby/ads_api/ads_common:rake-test",
|
11
|
-
],
|
12
|
-
build_flags = ["--cpu=k8",
|
13
|
-
"--java_cpu=k8"],
|
14
|
-
test_flags = [],
|
15
|
-
name = "ads_devrel.ruby.ads_api_clients",
|
16
|
-
coverage_instrumentation_filters = [
|
17
|
-
"third_party/ruby/ads_api/ads_common/",
|
18
|
-
"-third_party/ruby/ads_api/ads_common/test",
|
19
|
-
"-test_.*$",
|
20
|
-
],
|
21
|
-
continuous_build_email = ::blueprint::ContinuousBuildEmailInfo(
|
22
|
-
build_cop_email_addrs = ["ads-client-libs+tap-ruby@google.com"],
|
23
|
-
summary_email_addrs = []),
|
24
|
-
enable_release = false,
|
25
|
-
enable_continuous_build = true,
|
26
|
-
tap_settings = tap::TapBuildableUnitSettings()
|
27
|
-
)
|
28
|
-
],
|
29
|
-
owned_code_depotpaths = [
|
30
|
-
"//depot/google3/third_party/ruby/ads_api/ads_common/...",
|
31
|
-
],
|
32
|
-
mpm_packages = [
|
33
|
-
],
|
34
|
-
project_name = "ads_devrel.ruby.ads_api_clients",
|
35
|
-
mdb_groups = ["ads-api-devrel"]
|
36
|
-
);
|