google-ads-common 0.6.4 → 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/README +1 -1
- data/lib/ads_common/api.rb +66 -86
- data/lib/ads_common/api_config.rb +37 -64
- data/lib/ads_common/auth/base_handler.rb +9 -19
- data/lib/ads_common/auth/client_login_handler.rb +43 -44
- data/lib/ads_common/auth/oauth_handler.rb +63 -77
- data/lib/ads_common/build/savon_generator.rb +1 -5
- data/lib/ads_common/build/savon_service_generator.rb +3 -16
- data/lib/ads_common/credential_handler.rb +31 -9
- data/lib/ads_common/http.rb +20 -21
- data/lib/ads_common/parameters_validator.rb +2 -1
- data/lib/ads_common/results_extractor.rb +183 -0
- data/lib/ads_common/savon_headers/base_header_handler.rb +26 -21
- data/lib/ads_common/savon_headers/oauth_header_handler.rb +4 -29
- data/lib/ads_common/savon_service.rb +28 -174
- data/lib/ads_common/version.rb +1 -1
- data/test/coverage.rb +35 -0
- data/test/suite_unittests.rb +30 -0
- data/test/test_client_login_handler.rb +41 -8
- data/test/test_config.rb +3 -4
- data/test/test_credential_handler.rb +55 -0
- data/test/test_parameters_validator.rb +24 -1
- data/test/test_results_extractor.rb +165 -0
- data/test/test_savon_service.rb +14 -167
- metadata +38 -25
- data/lib/ads_common/savon_headers/simple_header_handler.rb +0 -63
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-ads-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 3
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
8
|
+
- 7
|
9
|
+
- 0
|
10
|
+
version: 0.7.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Sergio Gomes
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2012-
|
19
|
+
date: 2012-05-15 00:00:00 +04:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
@@ -26,6 +27,7 @@ dependencies:
|
|
26
27
|
requirements:
|
27
28
|
- - ~>
|
28
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 41
|
29
31
|
segments:
|
30
32
|
- 0
|
31
33
|
- 9
|
@@ -41,6 +43,7 @@ dependencies:
|
|
41
43
|
requirements:
|
42
44
|
- - ~>
|
43
45
|
- !ruby/object:Gem::Version
|
46
|
+
hash: 1
|
44
47
|
segments:
|
45
48
|
- 2
|
46
49
|
- 2
|
@@ -56,11 +59,12 @@ dependencies:
|
|
56
59
|
requirements:
|
57
60
|
- - ~>
|
58
61
|
- !ruby/object:Gem::Version
|
62
|
+
hash: 53
|
59
63
|
segments:
|
60
64
|
- 0
|
61
65
|
- 9
|
62
|
-
-
|
63
|
-
version: 0.9.
|
66
|
+
- 7
|
67
|
+
version: 0.9.7
|
64
68
|
type: :runtime
|
65
69
|
version_requirements: *id003
|
66
70
|
- !ruby/object:Gem::Dependency
|
@@ -71,6 +75,7 @@ dependencies:
|
|
71
75
|
requirements:
|
72
76
|
- - ~>
|
73
77
|
- !ruby/object:Gem::Version
|
78
|
+
hash: 5
|
74
79
|
segments:
|
75
80
|
- 0
|
76
81
|
- 4
|
@@ -88,32 +93,36 @@ extensions: []
|
|
88
93
|
extra_rdoc_files: []
|
89
94
|
|
90
95
|
files:
|
91
|
-
- lib/ads_common/
|
92
|
-
- lib/ads_common/version.rb
|
93
|
-
- lib/ads_common/credential_handler.rb
|
94
|
-
- lib/ads_common/savon_service.rb
|
95
|
-
- lib/ads_common/api_config.rb
|
96
|
+
- lib/ads_common/auth/base_handler.rb
|
96
97
|
- lib/ads_common/auth/client_login_handler.rb
|
97
98
|
- lib/ads_common/auth/oauth_handler.rb
|
98
|
-
- lib/ads_common/auth/base_handler.rb
|
99
|
-
- lib/ads_common/http.rb
|
100
|
-
- lib/ads_common/errors.rb
|
101
|
-
- lib/ads_common/parameters_validator.rb
|
102
|
-
- lib/ads_common/savon_headers/oauth_header_handler.rb
|
103
|
-
- lib/ads_common/savon_headers/base_header_handler.rb
|
104
|
-
- lib/ads_common/savon_headers/httpi_request_proxy.rb
|
105
|
-
- lib/ads_common/savon_headers/simple_header_handler.rb
|
106
99
|
- lib/ads_common/build/savon_abstract_generator.rb
|
107
|
-
- lib/ads_common/build/
|
100
|
+
- lib/ads_common/build/savon_generator.rb
|
108
101
|
- lib/ads_common/build/savon_registry.rb
|
109
102
|
- lib/ads_common/build/savon_registry_generator.rb
|
110
|
-
- lib/ads_common/build/
|
103
|
+
- lib/ads_common/build/savon_service_generator.rb
|
104
|
+
- lib/ads_common/savon_headers/base_header_handler.rb
|
105
|
+
- lib/ads_common/savon_headers/httpi_request_proxy.rb
|
106
|
+
- lib/ads_common/savon_headers/oauth_header_handler.rb
|
107
|
+
- lib/ads_common/api_config.rb
|
108
|
+
- lib/ads_common/api.rb
|
111
109
|
- lib/ads_common/config.rb
|
112
|
-
-
|
110
|
+
- lib/ads_common/credential_handler.rb
|
111
|
+
- lib/ads_common/errors.rb
|
112
|
+
- lib/ads_common/http.rb
|
113
|
+
- lib/ads_common/parameters_validator.rb
|
114
|
+
- lib/ads_common/savon_service.rb
|
115
|
+
- lib/ads_common/version.rb
|
116
|
+
- lib/ads_common/results_extractor.rb
|
113
117
|
- test/test_client_login_handler.rb
|
114
|
-
- test/test_parameters_validator.rb
|
115
118
|
- test/test_config.rb
|
116
119
|
- test/test_config.yml
|
120
|
+
- test/test_parameters_validator.rb
|
121
|
+
- test/test_savon_service.rb
|
122
|
+
- test/coverage.rb
|
123
|
+
- test/suite_unittests.rb
|
124
|
+
- test/test_credential_handler.rb
|
125
|
+
- test/test_results_extractor.rb
|
117
126
|
- COPYING
|
118
127
|
- README
|
119
128
|
- ChangeLog
|
@@ -131,6 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
140
|
requirements:
|
132
141
|
- - ">="
|
133
142
|
- !ruby/object:Gem::Version
|
143
|
+
hash: 3
|
134
144
|
segments:
|
135
145
|
- 0
|
136
146
|
version: "0"
|
@@ -139,6 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
149
|
requirements:
|
140
150
|
- - ">="
|
141
151
|
- !ruby/object:Gem::Version
|
152
|
+
hash: 23
|
142
153
|
segments:
|
143
154
|
- 1
|
144
155
|
- 3
|
@@ -152,7 +163,9 @@ signing_key:
|
|
152
163
|
specification_version: 3
|
153
164
|
summary: Common code for Google Ads APIs
|
154
165
|
test_files:
|
155
|
-
- test/test_savon_service.rb
|
156
166
|
- test/test_client_login_handler.rb
|
157
|
-
- test/test_parameters_validator.rb
|
158
167
|
- test/test_config.rb
|
168
|
+
- test/test_parameters_validator.rb
|
169
|
+
- test/test_savon_service.rb
|
170
|
+
- test/test_credential_handler.rb
|
171
|
+
- test/test_results_extractor.rb
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# Encoding: utf-8
|
2
|
-
#
|
3
|
-
# Authors:: api.dklimkin@gmail.com (Danial Klimkin)
|
4
|
-
#
|
5
|
-
# Copyright:: Copyright 2010, Google Inc. All Rights Reserved.
|
6
|
-
#
|
7
|
-
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
16
|
-
# implied.
|
17
|
-
# See the License for the specific language governing permissions and
|
18
|
-
# limitations under the License.
|
19
|
-
#
|
20
|
-
# Handles simple SOAP headers and namespaces definition for Savon SOAP backend.
|
21
|
-
|
22
|
-
require 'ads_common/savon_headers/base_header_handler'
|
23
|
-
|
24
|
-
module AdsCommon
|
25
|
-
module SavonHeaders
|
26
|
-
class SimpleHeaderHandler < BaseHeaderHandler
|
27
|
-
# Enriches soap object with API-specific headers like namespaces, login
|
28
|
-
# credentials etc. Sets the default namespace for the body to the one
|
29
|
-
# specified in initializer.
|
30
|
-
#
|
31
|
-
# Args:
|
32
|
-
# - request: a HTTPI Request for extra configuration (unused)
|
33
|
-
# - soap: a Savon soap object to fill fields in
|
34
|
-
# - args: request parameters to adjust for namespaces
|
35
|
-
#
|
36
|
-
# Returns:
|
37
|
-
# - Modified soap structure
|
38
|
-
#
|
39
|
-
def prepare_request(request, soap, args)
|
40
|
-
super(request, soap, args)
|
41
|
-
soap.header[prepend_namespace(@element_name)] =
|
42
|
-
generate_request_header()
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
# Generates SOAP request header with login credentials and namespace
|
48
|
-
# definition.
|
49
|
-
#
|
50
|
-
# Args:
|
51
|
-
# - None
|
52
|
-
#
|
53
|
-
# Returns:
|
54
|
-
# - Hash containing a header with filled in credentials
|
55
|
-
#
|
56
|
-
def generate_request_header()
|
57
|
-
headers = @auth_handler.headers(
|
58
|
-
@credential_handler.credentials(@version))
|
59
|
-
return headers[@element_name]
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|