I am using Koala gem to get user permissions.
permissions = client.get_connections('me', 'permissions')
=> [{"permission"=>"installed", "status"=>"granted"}, {"permission"=>"public_profile", "status"=>"granted"},
{"permission"=>"read_stream", "status"=>"granted"},
{"permission"=>"email", "status"=>"granted"},
{"permission"=>"read_insights", "status"=>"granted"},
{"permission"=>"manage_pages", "status"=>"granted"},
{"permission"=>"user_friends", "status"=>"granted"}]
I would like to parse that response to get granted permissions in simple string like: "email, read_stream, read_insights, user_friends"
I thought about:
permissions.map {|h| puts h.fetch('permission') if h.fetch('status') == 'granted'}
Aucun commentaire:
Enregistrer un commentaire