I’m having trouble using the Google API Client on a ruby project.
I’m following the code example provided by google.
The README is here.
The source code you personalize is here.
It lays the foundations for a basic sinatra app which redirects you to Google where you can sign in and authorize the app to see your calendar information.
After that it directs you back to your app where I am met with the following error:
undefined method 'bytesize' for #<Faraday::Response:0x007f98f5beb668>
The trace hops from sinatra to thin to rack and back to sinatra – nothing really useful in there. I know the last code to be called from the app is:
result = @client.execute(:api_method => @calendar.events.list, :parameters => {'calendarId' => 'primary'})
I’ve seen some other stackoverflow posts similar to this but in those cases people are always defining their Faraday parameters themselves. Is this an issue with the Google API or does anyone have any suggestions where I might be doing something wrong?
Thanks
For those hitting the same problem: I have not found a solution. I have however successfully connected an app to the Google API and can access all the info and methods I want.
Decided to go about this with
omniauth. It’s really simple, there’s a railscast episode on how omniauth works, and a great walk through of using omniauth to connect to Google here. It describes specifically the act of connecting to the Google Calendar, but all you would need to do is change theclient.discovered_apisetter and theclient.executecall in the sessions_controller to which ever you want. Decent documentation and code examples at developers.google.com/google-apps/calendar/v3/reference/Best of luck.