google-ads-common 0.9.1 → 0.9.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 -1
- data/lib/ads_common/auth/oauth2_handler.rb +8 -3
- data/lib/ads_common/parameters_validator.rb +1 -1
- data/lib/ads_common/version.rb +1 -1
- metadata +2 -2
data/ChangeLog
CHANGED
data/lib/ads_common/api.rb
CHANGED
@@ -110,7 +110,7 @@ module AdsCommon
|
|
110
110
|
if token.nil?
|
111
111
|
begin
|
112
112
|
credentials = @credential_handler.credentials
|
113
|
-
token =
|
113
|
+
token = auth_handler.get_token(credentials)
|
114
114
|
rescue AdsCommon::Errors::OAuth2VerificationRequired => e
|
115
115
|
verification_code = (block_given?) ? yield(e.oauth_url) : nil
|
116
116
|
# Retry with verification code if one provided.
|
@@ -87,7 +87,12 @@ module AdsCommon
|
|
87
87
|
# Refreshes access token from refresh token.
|
88
88
|
def refresh_token!()
|
89
89
|
return nil if @token.nil? or @token[:refresh_token].nil?
|
90
|
-
|
90
|
+
begin
|
91
|
+
@client.refresh!
|
92
|
+
rescue Signet::AuthorizationError => e
|
93
|
+
raise AdsCommon::Errors::AuthError.new("OAuth2 token refresh failed",
|
94
|
+
e, (e.response.nil?) ? nil : e.response.body)
|
95
|
+
end
|
91
96
|
@token = token_from_client(@client)
|
92
97
|
return @token
|
93
98
|
end
|
@@ -207,8 +212,8 @@ module AdsCommon
|
|
207
212
|
client.code = verification_code
|
208
213
|
proxy = @config.read('connection.proxy')
|
209
214
|
connection = (proxy.nil?) ? nil : Faraday.new(:proxy => proxy)
|
210
|
-
|
211
|
-
|
215
|
+
client.fetch_access_token!(:connection => connection)
|
216
|
+
token = token_from_client(client)
|
212
217
|
end
|
213
218
|
rescue Signet::AuthorizationError => e
|
214
219
|
raise AdsCommon::Errors::AuthError,
|
@@ -62,7 +62,7 @@ module AdsCommon
|
|
62
62
|
key = field[:name]
|
63
63
|
item = args_hash[key]
|
64
64
|
check_required_argument_present(item, field)
|
65
|
-
|
65
|
+
unless item.nil?
|
66
66
|
original_name = field[:original_name]
|
67
67
|
if original_name
|
68
68
|
key = handle_name_override(args_hash, key, original_name)
|
data/lib/ads_common/version.rb
CHANGED
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.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: 2013-02-
|
13
|
+
date: 2013-02-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: savon
|