google-ads-common 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +3 -0
- data/lib/ads_common/api.rb +1 -0
- data/lib/ads_common/savon_service.rb +2 -5
- data/lib/ads_common/utils.rb +37 -0
- data/lib/ads_common/version.rb +1 -1
- data/test/test_utils.rb +57 -0
- metadata +7 -4
data/ChangeLog
CHANGED
data/lib/ads_common/api.rb
CHANGED
@@ -67,11 +67,8 @@ module AdsCommon
|
|
67
67
|
wsdl.namespace = namespace
|
68
68
|
AdsCommon::Http.configure_httpi(@config, httpi)
|
69
69
|
end
|
70
|
-
|
71
|
-
|
72
|
-
config.log_level = :debug
|
73
|
-
config.logger = get_logger()
|
74
|
-
end
|
70
|
+
client.config.raise_errors = false
|
71
|
+
client.config.logger.subject = get_logger()
|
75
72
|
return client
|
76
73
|
end
|
77
74
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
#
|
3
|
+
# Authors:: api.dklimkin@gmail.com (Danial Klimkin)
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright 2012, 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
|
+
# Misc utilities.
|
21
|
+
|
22
|
+
module AdsCommon
|
23
|
+
module Utils
|
24
|
+
module String
|
25
|
+
|
26
|
+
# Returns the String in lowerCamelCase.
|
27
|
+
def lower_camelcase()
|
28
|
+
result = dup()
|
29
|
+
result.gsub!(/^([A-Z])/) {$1.downcase()}
|
30
|
+
result.gsub!(/(?:_)([a-zA-Z\d])/) {$1.upcase()}
|
31
|
+
return result
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
String.send(:include, AdsCommon::Utils::String)
|
data/lib/ads_common/version.rb
CHANGED
data/test/test_utils.rb
ADDED
@@ -0,0 +1,57 @@
|
|
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 the utils.
|
22
|
+
|
23
|
+
require 'test/unit'
|
24
|
+
|
25
|
+
require 'ads_common/utils'
|
26
|
+
|
27
|
+
|
28
|
+
class TestUtils < Test::Unit::TestCase
|
29
|
+
|
30
|
+
def test_has_lower_camelcase()
|
31
|
+
assert('str'.respond_to?(:lower_camelcase))
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_lower_camelcase_works()
|
35
|
+
data = [
|
36
|
+
{:input => 'lowerCamelCase', :output => 'lowerCamelCase'},
|
37
|
+
{:input => 'UpperCamelCase', :output => 'upperCamelCase'},
|
38
|
+
{:input => 'snake_case', :output => 'snakeCase'},
|
39
|
+
{:input => 'single1', :output => 'single1'},
|
40
|
+
{:input => 'Single2', :output => 'single2'},
|
41
|
+
{:input => '', :output => ''},
|
42
|
+
{:input => 'strange_MixOf_all', :output => 'strangeMixOfAll'},
|
43
|
+
{:input => 'number_5', :output => 'number5'},
|
44
|
+
]
|
45
|
+
data.each do |arg|
|
46
|
+
result = arg[:input].lower_camelcase()
|
47
|
+
assert_equal(arg[:output], result)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_lower_camelcase_non_destructive()
|
52
|
+
str = 'str_snake'
|
53
|
+
result = str.lower_camelcase()
|
54
|
+
assert_not_same(str, result)
|
55
|
+
assert_equal('str_snake', str)
|
56
|
+
end
|
57
|
+
end
|
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.7.
|
4
|
+
version: 0.7.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-06-
|
13
|
+
date: 2012-06-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: savon
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.9.
|
22
|
+
version: 0.9.10
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: 0.9.
|
30
|
+
version: 0.9.10
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: httpclient
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,6 +84,7 @@ extensions: []
|
|
84
84
|
extra_rdoc_files: []
|
85
85
|
files:
|
86
86
|
- lib/ads_common/api.rb
|
87
|
+
- lib/ads_common/utils.rb
|
87
88
|
- lib/ads_common/version.rb
|
88
89
|
- lib/ads_common/credential_handler.rb
|
89
90
|
- lib/ads_common/savon_service.rb
|
@@ -111,6 +112,7 @@ files:
|
|
111
112
|
- test/test_credential_handler.rb
|
112
113
|
- test/test_client_login_handler.rb
|
113
114
|
- test/test_parameters_validator.rb
|
115
|
+
- test/test_utils.rb
|
114
116
|
- test/test_config.rb
|
115
117
|
- test/test_config.yml
|
116
118
|
- COPYING
|
@@ -146,4 +148,5 @@ test_files:
|
|
146
148
|
- test/test_credential_handler.rb
|
147
149
|
- test/test_client_login_handler.rb
|
148
150
|
- test/test_parameters_validator.rb
|
151
|
+
- test/test_utils.rb
|
149
152
|
- test/test_config.rb
|