Code Monkey home page Code Monkey logo

fakebook's Introduction

Fakebook

Fakebook simulates the Facebook platform, to aid in developing Facebook canvas apps offline. It takes a request and passes it to the app as a POST with the fb_sig_* params added, etc. The response is returned with FBML parsed (sort of) and some chrome added.

In other words: you can work on Facebook canvas apps when you’re on a plane.

To use, run ‘fakebook’ from the command line to start up a Fakebook proxy. For example, if you have an app running on port 3000, and the callback path is “/”, and the canvas path is “myapp”, you would run:

$ fakebook --callback="http://localhost:3000/" --canvas="myapp"

See “fakebook –help” for more options. By default, Fakebook will look for a config file at ./config/fakebook.yml. The file should look like this:

callback: http://localhost:3000/
canvas:   myapp
secret:   secret
user:     1
session:  session_key
friends:  2, 3, 4
host:     0.0.0.0
port:     5000

You can also use the library directly with the Fakebook class, which eases testing:

require 'fakebook'
app = Fakebook.new :callback  => "http://localhost:3000/",
                   :canvas    => "myapp",
                   :secret    => "secret",
                   :fb_params => { :user => 1, :session_key => 'session_key', :friends => [2, 3, 4] }
app.request("/")

Because Fakebook implements #call according to the Rack specification, you can create an HTTP server that proxies to your application using your choice of server library (Mongrel, WEBrick, Thin, etc.) For example:

require 'fakebook'
app = Fakebook.new # etc...
Rack::Handler::Mongrel.run app, :Port => 5000

Getting started

To install via RubyGems:

$ sudo gem install sco-fakebook --source http://gems.github.com/

Run the executable to see the available options:

$ fakebook --help

To install the development version from the repository:

$ wget http://github.com/sco/fakebook/tarball/master
$ tar -xvf sco-fakebook-master.tar.gz
$ cd sco-fakebook-master
$ sudo rake install_gem

Dependencies

Ruby Rack >= 0.3.0

Author

Scott Raymond <[email protected]>

Thanks to PackRat, from which this code was extracted.

fakebook's People

Contributors

sco avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.