[ANN] rest-graph 1.0.0 - super simple facebook open graph api client

Discussion in 'Ruby' started by Lin Jen-Shin, May 6, 2010.

  1. Lin Jen-Shin

    Lin Jen-Shin Guest

    =3D rest-graph 1.0.0
    by Lin Jen-Shin (aka godfat-=E7=9C=9F=E5=B8=B8[http://godfat.org])
    godfat (XD) godfat.org

    =3D=3D LINKS:

    * {github}[http://github.com/godfat/rest-graph]
    * {rubygems}[http://rubygems.org/gems/rest-graph]
    * {rdoc}[http://rdoc.info/projects/godfat/rest-graph]

    =3D=3D DESCRIPTION:

    super simple facebook open graph api client

    =3D=3D FEATURES:

    * simple graph api call
    * simple fql call
    * utility to extract access_token and check sig in cookies

    =3D=3D SYNOPSIS:

    require 'rest-graph'

    # every option is optional!!
    rg =3D RestGraph.new:)access_token =3D> '...',
    :graph_server =3D> 'https://graph.facebook.com/',
    :fql_server =3D> 'https://api.facebook.com/',
    :accept =3D> 'text/javascript',
    :lang =3D> 'en-us', # this affect search
    :auto_decode =3D> true, # decode by json
    :app_id =3D> '123',
    :secret =3D> '1829')
    rg.get('me')
    rg.post('feed/me', :message =3D> 'bread!')

    # for rack
    lambda{ |env|
    rg =3D RestGraph.new:)app_id =3D> '123', :secret =3D> '1829')
    rg.parse_rack_env!(env) # auto save access_token if sig checked
    rg.access_token # =3D> ...
    rg.data['uid'] # =3D> facebook uid
    }

    # for fully blown cookies hash
    rg =3D RestGraph.new:)app_id =3D> '123', :secret =3D> '1829')
    rg.parse_cookies!(cookies) # auto save access_token if sig checked
    rg.access_token # =3D> ...
    rg.data['uid'] # =3D> facebook uid

    # for fbs in cookies
    app_id =3D '456'
    rg =3D RestGraph.new:)app_id =3D> '123', :secret =3D> '1829')
    fbs =3D cookies["fbs_#{rg.app_id}"]
    rg.parse_fbs!(fbs) # auto save access_token if sig checked
    rg.access_token # =3D> ...
    rg.data['uid'] # =3D> facebook uid

    # fql query
    rg.fql('SELECT name FROM page WHERE page_id=3D"123"')

    =3D=3D REQUIREMENTS:

    * tested with MRI 1.8.7 and 1.9.1
    * gem install rest-client
    * gem install json (optional)
    * gem install json_pure (optional)
    * gem install rack (optional, to parse access_token in HTTP_COOKIE)

    =3D=3D INSTALL:

    > gem install rest-graph

    # or if you want rails plugin and bleeding edge
    > script/plugin install git://github.com/godfat/rest-graph.git


    =3D=3D LICENSE:

    Apache License 2.0

    Copyright (c) 2010, Lin Jen-Shin (aka godfat =E7=9C=9F=E5=B8=B8)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
    implied.
    See the License for the specific language governing permissions and
    limitations under the License.
     
    Lin Jen-Shin, May 6, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest

    super.super.super how?

    Guest, Feb 19, 2005, in forum: Java
    Replies:
    24
    Views:
    10,821
    Darryl Pierce
    Feb 24, 2005
  2. Dutt
    Replies:
    1
    Views:
    699
    Peter Bromberg [C# MVP]
    Feb 8, 2008
  3. Lin Jen-Shin
    Replies:
    0
    Views:
    293
    Lin Jen-Shin
    May 21, 2010
  4. Lin Jen-Shin
    Replies:
    0
    Views:
    315
    Lin Jen-Shin
    Jun 11, 2010
  5. Replies:
    2
    Views:
    152
Loading...

Share This Page