Comments (13)
+1
@fertobar Which kind of operation were you trying to perform? I had the same issue trying to create new campaign sitelinks. Same gem versions. Other mutate operations worked just fine.
from google-api-ads-ruby.
Hello,
Can you please attach or send me the full XML for your request and server response? Please make sure to remove sensitive data such as developer token and OAuth keys.
-Danial.
from google-api-ads-ruby.
Hi @lucke84 & @dklimkin!
I notice that similar code works in Rails 3.2.20,and fails with Rails 4.1 , 4.2, and similar Rails 4 versions. I think could be related with some gem dependency. May be Savon?
The query is very simple (based in Rails example) I get the authentication first and that works ok. Then I want to get the labels from one account:
#application_controller
config_filename = File.join(Rails.root, 'config', 'adwords_api.yml')
@api = DfpApi::Api.new(config_filename)
....
if token
credentials = @api.credential_handler
credentials.set_credential(:oauth2_token, token)
credentials.set_credential(:client_customer_id, selected_account)
end
....
#(in other controller):
statement = {:query => "LIMIT %d OFFSET %d" % [page_size, offset]}
page = label_service.get_labels_by_statement(statement) #exception here --> no implicit conversion of Fixnum into String
The query is not executed because the error run first.
According to the logger y see the exception occurs in the savon_service.rb:
# Executes SOAP action specified as a string with given arguments.
def execute_action(action_name, args, &block)
registry = get_service_registry()
validator = ParametersValidator.new(registry)
args = validator.validate_args(action_name, args) #Exception Here
....
from google-api-ads-ruby.
Gemfile.lock that works for me with Rails 3:
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.20)
actionpack (= 3.2.20)
mail (~> 2.5.4)
actionpack (3.2.20)
activemodel (= 3.2.20)
activesupport (= 3.2.20)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.20)
activesupport (= 3.2.20)
builder (~> 3.0.0)
activerecord (3.2.20)
activemodel (= 3.2.20)
activesupport (= 3.2.20)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.20)
activemodel (= 3.2.20)
activesupport (= 3.2.20)
activesupport (3.2.20)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
addressable (2.3.8)
akami (1.2.2)
gyoku (>= 0.4.0)
nokogiri
arel (3.0.3)
builder (3.0.4)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.9.1.1)
erubis (2.7.0)
execjs (2.5.2)
extlib (0.9.16)
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
google-ads-common (0.9.8)
httpi (~> 1.1.0)
savon (~> 1.2.0)
signet (~> 0.6.0)
google-dfp-api (0.9.4)
google-ads-common (~> 0.9.4)
gyoku (0.4.6)
builder (>= 2.1.2)
hike (1.2.3)
httpi (1.1.1)
rack
i18n (0.7.0)
journey (1.0.4)
jquery-rails (3.1.2)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.2)
jwt (1.4.1)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
mini_portile (0.6.2)
multi_json (1.11.0)
multi_xml (0.5.5)
multipart-post (2.0.0)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
nori (1.1.5)
oauth2 (1.0.0)
faraday (>= 0.8, < 0.10)
jwt (~> 1.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (~> 1.2)
polyglot (0.3.5)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.4)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (3.2.20)
actionmailer (= 3.2.20)
actionpack (= 3.2.20)
activerecord (= 3.2.20)
activeresource (= 3.2.20)
activesupport (= 3.2.20)
bundler (~> 1.0)
railties (= 3.2.20)
railties (3.2.20)
actionpack (= 3.2.20)
activesupport (= 3.2.20)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.4.2)
rdoc (3.12.2)
json (~> 1.4)
sass (3.4.13)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
savon (1.2.0)
akami (~> 1.2.0)
builder (>= 2.1.2)
gyoku (~> 0.4.5)
httpi (~> 1.1.0)
nokogiri (>= 1.4.0)
nori (~> 1.1.0)
wasabi (~> 2.5.0)
signet (0.6.0)
addressable (~> 2.3)
extlib (~> 0.9)
faraday (~> 0.9)
jwt (~> 1.0)
multi_json (~> 1.10)
sprockets (2.2.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.10)
thor (0.19.1)
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.43)
uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
wasabi (2.5.1)
httpi (~> 1.0)
nokogiri (>= 1.4.0)
PLATFORMS
ruby
DEPENDENCIES
coffee-rails (~> 3.2.1)
google-dfp-api (~> 0.9.4)
jquery-rails
oauth2
rails (= 3.2.20)
sass-rails (~> 3.2.3)
sqlite3
uglifier (>= 1.0.3)
from google-api-ads-ruby.
Gemfile.lock that NOT works for me with Rails 4:
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.1.4)
actionpack (= 4.1.4)
actionview (= 4.1.4)
mail (~> 2.5.4)
actionpack (4.1.4)
actionview (= 4.1.4)
activesupport (= 4.1.4)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
actionview (4.1.4)
activesupport (= 4.1.4)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.1.4)
activesupport (= 4.1.4)
builder (~> 3.1)
activerecord (4.1.4)
activemodel (= 4.1.4)
activesupport (= 4.1.4)
arel (~> 5.0.0)
activesupport (4.1.4)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
addressable (2.3.8)
akami (1.2.2)
gyoku (>= 0.4.0)
nokogiri
arel (5.0.1.20140414130214)
builder (3.2.2)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.9.1.1)
erubis (2.7.0)
execjs (2.5.2)
extlib (0.9.16)
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
google-ads-common (0.9.8)
httpi (~> 1.1.0)
savon (~> 1.2.0)
signet (~> 0.6.0)
google-dfp-api (0.9.4)
google-ads-common (~> 0.9.4)
gyoku (0.4.6)
builder (>= 2.1.2)
hike (1.2.3)
httpi (1.1.1)
rack
i18n (0.7.0)
jbuilder (2.2.13)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
jquery-rails (3.1.2)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.2)
jwt (1.4.1)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
mini_portile (0.6.2)
minitest (5.6.0)
multi_json (1.11.0)
multi_xml (0.5.5)
multipart-post (2.0.0)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
nori (1.1.5)
oauth2 (1.0.0)
faraday (>= 0.8, < 0.10)
jwt (~> 1.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (~> 1.2)
polyglot (0.3.5)
rack (1.5.2)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.1.4)
actionmailer (= 4.1.4)
actionpack (= 4.1.4)
actionview (= 4.1.4)
activemodel (= 4.1.4)
activerecord (= 4.1.4)
activesupport (= 4.1.4)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.4)
sprockets-rails (~> 2.0)
railties (4.1.4)
actionpack (= 4.1.4)
activesupport (= 4.1.4)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rdoc (4.2.0)
json (~> 1.4)
sass (3.2.19)
sass-rails (4.0.5)
railties (>= 4.0.0, < 5.0)
sass (~> 3.2.2)
sprockets (~> 2.8, < 3.0)
sprockets-rails (~> 2.0)
savon (1.2.0)
akami (~> 1.2.0)
builder (>= 2.1.2)
gyoku (~> 0.4.5)
httpi (~> 1.1.0)
nokogiri (>= 1.4.0)
nori (~> 1.1.0)
wasabi (~> 2.5.0)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
signet (0.6.0)
addressable (~> 2.3)
extlib (~> 0.9)
faraday (~> 0.9)
jwt (~> 1.0)
multi_json (~> 1.10)
spring (1.3.4)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.2.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.10)
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
wasabi (2.5.1)
httpi (~> 1.0)
nokogiri (>= 1.4.0)
PLATFORMS
ruby
DEPENDENCIES
coffee-rails (~> 4.0.0)
google-dfp-api (~> 0.9.4)
jbuilder (~> 2.0)
jquery-rails
oauth2
rails (= 4.1.4)
sass-rails (~> 4.0.3)
sdoc (~> 0.4.0)
spring
sqlite3
turbolinks
uglifier (>= 1.3.0)
from google-api-ads-ruby.
@lucke84, @dklimkin! I notice the issue is related with DfpApi::CredentialHandler with the field issued_at. In the version that works, the field is Time so Time + 3600 works.
In the version that fails issued_at is a String, so String + 3600 fails in:
https://github.com/google/signet/blob/master/lib/signet/oauth_2/client.rb Line 748:
def expires_at
if @expires_at
@expires_at
elsif @issued_at && @expires_in
return @issued_at + @expires_in #TODO: @issued_at is String, String + Fixnum fails.
else
return nil
end
end
Any suggestion for try to fix?
thanks
from google-api-ads-ruby.
@fertobar You should probably create an issue at https://github.com/google/signet/issues and maybe send a PR to fix the issue :)
from google-api-ads-ruby.
thanks @lucke84 !
The point is I'm not sure if a signet issue, or a previous wrong setting in issued_at as String in ads commons, because same version of signet works ok with other Rails version.
Anyway I will add a new ticket.
I made a fork of the code and I try to fix for suggest a patch :)
from google-api-ads-ruby.
Hi @lucke84 and @dklimkin!
I could found a simple fix, that is working for me in Rails 4:
https://github.com/fertobar/google-api-ads-ruby
Do you think could works in the official gem?
Let me know if you think I can help :)
from google-api-ads-ruby.
Thanks for the research and proposed solution! I'll take a look at it and try to incorporate something similar in the next release of the official gem.
from google-api-ads-ruby.
thanks @mcloonan !
I Just added a small refactor with an improve of the conditional, suggested by @lucke84 :
fertobar@8874829
from google-api-ads-ruby.
This is fixed in version 0.9.9 of ads_common.
from google-api-ads-ruby.
I'm still getting the same error, but form Signet:
TypeError: no implicit conversion of Fixnum into String
from /Users/user/.rvm/gems/ruby-2.2.3/gems/signet-0.6.1/lib/signet/oauth_2/client.rb:771:in+' from /Users/user/.rvm/gems/ruby-2.2.3/gems/signet-0.6.1/lib/signet/oauth_2/client.rb:771:in
expires_at'
from /Users/user/.rvm/gems/ruby-2.2.3/gems/signet-0.6.1/lib/signet/oauth_2/client.rb:790:inexpired?' from /Users/user/.rvm/gems/ruby-2.2.3/gems/google-ads-common-0.11.1/lib/ads_common/auth/oauth2_handler.rb:87:in
get_token'
from /Users/user/.rvm/gems/ruby-2.2.3/gems/google-ads-common-0.11.1/lib/ads_common/auth/oauth2_handler.rb:79:inauth_string' from /Users/user/.rvm/gems/ruby-2.2.3/gems/google-ads-common-0.11.1/lib/ads_common/savon_headers/oauth_header_handler.rb:43:in
generate_headers'
from /Users/user/.rvm/gems/ruby-2.2.3/gems/google-ads-common-0.11.1/lib/ads_common/savon_headers/base_header_handler.rb:73:inprepare_request' from /Users/user/.rvm/gems/ruby-2.2.3/gems/google-ads-common-0.11.1/lib/ads_common/savon_service.rb:110:in
block in handle_soap_request'
from /Users/user/.rvm/gems/ruby-2.2.3/gems/google-ads-savon-1.0.1/lib/ads_savon/client.rb:129:inyield_objects' from /Users/user/.rvm/gems/ruby-2.2.3/gems/google-ads-savon-1.0.1/lib/ads_savon/client.rb:122:in
process'
from /Users/user/.rvm/gems/ruby-2.2.3/gems/google-ads-savon-1.0.1/lib/ads_savon/client.rb:84:inblock in request' from /Users/user/.rvm/gems/ruby-2.2.3/gems/google-ads-savon-1.0.1/lib/ads_savon/soap/request_builder.rb:56:in
call'
from /Users/user/.rvm/gems/ruby-2.2.3/gems/google-ads-savon-1.0.1/lib/ads_savon/soap/request_builder.rb:56:inrequest' from /Users/user/.rvm/gems/ruby-2.2.3/gems/google-ads-savon-1.0.1/lib/ads_savon/client.rb:86:in
request'
from /Users/user/.rvm/gems/ruby-2.2.3/gems/google-ads-common-0.11.1/lib/ads_common/savon_service.rb:108:inhandle_soap_request' from /Users/user/.rvm/gems/ruby-2.2.3/gems/google-ads-common-0.11.1/lib/ads_common/savon_service.rb:87:in
execute_action'
... 4 levels...
I saw in signet library that this was closed in 0.7 but the latest google-ads-common still tries to use signet 0.6.0 so this isn't fixed or maybe I'm missing something.
google-ads-common (0.11.1)
google-ads-savon (> 1.0.0)> 2.3)
httpi (
signet (~> 0.6.0)
from google-api-ads-ruby.
Related Issues (20)
- Support for incremental oauth
- ReportableType is unexpected when creating CustomTargetingKey HOT 1
- Creating Callout Extensions in Adwords HOT 1
- Occurred error after entering verification code
- How to perform authentication client side? HOT 2
- Got "Unable to parse response body" from Ruby ad manager api HOT 3
- File permissions issue in google-dfp-api-1.11.0 and google-dfp-api-1.12.0 gems HOT 6
- `download_report_as_stream` ignores HTTP status code HOT 1
- GoogleAdsSavon::SOAP::InvalidResponseError Unable to parse response body HOT 2
- process GoogleAdsService.Search() never ends HOT 1
- Click Performance Report API endpoint failing with a Zlib buffer Error HOT 5
- Support Rails 6.1 HOT 5
- Will this library be sunset with Google AdWords API? HOT 1
- google-dfp-api gem 1.15.0 not compatible with Rails 5.2 HOT 1
- How to install google-adwords-api for version of Ruby lower than 2.2.2 HOT 1
- Default branch is now main
- My dreams officiall pakistan
- Out-Of-Band EOL
- Passing stateful information in initial authorization request? HOT 1
- 2.4.0 uses v202305 API version of Google Ad Manager, not v202308 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-api-ads-ruby.