[#363639] Parsing geonames — 12 34 <rubyforum@...>

A Ruby newbie having trouble getting results back from geonames

16 messages 2010/06/02
[#363641] Re: Parsing geonames — Michael Fellinger <m.fellinger@...> 2010/06/02

On Wed, Jun 2, 2010 at 2:57 PM, 12 34 <rubyforum@web.knobby.ws> wrote:

[#363642] Re: Parsing geonames — 12 34 <rubyforum@...> 2010/06/02

Michael Fellinger wrote:

[#363646] installation issue with Ruby gems on Ubuntu 8.04 — Santosh Dvn <santoshdvn@...>

Hi I am installing ruby gems on ubuntu 8.04 .. while installing i got

14 messages 2010/06/02

[#363662] having a class method called only one time ? — unbewusst.sein@... (Une B騅ue)

I'd like having a class method called only one time ?

12 messages 2010/06/02

[#363756] comparing objects — Anderson Leite <andersonlfl@...>

How can I compare two objects and get true if some of his atributes are

48 messages 2010/06/03
[#364122] Re: comparing objects — Rein Henrichs <reinh@...> 2010/06/10

On 2010-06-10 06:59:40 -0700, Robert Dober said:

[#363764] Documenting Ruby 1.9: Ebook or Wiki? — Run Paint Run Run <runrun@...>

I'm writing a free ebook about Ruby 1.9 at http://ruby.runpaint.org/ .

17 messages 2010/06/04
[#363765] Re: Documenting Ruby 1.9: Ebook or Wiki? — Mohit Sindhwani <mo_mail@...> 2010/06/04

On 4/6/2010 11:30 AM, Run Paint Run Run wrote:

[#363775] Looking for ORM for 'legacy' database. — Dave Howell <groups.2009a@...>

I feel I should start with some pre-emptive apologies. I used to subscribe to this list, but haven't been reading it for a year or so, so I may have missed the answer to my question. (I did try finding it in the list archives, of course.) Also, I'm a little frustrated, and that might adversely influence the tone of this message. I'll try to avoid that, but I beg your forgiveness if I sound a little snide.

28 messages 2010/06/04
[#363895] Re: Looking for ORM for 'legacy' database. — Phrogz <phrogz@...> 2010/06/06

On Jun 4, 3:29m, Dave Howell <groups.20...@grandfenwick.net> wrote:

[#363975] Re: Looking for ORM for 'legacy' database. — Dave Howell <groups.2009a@...> 2010/06/07

[#363883] inject method of Array class — RichardSchollar <richardgschollar@...>

I have only just started using Ruby (and am a total noob, in case this

14 messages 2010/06/06

[#363944] Complex numbers contradiction? — Andrew Duncan <andrew.duncan@...>

This looks correct:

13 messages 2010/06/07
[#363951] Re: Complex numbers contradiction? — Robert Dober <robert.dober@...> 2010/06/07

On Mon, Jun 7, 2010 at 9:01 PM, Andrew Duncan <andrew.duncan@sonos.com> wrote:

[#364010] Rubyzip - `dup': can't dup NilClass (TypeError) — Luka Stolyarov <lukich@...>

Hello. I've trying to figure out rubyzip. Here's the code I had:

11 messages 2010/06/08

[#364101] Why private #binding? — Intransition <transfire@...>

Why is #binding a private method? I end up doing a lot of this:

13 messages 2010/06/10

[#364268] State of the union for Ruby CLI libraries? — John Feminella <johnf@...>

I am starting construction on a somewhat complicated internal

18 messages 2010/06/13

[#364273] Loading a module without polluting my namespace — Hagbard Celine <sin3141592@...>

Hey folks!

20 messages 2010/06/13

[#364330] shorthand — Roger Pack <rogerpack2005@...>

I read this once:

14 messages 2010/06/14

[#364342] Placement of require() and missing symbols — Eric MSP Veith <eveith@...>

-----BEGIN PGP SIGNED MESSAGE-----

16 messages 2010/06/15
[#364365] Re: Placement of require() and missing symbols — Kirk Haines <wyhaines@...> 2010/06/15

On Mon, Jun 14, 2010 at 7:18 PM, Eric MSP Veith

[#364371] datamapper blues — Martin DeMello <martindemello@...>

I'm investigating the use of DataMapper to convert an old project with

14 messages 2010/06/15

[#364402] Getting rid of self — Ralph Shnelvar <ralphs@...32.com>

22 messages 2010/06/16
[#364440] Re: Getting rid of self — Josh Cheek <josh.cheek@...> 2010/06/16

On Wed, Jun 16, 2010 at 4:31 AM, Ralph Shnelvar <ralphs@dos32.com> wrote:

[#364415] Android apps using ruby — Lakshmanan Muthukrishnan <lakshmanan@...>

Hi,

16 messages 2010/06/16
[#364439] Re: Android apps using ruby — Andrew Kaspick <akaspick@...> 2010/06/16

Lakshmanan Muthukrishnan wrote:

[#364479] Re: Android apps using ruby — Lakshmanan Muthukrishnan <lakshmanan@...> 2010/06/17

Andrew Kaspick wrote:

[#364496] nothing new in ruby_core for four days ? — Michel Demazure <michel@...>

The Ruby Core forum has no new entry since four days ago.

15 messages 2010/06/17
[#364498] Re: nothing new in ruby_core for four days ? — Brian Candler <b.candler@...> 2010/06/17

Michel Demazure wrote:

[#364529] Dear gem: still no zlib. — Dave Howell <groups.2009a@...>

I really really regret ever installing SnowLeopard.

16 messages 2010/06/17

[#364580] String comparison. Why does Ruby consider this true? — Abder-rahman Ali <abder.rahman.ali@...>

When I try for example to compare the following strings in Ruby, I get

13 messages 2010/06/18
[#364584] Re: String comparison. Why does Ruby consider this true? — Josh Cheek <josh.cheek@...> 2010/06/18

On Fri, Jun 18, 2010 at 12:46 PM, Abder-rahman Ali <

[#364628] Random Points within a Circle (#234) — Daniel Moore <yahivin@...>

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

21 messages 2010/06/19
[#364696] Re: [QUIZ] Random Points within a Circle (#234) — Caleb Clausen <vikkous@...> 2010/06/21

On 6/19/10, Daniel Moore <yahivin@gmail.com> wrote:

[#364641] Namespacing a class — Eric MSP Veith <eveith@...>

-----BEGIN PGP SIGNED MESSAGE-----

18 messages 2010/06/20

[#364815] Count substrings in string, scan too slow — Danny Challis <dannychallis@...>

Hello everyone,

18 messages 2010/06/24
[#364817] Re: Count substrings in string, scan too slow — Jes俍 Gabriel y Gal疣 <jgabrielygalan@...> 2010/06/24

On Thu, Jun 24, 2010 at 5:04 PM, Danny Challis <dannychallis@gmail.com> wrote:

[#364825] Re: Count substrings in string, scan too slow — Robert Klemme <shortcutter@...> 2010/06/24

2010/6/24 Jes俍 Gabriel y Gal疣 <jgabrielygalan@gmail.com>:

[#364850] Happy Intransition Day! — Ryan Davis <ryand-ruby@...>

Happy Intransition Day!

23 messages 2010/06/24

[#364930] Ruby in JavaScript, all projects are dead? — Alexey Petrushin <axyd80@...>

Hello, recently I've examined some of the projects that trying to bring

18 messages 2010/06/27

[#364988] Reading String Data as a File — Doug Jolley <ddjolley@...>

I use Net::HTTP to collect some data as a string. I now need to pass

25 messages 2010/06/29
[#364989] Re: Reading String Data as a File — Ryan Davis <ryand-ruby@...> 2010/06/29

[#364996] Re: Reading String Data as a File — Brian Candler <b.candler@...> 2010/06/29

Ryan Davis wrote:

[#365016] Re: Reading String Data as a File — Doug Jolley <ddjolley@...> 2010/06/29

> If it takes only a pathname argument, then you're

[#365024] Re: Reading String Data as a File — Tony Arcieri <tony.arcieri@...> 2010/06/29

On Tue, Jun 29, 2010 at 11:50 AM, Doug Jolley <ddjolley@gmail.com> wrote:

[#365036] Re: Reading String Data as a File — Robert Klemme <shortcutter@...> 2010/06/30

2010/6/29 Tony Arcieri <tony.arcieri@medioh.com>:

[#365049] Re: Reading String Data as a File — Brian Candler <b.candler@...> 2010/06/30

Robert Klemme wrote:

[#365039] pathname.rb:270: warning: `*' interpreted as argument prefix — "R.. Kumar 1.9.1 OSX" <sentinel1879@...>

/opt/local/lib/ruby1.9/1.9.1/pathname.rb:270: warning: `*' interpreted

12 messages 2010/06/30
[#365048] Re: pathname.rb:270: warning: `*' interpreted as argument prefix — Josh Cheek <josh.cheek@...> 2010/06/30

On Wed, Jun 30, 2010 at 6:11 AM, R.. Kumar 1.9.1 OSX <sentinel1879@gmail.com

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

From: Lin Jen-Shin <godfat@...>
Date: 2010-06-11 10:36:41 UTC
List: ruby-talk #364191
= rest-graph 1.3.0
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
* http://groups.google.com/group/rest-graph/topics

== 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.3.0

* Now rest-graph is rescuing all exceptions from rest-client.
* Added RestGraph#exchange_sessions to exchange old sessions to access
tokens.

* Added RestGraph#old_rest, see:
  http://developers.facebook.com/docs/reference/rest/

* Now all API request accept an additional options argument,
  you may pass :suppress_decode => true to turn off auto-decode this
time.
  e.g. rg.get('bad/json', {:query => 'string'}, :suppress_decode =>
true)
  This is for Facebook who didn't always return JSON in response.

* Renamed fql_server to old_server.
* Favor yaji/json_gem first, then falls back to json, and json_pure.
* Fixed a bug that cookie format from Facebook varies. No idea why.

for RailsUtil:

* Big and fat refactoring in RailsUtil, see example for detail:
  http://github.com/cardinalblue/rest-graph/tree/rest-graph-1.3.0/example
* url_for and link_to would auto pass :host option if it's inside
canvas.

== SYNOPSIS:

# If you feel SYNOPSIS is so hard to understand, please read
# {examples}[http://github.com/cardinalblue/rest-graph/tree/master/
example].

 require 'rest-graph'

 # Every option is optional.
 rg = RestGraph.new(:access_token => 'tok',
                    :graph_server => 'https://graph.facebook.com/',
                    :old_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' ,

  # This handler callback is only called if auto_decode is set to
true,
  # otherwise, it's ignored.
                    :error_handler =>
                      lambda{ |hash|
raise ::RestGraph::Error.new(hash) },

  # You might want to do this in Rails to do debug logging:
                    :log_handler =>
                      lambda{ |duration, url|
                        Rails.logger.debug("RestGraph "         \
                                           "spent #{duration} " \
                                           "requesting #{url}")
                      })

 # You might want to do redirect instead of raising an exception,
 # that is automatically redirect the user to authorization page
 # if the access token is unavailable. This way, you don't have to
 # check if the token is expired or not. If the token is expired,
 # it will automatically do authorization again. For that purpose,
 # you might want to include RestGraph::RailsUtil in your Rails'
 # controller. For example:
 class UserController < ApplicationController
   include RestGraph::RailsUtil
   before_filter :rest_graph_setup
 end
 # Please read:
 # {examples}[http://github.com/cardinalblue/rest-graph/tree/master/
example].
 # for more detail, and other frameworks utils wanted!

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

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

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

 # POST https://graph.facebook.com/me/feed?message=bread%21&access_token=tok
 rg.post('me/feed', :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"')

 # FQL multiquery, same as:
 # GET https://api.facebook.com/method/fql.multiquery?query=
 #     %7BSELECT+name+FROM+page+WHERE+page_id%3D%22123%22&%2C
 #        SELECT+name+FROM+page+WHERE+page_id%3D%22456%22&%7D
 #     format=json&access_token=...
 rg.fql_multi(:q1 => 'SELECT name FROM page WHERE page_id="123"',
              :q2 => 'SELECT name FROM page WHERE page_id="456"')

 # Setup default settings:
 module MyDefaults
   def default_app_id
     '456'
   end

   def default_secret
     'category theory'
   end
 end
 RestGraph.send(:extend, MyDefaults)

 # Automatically load config:
 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/authorize?client_id=123&
 RestGraph.new.authorize_url(:redirect_uri => 'http://w3.org/')

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

 # Exchange old session key for access token:
 # https://graph.facebook.com/oauth/exchange_sessions?sessions=sess
 rg.exchange_sessions(:sessions => params[:fb_sig_session_key])

 # Call Facebook's old REST API:
 rg.old_rest(
   'stream.publish',
   { :message    => 'Greetings',
     :attachment => {:name => 'Wikipedia',
                     :href => 'http://wikipedia.org/',
                     :caption => 'Wikipedia says hi.',
                     :media => [{:type => 'image',
                                 :src  => 'http://wikipedia.org/
favicon.ico',
                                 :href => 'http://wikipedia.org/'}]
                    }.to_json,
     :action_links => [{:text => 'Go to Wikipedia',
                        :href => 'http://wikipedia.org/'}
                      ].to_json
   },
   :suppress_decode => true)

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

In This Thread

Prev Next