Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [ANN] rest-graph 1.1.1 - A super simple Facebook Open Graph API client

Reply
Thread Tools

[ANN] rest-graph 1.1.1 - A super simple Facebook Open Graph API client

 
 
Lin Jen-Shin
Guest
Posts: n/a
 
      05-21-2010
= rest-graph 1.1.1
by Cardinal Blue ( http://cardinalblue.com )

== LINKS:

* http://github.com/cardinalblue/rest-graph
* http://rubygems.org/gems/rest-graph
* http://rdoc.info/projects/cardinalblue/rest-graph

== DESCRIPTION:

A super simple Facebook Open Graph API client

== FEATURES:

* Simple graph api call
* Simple fql call
* Utility to extract access_token and check sig in cookies

== CHANGES in 1.1.1
* Add oauth realted utilites -- authorize_url and authorize!
* Fixed a bug that in Ruby 1.8.7-, nil =~ /regexp/ equals to false.
It is nil as expected in Ruby 1.9.1+

== SYNOPSIS:

require 'rest-graph'

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

rg.get('me') # GET https://graph.facebook.com/me?access_token=...
rg.get('4/likes') # GET https://graph.facebook.com/4/likes?access_token=...

# GET https://graph.facebook.com/search?q=...&access_token=...
rg.get('search', :q => 'taiwan')

# GET https://graph.facebook.com/me?metadata=1&access_token=...
rg.get('me', :metadata => '1')

# POST https://graph.facebook.com/feed/me?m...&access_token=...
rg.post('feed/me', :message => 'bread!')

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

# fql query, same as:
# GET https://api.facebook.com/method/fql.query?query=
# SELECT+name+FROM+page+WHERE+page_id%3D%22123%22&
# format=json&access_token=...
rg.fql('SELECT name FROM page WHERE page_id="123"')

# default setting:
class RestGraph
def self.default_app_id
'456'
end

def self.default_secret
'category theory'
end
end

# auto load config
require 'rest-graph'
require 'rest-graph/auto_load' # under Rails, load config/rest-
graph.yaml
RestGraph.new # all default options would honor
config
RestGraph.new(:app_id => '123') # default could be override as well

# manually load config
require 'rest-graph/load_config'
RestGraph::LoadConfig.load_config!('path/to/rest-graph.yaml', 'env')

# see test/config/rest-graph.yaml for an example for config

# oauth utilites:
# https://graph.facebook.com/oauth/aut...client_id=...&
RestGraph.new.authorize_url(:redirect_uri => '...')

# get access token by:
# https://graph.facebook.com/oauth/access_token?code=...&
rg = RestGraph.new
rg.authorize!(:redirect_uri => '...', :code => 'zzz')
rg.access_token # your access_token is now available
rg.data['expires'] # other values as well

== 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)

== INSTALL:

> gem install rest-graph

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


== LICENSE:

Apache License 2.0

Copyright (c) 2010, Cardinal Blue

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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Facebook Graph API takeshi honda Python 2 02-19-2013 03:49 PM
[ANN] rest-graph 1.3.0 - A super simple Facebook Open Graph API client Lin Jen-Shin Ruby 0 06-11-2010 10:36 AM
[ANN] rest-graph 1.0.0 - super simple facebook open graph api client Lin Jen-Shin Ruby 0 05-06-2010 09:43 AM
super.super.super how? Java 24 02-24-2005 10:51 PM
GD::Graph: "mixed" graph doesn't recognize "area" graph type Emilio Mayorga Perl Misc 6 10-08-2003 02:14 AM



Advertisments