Ruby on Rails User Group Switzerland "Hock"

Zürich, Wednesday October 1st 2008

Sacha Schlegel

Agenda

Gnip

more info: Cedric Hüsler's BlogCamp 3.0 CH presentation
more info: Gnipcentral.com

Gnip

Gnip producers and consumers

Gnip

Gnip

Sample gnip code

     gnip = Gnip::Connection.new(Gnip::Config.new(USERNAME, PASSWORD))

     x, publisher = gnip.get_publisher('identica')

     x, activities = gnip.publisher_notifications_stream(publisher)

     activities.last.each{|activity|
        ['action', 'actor', 'at', 'payload', 'regarding',
         'source', 'tags', 'to', 'url'].each{|action|
              activity.send(action)
         }
     }

        

Gnip

Identica Output:

          action: notice
          actor: sacha
          at: 2008-10-01T12:17:11.000Z
          payload:
          regarding:
          source:
          tags:
          to:
          url: http://identi.ca/notice/701205
        

Gnip

Twitter Output:

          action: notice
          actor: joemescher
          at: 2008-10-01T12:25:56.000Z
          payload:
          regarding:
          source: mobile web
          tags:
          to:
          url: http://twitter.com/statuses/show/941807983.xml
        

Gnip

Delicious Output:

          action: bookmark
          actor: aluisiosaboya
          at: 2008-10-01T08:27:00.000-04:00
          payload:
          regarding: http://arcanjo.hitechlive.com.br/fazendo-o-widget-boo-box-mais-dinanico/
          source: http://feeds.delicious.com/v2/rss/aluisiosaboya
          tags:
          to:
          url: http://delicious.com/url/1ac6638fdd8225fb0df3cb4c73d31a84#aluisiosaboya
        

Gnip

Digg Output:

          action: dugg
          actor: Jamesk5
          at: 2008-10-01T08:32:38.000-04:00
          payload:
          regarding:
          source:
          tags: popular
          to:
          url: /story/8780477#178918016
        

Gnip

Digg 2 Output:

          action: submission
          actor: krowenlaw
          at: 2008-10-01T08:39:04.000-04:00
          payload:
          regarding: http://blogs.pcworld.com/staffblog/archives/007836.html
          source:
          tags: Tech Industry News,Technology
          to:
          url: http://digg.com/tech_news/Today_PC_World_Internet_Radio_Last_Minute_Hope
        

Gnip

Creating and retrieving a filter

  filter = Gnip::Filter.new('evan-filter', (explicitly_full_data = true))

  filter.add_a_rule(Gnip::Rule.new('actor', 'evan'))

  gnip.create_filter(@identica, filter)

  x, activities = gnip.filter_activities_stream(@identica, evan_filter)
        

Subscribing with a POST URL to retrieve information is not shown.

Sinatra

Your web application in one file :-)

  require 'rubygems'
  require 'sinatra'

  get '/' do
     "Hello world"
  end
        

And run it with:

  ruby my_sinatra_web_app.rb
        
and go to http://localhost:4567

Sinatra

... just very easy to toy around ...

Code

DEMO

http://sacha.schlegel.li:4567

End





Thanks