这个Ruby数据类型是什么?

时间:2014-09-21 22:32:44

标签: ruby-on-rails ruby google-oauth

在尝试获取Google Plus上的好友列表时,我尝试访问omniauth-google-oauth2返回的数据。根据此示例:Access Google Plus Contacts google-api-ruby-client and omniauth-google-oauth2

以下是我收到的内容。但是我不确定如何访问里面的数据......我将如何访问" totalItems"以及" ID"每个项目?

#<Google::APIClient::Schema::Plus::V1::PeopleFeed:0x3fe23371942c DATA:{"kind"=>"plus#peopleFeed", "etag"=>"\"L2Xbn8bDuSErT6QA3PEQiwYKQxM/mZ7BwKMAmnHq1YqeqfmoWNwqzeo\"", "title"=>"Google+ List of Connected People", "totalItems"=>1, "items"=>[{"kind"=>"plus#person", "etag"=>"\"L2Xbn8bDuSErT6QA3PEQiwYKQxM/MtyIlmmWQjDBCz3k5wZI9k7O4p8\"", "objectType"=>"person", "id"=>"118404349465393928176", "displayName"=>"Hélène Ponty", "url"=>"https://plus.google.com/118404349465393928176", "image"=>{"url"=>"https://lh6.googleusercontent.com/-9w6_N_yJ5zc/AAAAAAAAAAI/AAAAAAAAAeg/PnYBbkTFqYE/photo.jpg?sz=50"}}]}>

1 个答案:

答案 0 :(得分:2)

您可以尝试使用.methods.instance_methods获取所有可访问方法的列表(分别针对类和实例):

your_object.methods

your_object.instance_methods