我正在使用通过api 版本 2查询的rMeetup gem ,但我不明白如何从响应中提取值。这是我卡住的地方(用于此示例):"members"
irb
>> require 'rmeetup'
=> true
>> client = RMeetup::Client.new do |config| config.api_key = "LALAMYKEYNOTYOURS" end
=> #<RMeetup::Client:0x007fbda4b58060 @configuration=#<RMeetup::Configuration:0x007fbda4b63fa0 @api_key="LALAMYKEYNOTYOURS">>
>> results = client.fetch(:groups, {:group_urlname => 'San-Francisco-Riak-Meetup'})
=> [#<RMeetup::Type::Group:0x007fbda4b80088 @group={"utc_offset"=>-25200000, "country"=>"US", "visibility"=>"public", "city"=>"San Francisco", "timezone"=>"US/Pacific", "created"=>1278976613000, "topics"=>[{"urlkey"=>"opensource", "name"=>"Open Source", "id"=>563}, {"urlkey"=>"web", "name"=>"Web Technology", "id"=>10209}, {"urlkey"=>"big-data", "name"=>"Big Data", "id"=>18062}, {"urlkey"=>"database-development", "name"=>"Database Development", "id"=>21506}, {"urlkey"=>"erlang-programming", "name"=>"Erlang Programming", "id"=>46514}, {"urlkey"=>"nosql", "name"=>"NoSQL", "id"=>58162}, {"urlkey"=>"riak", "name"=>"Riak", "id"=>112355}, {"urlkey"=>"distributed-systems", "name"=>"Distributed Systems", "id"=>113032}], "link"=>"http://www.meetup.com/San-Francisco-Riak-Meetup/", "rating"=>4.57, "description"=>"<p>A monthly meetup for those in the Bay Area to talk Riak, distributed systems, and app. development.</p>", "lon"=>-122.4000015258789, "group_photo"=>{"highres_link"=>"http://photos4.meetupstatic.com/photos/event/e/6/9/e/highres_16559038.jpeg", "photo_id"=>16559038, "photo_link"=>"http://photos4.meetupstatic.com/photos/event/e/6/9/e/600_16559038.jpeg", "thumb_link"=>"http://photos2.meetupstatic.com/photos/event/e/6/9/e/thumb_16559038.jpeg"}, "join_mode"=>"open", "organizer"=>{"member_id"=>140545442, "name"=>"Basho"}, "members"=>696, "name"=>"San Francisco Riak Meetup", "id"=>1674527, "state"=>"CA", "urlname"=>"San-Francisco-Riak-Meetup", "category"=>{"name"=>"tech", "id"=>34, "shortname"=>"tech"}, "lat"=>37.790000915527344, "who"=>"Riaktors"}>]
>> results.each do |k| puts k["members"] end
这可能是我对如何@group
在这个结果中查询的误解。尽管在 SO 和其他网站上有类似的问题,我还没有找到任何可以澄清它的东西。