googleapis / google-api-ruby-client

REST client for Google APIs
Apache License 2.0
2.81k stars 871 forks source link

How to use walletobject for save to android pay api? #608

Closed hshar7 closed 7 years ago

hshar7 commented 7 years ago

I am following https://developers.google.com/save-to-android-pay/samples/quickstart-ruby guide which uses https://github.com/android-pay/s2ap-quickstart-ruby this repository has not been updated to use the new version of google-api-client. I tested it and It still works with the old version client (<0.8).

I am trying to migrate this to the new version before implementing it in my system. However, I am not sure if the file https://github.com/android-pay/s2ap-quickstart-ruby/blob/master/wobs-discovery.json would work with the new file generation discovery. Currently when I run it I get a 'stack level too deep' error.

Any idea? I'm really not sure where to ask about this.

hshar7 commented 7 years ago

Anyone? This is a major blocker !

saicheems commented 7 years ago

This probably won't be merged/released today, but you can apply this fix locally. Let me know if it fixes your issue: https://github.com/google/google-api-ruby-client/pull/609

hshar7 commented 7 years ago

@saicheems thanks for submitting that pr in hopes to fix this issue but unfortunately my problem did not get fixed.

    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/model.rb:60:in `generated_type'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/model.rb:60:in `generated_type'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/model.rb:60:in `generated_type'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/model.rb:60:in `generated_type'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/model.rb:60:in `generated_type'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/model.rb:60:in `generated_type'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/model.rb:60:in `generated_type'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/model.rb:60:in `generated_type'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/model.rb:60:in `generated_type'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/model.rb:60:in `generated_type'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/model.rb:60:in `generated_type'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/model.rb:60:in `generated_type'
    (erb):13:in `block in to_binding'
    (erb):6:in `each'
    (erb):6:in `to_binding'
    /Users/hayderinsiderx.com/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/erb.rb:896:in `eval'
    /Users/hayderinsiderx.com/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/erb.rb:896:in `result'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/template.rb:119:in `render'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/template.rb:79:in `include'
    (erb):25:in `block in to_binding'
    (erb):24:in `each'
    (erb):24:in `to_binding'
    /Users/hayderinsiderx.com/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/erb.rb:896:in `eval'
    /Users/hayderinsiderx.com/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/erb.rb:896:in `result'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator/template.rb:119:in `render'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/lib/google/apis/generator.rb:54:in `render'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/bin/generate-api:87:in `generate_api'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/bin/generate-api:67:in `block (2 levels) in generate_from_file'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/bin/generate-api:66:in `open'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/bin/generate-api:66:in `block in generate_from_file'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/bin/generate-api:65:in `each'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/bin/generate-api:65:in `generate_from_file'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/bin/generate-api:40:in `gen'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
    /Users/hayderinsiderx.com/.rvm/gems/ruby-2.4.0/gems/google-api-client-0.13.1/bin/generate-api:115:in `<top (required)>'
saicheems commented 7 years ago

That PR hasn't been submitted yet, I'm still waiting for review -- did you cherry-pick that branch? (into your local google-api-client copy)

hshar7 commented 7 years ago

Yes I did, in my gemfile I specified gem 'google-api-client', github: 'saicheems/google-api-ruby-client', branch: 'rh'

hshar7 commented 7 years ago

Are you using the same file to test things out? https://github.com/android-pay/s2ap-quickstart-ruby/blob/master/wobs-discovery.json

saicheems commented 7 years ago

Yeah, is that stack trace from generating the client?

I copied the wobs-discovery.json file into the root of google-api-ruby-client and ran: bundle exec bin/generate-api gen generated/ --file=wobs-discovery.json

That successfully generates google/apis/walletobjects_v1 for me.

hshar7 commented 7 years ago

That worked! I think it wasn't working earlier because I was supplying my discovery file differently. I'm just glad it worked. Thank you so much @saicheems and I hope that pr gets accepted and published soon!