google-ads-common 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +0 -0
- data/ChangeLog +3 -0
- data/README.md +0 -0
- data/lib/ads_common/api.rb +0 -11
- data/lib/ads_common/api_config.rb +0 -0
- data/lib/ads_common/auth/base_handler.rb +0 -0
- data/lib/ads_common/auth/client_login_handler.rb +0 -0
- data/lib/ads_common/auth/oauth2_handler.rb +0 -0
- data/lib/ads_common/auth/oauth2_jwt_handler.rb +0 -0
- data/lib/ads_common/build/savon_abstract_generator.rb +0 -0
- data/lib/ads_common/build/savon_generator.rb +0 -0
- data/lib/ads_common/build/savon_registry.rb +0 -0
- data/lib/ads_common/build/savon_registry_generator.rb +0 -0
- data/lib/ads_common/build/savon_service_generator.rb +0 -0
- data/lib/ads_common/config.rb +0 -0
- data/lib/ads_common/credential_handler.rb +0 -0
- data/lib/ads_common/errors.rb +0 -0
- data/lib/ads_common/http.rb +0 -0
- data/lib/ads_common/parameters_validator.rb +0 -0
- data/lib/ads_common/results_extractor.rb +0 -0
- data/lib/ads_common/savon_headers/base_header_handler.rb +0 -0
- data/lib/ads_common/savon_headers/oauth_header_handler.rb +0 -0
- data/lib/ads_common/savon_service.rb +0 -0
- data/lib/ads_common/utils.rb +0 -0
- data/lib/ads_common/version.rb +1 -1
- data/test/test_config.yml +0 -0
- metadata +35 -29
- checksums.yaml +0 -15
- data/test/test_client_login_handler.rb +0 -131
data/COPYING
CHANGED
|
File without changes
|
data/ChangeLog
CHANGED
data/README.md
CHANGED
|
File without changes
|
data/lib/ads_common/api.rb
CHANGED
|
@@ -24,7 +24,6 @@ require 'logger'
|
|
|
24
24
|
require 'ads_common/config'
|
|
25
25
|
require 'ads_common/errors'
|
|
26
26
|
require 'ads_common/utils'
|
|
27
|
-
require 'ads_common/auth/client_login_handler'
|
|
28
27
|
require 'ads_common/auth/oauth2_handler'
|
|
29
28
|
require 'ads_common/auth/oauth2_jwt_handler'
|
|
30
29
|
|
|
@@ -192,16 +191,6 @@ module AdsCommon
|
|
|
192
191
|
def create_auth_handler()
|
|
193
192
|
auth_method = @config.read('authentication.method', :OAUTH2)
|
|
194
193
|
return case auth_method
|
|
195
|
-
when :CLIENTLOGIN
|
|
196
|
-
@logger.warn("ClientLogin authentication method is now deprecated" +
|
|
197
|
-
" and will be removed in the future. Consider migration to" +
|
|
198
|
-
" OAuth2. See 'https://developers.google.com/accounts/docs/" +
|
|
199
|
-
"AuthForInstalledApps' for more details.")
|
|
200
|
-
AdsCommon::Auth::ClientLoginHandler.new(
|
|
201
|
-
@config,
|
|
202
|
-
api_config.client_login_config(:AUTH_SERVER),
|
|
203
|
-
api_config.client_login_config(:LOGIN_SERVICE_NAME)
|
|
204
|
-
)
|
|
205
194
|
when :OAUTH
|
|
206
195
|
raise AdsCommon::Errors::Error,
|
|
207
196
|
'OAuth authorization method is deprecated, use OAuth2 instead.'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/ads_common/config.rb
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/ads_common/errors.rb
CHANGED
|
File without changes
|
data/lib/ads_common/http.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/ads_common/utils.rb
CHANGED
|
File without changes
|
data/lib/ads_common/version.rb
CHANGED
data/test/test_config.yml
CHANGED
|
File without changes
|
metadata
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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.7
|
|
5
|
+
prerelease:
|
|
5
6
|
platform: ruby
|
|
6
7
|
authors:
|
|
7
8
|
- Sergio Gomes
|
|
@@ -9,11 +10,12 @@ authors:
|
|
|
9
10
|
autorequire:
|
|
10
11
|
bindir: bin
|
|
11
12
|
cert_chain: []
|
|
12
|
-
date:
|
|
13
|
+
date: 2015-02-19 00:00:00.000000000 Z
|
|
13
14
|
dependencies:
|
|
14
15
|
- !ruby/object:Gem::Dependency
|
|
15
16
|
name: savon
|
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
|
18
|
+
none: false
|
|
17
19
|
requirements:
|
|
18
20
|
- - ~>
|
|
19
21
|
- !ruby/object:Gem::Version
|
|
@@ -21,6 +23,7 @@ dependencies:
|
|
|
21
23
|
type: :runtime
|
|
22
24
|
prerelease: false
|
|
23
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
none: false
|
|
24
27
|
requirements:
|
|
25
28
|
- - ~>
|
|
26
29
|
- !ruby/object:Gem::Version
|
|
@@ -28,6 +31,7 @@ dependencies:
|
|
|
28
31
|
- !ruby/object:Gem::Dependency
|
|
29
32
|
name: httpi
|
|
30
33
|
requirement: !ruby/object:Gem::Requirement
|
|
34
|
+
none: false
|
|
31
35
|
requirements:
|
|
32
36
|
- - ~>
|
|
33
37
|
- !ruby/object:Gem::Version
|
|
@@ -35,6 +39,7 @@ dependencies:
|
|
|
35
39
|
type: :runtime
|
|
36
40
|
prerelease: false
|
|
37
41
|
version_requirements: !ruby/object:Gem::Requirement
|
|
42
|
+
none: false
|
|
38
43
|
requirements:
|
|
39
44
|
- - ~>
|
|
40
45
|
- !ruby/object:Gem::Version
|
|
@@ -42,6 +47,7 @@ dependencies:
|
|
|
42
47
|
- !ruby/object:Gem::Dependency
|
|
43
48
|
name: signet
|
|
44
49
|
requirement: !ruby/object:Gem::Requirement
|
|
50
|
+
none: false
|
|
45
51
|
requirements:
|
|
46
52
|
- - ~>
|
|
47
53
|
- !ruby/object:Gem::Version
|
|
@@ -49,6 +55,7 @@ dependencies:
|
|
|
49
55
|
type: :runtime
|
|
50
56
|
prerelease: false
|
|
51
57
|
version_requirements: !ruby/object:Gem::Requirement
|
|
58
|
+
none: false
|
|
52
59
|
requirements:
|
|
53
60
|
- - ~>
|
|
54
61
|
- !ruby/object:Gem::Version
|
|
@@ -60,70 +67,69 @@ executables: []
|
|
|
60
67
|
extensions: []
|
|
61
68
|
extra_rdoc_files: []
|
|
62
69
|
files:
|
|
63
|
-
- COPYING
|
|
64
|
-
- ChangeLog
|
|
65
|
-
- README.md
|
|
66
70
|
- lib/ads_common/api.rb
|
|
67
|
-
- lib/ads_common/
|
|
68
|
-
- lib/ads_common/
|
|
71
|
+
- lib/ads_common/version.rb
|
|
72
|
+
- lib/ads_common/errors.rb
|
|
69
73
|
- lib/ads_common/auth/client_login_handler.rb
|
|
74
|
+
- lib/ads_common/auth/base_handler.rb
|
|
70
75
|
- lib/ads_common/auth/oauth2_handler.rb
|
|
71
76
|
- lib/ads_common/auth/oauth2_jwt_handler.rb
|
|
72
|
-
- lib/ads_common/
|
|
73
|
-
- lib/ads_common/
|
|
77
|
+
- lib/ads_common/credential_handler.rb
|
|
78
|
+
- lib/ads_common/api_config.rb
|
|
79
|
+
- lib/ads_common/utils.rb
|
|
80
|
+
- lib/ads_common/build/savon_service_generator.rb
|
|
74
81
|
- lib/ads_common/build/savon_registry.rb
|
|
75
82
|
- lib/ads_common/build/savon_registry_generator.rb
|
|
76
|
-
- lib/ads_common/build/
|
|
83
|
+
- lib/ads_common/build/savon_abstract_generator.rb
|
|
84
|
+
- lib/ads_common/build/savon_generator.rb
|
|
77
85
|
- lib/ads_common/config.rb
|
|
78
|
-
- lib/ads_common/credential_handler.rb
|
|
79
|
-
- lib/ads_common/errors.rb
|
|
80
|
-
- lib/ads_common/http.rb
|
|
81
86
|
- lib/ads_common/parameters_validator.rb
|
|
82
|
-
- lib/ads_common/results_extractor.rb
|
|
83
87
|
- lib/ads_common/savon_headers/base_header_handler.rb
|
|
84
88
|
- lib/ads_common/savon_headers/oauth_header_handler.rb
|
|
89
|
+
- lib/ads_common/results_extractor.rb
|
|
90
|
+
- lib/ads_common/http.rb
|
|
85
91
|
- lib/ads_common/savon_service.rb
|
|
86
|
-
- lib/ads_common/utils.rb
|
|
87
|
-
- lib/ads_common/version.rb
|
|
88
|
-
- test/coverage.rb
|
|
89
92
|
- test/suite_unittests.rb
|
|
90
|
-
- test/
|
|
93
|
+
- test/coverage.rb
|
|
94
|
+
- test/test_results_extractor.rb
|
|
91
95
|
- test/test_config.rb
|
|
92
|
-
- test/
|
|
96
|
+
- test/test_utils.rb
|
|
93
97
|
- test/test_credential_handler.rb
|
|
94
|
-
- test/test_parameters_validator.rb
|
|
95
|
-
- test/test_results_extractor.rb
|
|
96
98
|
- test/test_savon_service.rb
|
|
97
|
-
- test/
|
|
99
|
+
- test/test_config.yml
|
|
100
|
+
- test/test_parameters_validator.rb
|
|
101
|
+
- COPYING
|
|
102
|
+
- README.md
|
|
103
|
+
- ChangeLog
|
|
98
104
|
homepage: http://code.google.com/p/google-api-ads-ruby/
|
|
99
105
|
licenses:
|
|
100
106
|
- Apache-2.0
|
|
101
|
-
metadata: {}
|
|
102
107
|
post_install_message:
|
|
103
108
|
rdoc_options: []
|
|
104
109
|
require_paths:
|
|
105
110
|
- lib
|
|
106
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
|
+
none: false
|
|
107
113
|
requirements:
|
|
108
114
|
- - ! '>='
|
|
109
115
|
- !ruby/object:Gem::Version
|
|
110
116
|
version: '0'
|
|
111
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
|
+
none: false
|
|
112
119
|
requirements:
|
|
113
120
|
- - ! '>='
|
|
114
121
|
- !ruby/object:Gem::Version
|
|
115
122
|
version: 1.3.6
|
|
116
123
|
requirements: []
|
|
117
124
|
rubyforge_project: google-ads-common
|
|
118
|
-
rubygems_version:
|
|
125
|
+
rubygems_version: 1.8.23
|
|
119
126
|
signing_key:
|
|
120
|
-
specification_version:
|
|
127
|
+
specification_version: 3
|
|
121
128
|
summary: Common code for Google Ads APIs
|
|
122
129
|
test_files:
|
|
130
|
+
- test/test_results_extractor.rb
|
|
131
|
+
- test/test_config.rb
|
|
123
132
|
- test/test_utils.rb
|
|
124
133
|
- test/test_credential_handler.rb
|
|
125
|
-
- test/test_parameters_validator.rb
|
|
126
|
-
- test/test_client_login_handler.rb
|
|
127
|
-
- test/test_results_extractor.rb
|
|
128
134
|
- test/test_savon_service.rb
|
|
129
|
-
- test/
|
|
135
|
+
- test/test_parameters_validator.rb
|
checksums.yaml
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
!binary "U0hBMQ==":
|
|
3
|
-
metadata.gz: !binary |-
|
|
4
|
-
Y2VjOTE1ODA4OGQzOGY2NmU4MDczOWE4OTYwMzUwMDgzNTg3YzU0OQ==
|
|
5
|
-
data.tar.gz: !binary |-
|
|
6
|
-
MzFiODExZTFhOTQ3OGI5NzU3NWFmYzRiYzZmOWRkOGFjYjhkM2U0NQ==
|
|
7
|
-
SHA512:
|
|
8
|
-
metadata.gz: !binary |-
|
|
9
|
-
ZWE4MDc2MTQzNjEyMDRhNzE2ZjhkZTI0ODhjM2Y3ZDIzMDAyMjIyZmYyNThi
|
|
10
|
-
Y2JjODZjNjQ3ZmNkZGZjZDA0Mjk1YWUzMTZlNTVjMDBhZDNjNTAwOWQwZWY3
|
|
11
|
-
M2EwOTRiMzdhYzk5MDQ1M2JlOWFmOGMxODgwOWJhY2EyZDUzYTc=
|
|
12
|
-
data.tar.gz: !binary |-
|
|
13
|
-
ZWM4MmQxYTE0ODNjNTIzNDdjOTRjZTkzYTNhOGFiOWQ1N2ViNTdjNjkzOTQx
|
|
14
|
-
NDU0ZDIzNDJiZjcxM2FjZjg4ODI3OTFlY2I2MDFhMGRjZmM3MTIxNWRlZDQ4
|
|
15
|
-
NTUzMThkYWU1MmU1N2U5YWFkZDQxNTc2MWI4NzRlNDMxYzkxNTA=
|
|
@@ -1,131 +0,0 @@
|
|
|
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
|
-
# Tests client login handler methods.
|
|
22
|
-
|
|
23
|
-
require 'test/unit'
|
|
24
|
-
|
|
25
|
-
require 'ads_common/config'
|
|
26
|
-
require 'ads_common/auth/client_login_handler'
|
|
27
|
-
|
|
28
|
-
module AdsCommon
|
|
29
|
-
module Auth
|
|
30
|
-
class ClientLoginHandler
|
|
31
|
-
|
|
32
|
-
public :parse_token_text
|
|
33
|
-
public :handle_login_error
|
|
34
|
-
public :validate_credentials
|
|
35
|
-
public :create_token_from_string
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
# Stub class for HTTP response.
|
|
42
|
-
class ResponseStub
|
|
43
|
-
|
|
44
|
-
attr_reader :code
|
|
45
|
-
attr_reader :body
|
|
46
|
-
|
|
47
|
-
def initialize(code, body)
|
|
48
|
-
@code, @body = code, body
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
class TestClientLoginHandler < Test::Unit::TestCase
|
|
53
|
-
|
|
54
|
-
def setup()
|
|
55
|
-
config = AdsCommon::Config.new({})
|
|
56
|
-
@handler = AdsCommon::Auth::ClientLoginHandler.new(
|
|
57
|
-
config, 'http://www.google.com', 'adwords')
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def test_handle_login_error_captcha()
|
|
61
|
-
assert_raises (AdsCommon::Errors::CaptchaRequiredError) do
|
|
62
|
-
response = ResponseStub.new(403, '')
|
|
63
|
-
results = {
|
|
64
|
-
'Error' => 'CaptchaRequired',
|
|
65
|
-
'CaptchaUrl' => '/account/test-captcha'
|
|
66
|
-
}
|
|
67
|
-
@handler.handle_login_error({}, response, results)
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def test_handle_login_error_other()
|
|
72
|
-
assert_raises(AdsCommon::Errors::AuthError) do
|
|
73
|
-
response = ResponseStub.new(403, 'Body')
|
|
74
|
-
results = {'Error' => 'SomeError', 'Info' => 'SomeInfo'}
|
|
75
|
-
@handler.handle_login_error({}, response, results)
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def test_parse_token_text_simple()
|
|
80
|
-
error_str = "BadAuthentication"
|
|
81
|
-
text = "Error=%s\n" % error_str
|
|
82
|
-
result = @handler.parse_token_text(text)
|
|
83
|
-
assert_equal(error_str, result['Error'])
|
|
84
|
-
assert_equal(['Error'], result.keys)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def test_parse_token_text_captcha()
|
|
88
|
-
captcha_token = "3u6_27iOel71j525g2tg252ge6t35g345XJtRuHYEYiTyAxsMPz2222442"
|
|
89
|
-
captcha_url = "Captcha?ctoken=3u245245rgfwrg5g2fw5x3xGqQBrk_AoXXJtRuHY%3a-V"
|
|
90
|
-
error_str = "CaptchaRequired"
|
|
91
|
-
url_str = "https://www.google.com/accounts/ErrorMsg?Email=example%40goog" +
|
|
92
|
-
"le.com&service=adwords&id=cr&timeStmp=1327400499&secTok=.AG5fkgtw45" +
|
|
93
|
-
"25gfref25gttrefwwrPeB8Xw%3D%3D"
|
|
94
|
-
text = "CaptchaToken=%s\nCaptchaUrl=%s\nError=%s\nUrl=%s\n" %
|
|
95
|
-
[captcha_token, captcha_url, error_str, url_str]
|
|
96
|
-
result = @handler.parse_token_text(text)
|
|
97
|
-
assert_equal(captcha_token, result['CaptchaToken'])
|
|
98
|
-
assert_equal(captcha_url, result['CaptchaUrl'])
|
|
99
|
-
assert_equal(error_str, result['Error'])
|
|
100
|
-
assert_equal(url_str, result['Url'])
|
|
101
|
-
assert_equal(['CaptchaToken', 'CaptchaUrl', 'Error', 'Url'],
|
|
102
|
-
result.keys.sort)
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def test_validate_credentials_valid()
|
|
106
|
-
credentials1 = {:email => 'email@example.com', :password => 'qwerty'}
|
|
107
|
-
credentials2 = {:auth_token => 'QazSWXEDEDCE434234'}
|
|
108
|
-
assert_nothing_raised do
|
|
109
|
-
@handler.validate_credentials(credentials1)
|
|
110
|
-
end
|
|
111
|
-
assert_nothing_raised do
|
|
112
|
-
@handler.validate_credentials(credentials2)
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
def test_validate_credentials_invalid()
|
|
117
|
-
credentials1 = {:email => 'email@example.com'}
|
|
118
|
-
credentials2 = {:password => 'qwerty'}
|
|
119
|
-
assert_raises(AdsCommon::Errors::AuthError) do
|
|
120
|
-
@handler.validate_credentials(credentials1)
|
|
121
|
-
end
|
|
122
|
-
assert_raises(AdsCommon::Errors::AuthError) do
|
|
123
|
-
@handler.validate_credentials(credentials2)
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
def test_create_token_from_string()
|
|
128
|
-
test_text = 'fooBar'
|
|
129
|
-
assert_equal(test_text, @handler.create_token_from_string(test_text))
|
|
130
|
-
end
|
|
131
|
-
end
|