Module: RestGraph::FacebookUtil
- Defined in:
- lib/rest-graph/facebook_util.rb
Constant Summary collapse
- PERMISSIONS =
%w[ publish_stream create_event rsvp_event sms offline_access publish_checkins user_about_me friends_about_me user_activities friends_activities user_birthday friends_birthday user_education_history friends_education_history user_events friends_events user_groups friends_groups user_hometown friends_hometown user_interests friends_interests user_likes friends_likes user_location friends_location user_notes friends_notes user_online_presence friends_online_presence user_photo_video_tags friends_photo_video_tags user_photos friends_photos user_relationships friends_relationships user_relationship_details friends_relationship_details user_religion_politics friends_religion_politics user_status friends_status user_videos friends_videos user_website friends_website user_work_history friends_work_history email read_friendlists manage_friendlists read_insights read_mailbox read_requests read_stream xmpp_login ads_management user_checkins friends_checkins manage_pages ]
- USER_PERMISSIONS =
PERMISSIONS.reject{|perm| perm.start_with?('friends_')}
Instance Method Summary collapse
- #fix_fql_multi(result) ⇒ Object
- #fix_permissions(result) ⇒ Object
- #permissions(uid, selected_permissions = PERMISSIONS) ⇒ Object
- #permissions_fql(uid, selected_permissions = PERMISSIONS) ⇒ Object
- #user_permissions(uid) ⇒ Object
Instance Method Details
#fix_fql_multi(result) ⇒ Object
49 50 51 |
# File 'lib/rest-graph/facebook_util.rb', line 49 def fix_fql_multi result result.inject({}){ |r, i| r[i['name']] = i['fql_result_set']; r } end |
#fix_permissions(result) ⇒ Object
53 54 55 56 |
# File 'lib/rest-graph/facebook_util.rb', line 53 def result # Hash[] is for ruby 1.8.7 result.first && Hash[result.first.select{ |k, v| v == 1 }].keys end |
#permissions(uid, selected_permissions = PERMISSIONS) ⇒ Object
58 59 60 61 |
# File 'lib/rest-graph/facebook_util.rb', line 58 def uid, =PERMISSIONS ( fql((uid, ), {}, :secret => true)) end |
#permissions_fql(uid, selected_permissions = PERMISSIONS) ⇒ Object
67 68 69 70 71 |
# File 'lib/rest-graph/facebook_util.rb', line 67 def uid, =PERMISSIONS sanitized_uid = uid.to_s.tr("'", '') selected = .join(',') "SELECT #{selected} FROM permissions where uid = '#{sanitized_uid}'" end |
#user_permissions(uid) ⇒ Object
63 64 65 |
# File 'lib/rest-graph/facebook_util.rb', line 63 def uid (uid, USER_PERMISSIONS) end |