Skip to content

mcls/fql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fql

Build Status Code Climate

Easily execute FQL queries with this gem.

Download and installation

The latest version of fql can be installed with RubyGems:

$ gem install fql

If you're using Bundler, you can add it to your Gemfile:

gem 'fql'

Examples

Exampe: a single query without access_token

  Fql.execute('SELECT first_name, last_name FROM user WHERE uid = 4')
  # => [{"first_name"=>"Mark", "last_name"=>"Zuckerberg"}]

Exampe: a multi query with an access_token

  options = { :access_token => "fb_access_token" }
  Fql.execute({
    "query1" => "SELECT uid, rsvp_status FROM event_member WHERE eid = 209798352393506 LIMIT 3",
    "query2" => "SELECT name FROM user WHERE uid IN (SELECT uid FROM #query1)"
  }, options)
  # => [{"name"=>"query1", "fql_result_set"=>[{"uid"=>712638919, "rsvp_status"=>"attending"}, {"uid"=>711903876, "rsvp_status"=>"attending"}, {"uid"=>711447283, "rsvp_status"=>"attending"}]}, {"name"=>"query2", "fql_result_set"=>[{"name"=>"Srikanth Nagandla"}, {"name"=>"Hinling Yeung"}, {"name"=>"G\u00F6khan Olgun"}]}]
  # Or the same result but formatted:
  # [
  #   {"name"=>"query1", "fql_result_set"=>[{"uid"=>712638919, "rsvp_status"=>"attending"}, {"uid"=>711903876, "rsvp_status"=>"attending"}, {"uid"=>711447283, "rsvp_status"=>"attending"}]}, 
  #   {"name"=>"query2", "fql_result_set"=>[{"name"=>"Srikanth Nagandla"}, {"name"=>"Hinling Yeung"}, {"name"=>"G\u00F6khan Olgun"}]}
  # ]

This project rocks and uses MIT-LICENSE.

About

Use the Facebook Query Language in Ruby

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages