ip2k / google-api-ruby-client

Automatically exported from code.google.com/p/google-api-ruby-client
Apache License 2.0
0 stars 0 forks source link

ApiClient does not recognize api_methods with camel case #64

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It appears to be one of the only calls I could find in the google apis, but for 
the new YouTube v3 they have a camel case call to the method playlistItems. I 
noticed they changed this from a previous document which had this in all 
lowercase. However, this seems to be causing issues, here is the error I 
receive. 

undefined method `playlistItems' for #<Google::APIClient::API:0x3fce74cb6948 
ID:youtube:v3alpha>

Here is the code to exectute

youtube = api_client.discovered_api('youtube', 'v3alpha')

video_result = api_client.execute!({
    :api_method => youtube.playlistItems.list,
    :parameters => {'playlistId' => yt_uploads,
      'part' => 'id,contentDetails'
    }
  })

I tried removing the downcase calls in the api_client just to see if it was a 
quick fix, but it didn't seem to solve my issues. It could be something else, 
but this is the only method that has problems and it is in the most recent 
document located here https://discovery-check.appspot.com/youtube/v3alpha

Original issue reported on code.google.com by dafr...@gmail.com on 27 Sep 2012 at 11:39

GoogleCodeExporter commented 9 years ago
Workaround: I was able to get the call to work by passing the method in as a 
string and letting the client pull the discovery document

video_result = api_client.execute!({
    :api_method => "youtube.playlistItems.list", :version =>'v3alpha',
    :parameters => {'playlistId' => yt_uploads,
      'part' => 'id,contentDetails'
    }
  })

Original comment by dafr...@gmail.com on 28 Sep 2012 at 12:55

GoogleCodeExporter commented 9 years ago
The method is there, its just that the ruby API converts camel case to snake 
case. In this case, you should use youtube.playlist_items.list instead.

Original comment by sba...@google.com on 4 Oct 2012 at 11:02